Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1347997 > unrolled thread

Re: [PATCH 2/4] tools lib traceevent: Use USECS_PER_SEC instead of hardcoded number

Started byArnaldo Carvalho de Melo <acme@kernel.org>
First post2016-03-02 13:30 +0100
Last post2016-03-02 13:30 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 2/4] tools lib traceevent: Use USECS_PER_SEC instead of  hardcoded number Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-03-02 13:30 +0100

#1347997 — Re: [PATCH 2/4] tools lib traceevent: Use USECS_PER_SEC instead of hardcoded number

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2016-03-02 13:30 +0100
SubjectRe: [PATCH 2/4] tools lib traceevent: Use USECS_PER_SEC instead of hardcoded number
Message-ID<r8e4F-7wR-3@gated-at.bofh.it>
Em Tue, Feb 09, 2016 at 03:40:15PM -0500, Steven Rostedt escreveu:
> From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
> 
> 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 <rostedt@goodmis.org>
> ---
>  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
> 

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web