From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755331AbcCBMUP (ORCPT ); Wed, 2 Mar 2016 07:20:15 -0500 Received: from mail.kernel.org ([198.145.29.136]:44913 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754484AbcCBMUN (ORCPT ); Wed, 2 Mar 2016 07:20:13 -0500 Date: Wed, 2 Mar 2016 09:20:04 -0300 From: Arnaldo Carvalho de Melo To: Steven Rostedt Cc: linux-kernel@vger.kernel.org, Ingo Molnar , Andrew Morton Subject: Re: [PATCH 2/4] tools lib traceevent: Use USECS_PER_SEC instead of hardcoded number Message-ID: <20160302122004.GI3604@kernel.org> References: <20160209204013.951400594@goodmis.org> <20160209204237.006667394@goodmis.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160209204237.006667394@goodmis.org> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Tue, Feb 09, 2016 at 03:40:15PM -0500, Steven Rostedt escreveu: > From: "Steven Rostedt (Red Hat)" > > Instead of using 1000000, define a USECS_PER_SEC macro and use that instead. Applying, but the kernel uses USEC_PER_SEC, NSEC_PER_SEC, etc, at some point I'll try and get those same headers in tools/include/ and make all of tools/ use the same convention as the kernel. - Arnaldo > Signed-off-by: Steven Rostedt > --- > tools/lib/traceevent/event-parse.c | 4 ++-- > tools/lib/traceevent/event-parse.h | 2 ++ > 2 files changed, 4 insertions(+), 2 deletions(-) > > diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c > index a6f1ce779e05..f49b266b3978 100644 > --- a/tools/lib/traceevent/event-parse.c > +++ b/tools/lib/traceevent/event-parse.c > @@ -5388,8 +5388,8 @@ void pevent_print_event(struct pevent *pevent, struct trace_seq *s, > } else { > usecs = (nsecs + 500) / NSECS_PER_USEC; > /* To avoid usecs larger than 1 sec */ > - if (usecs >= 1000000) { > - usecs -= 1000000; > + if (usecs >= USECS_PER_SEC) { > + usecs -= USECS_PER_SEC; > secs++; > } > p = 6; > diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h > index 706d9bc24066..4373c5190076 100644 > --- a/tools/lib/traceevent/event-parse.h > +++ b/tools/lib/traceevent/event-parse.h > @@ -175,6 +175,8 @@ struct pevent_plugin_option { > #define NSECS_PER_SEC 1000000000ULL > #define NSECS_PER_USEC 1000ULL > > +#define USECS_PER_SEC 1000000ULL > + > enum format_flags { > FIELD_IS_ARRAY = 1, > FIELD_IS_POINTER = 2, > -- > 2.6.4 >