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


Groups > linux.kernel > #1525798

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

From Arnaldo Carvalho de Melo <acme@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH 2/2] tools lib traceevent: Use USECS_PER_SEC instead of hardcoded number
Date 2016-11-19 00:50 +0100
Message-ID <sF14R-5qH-5@gated-at.bofh.it> (permalink)
References <sF0it-4V9-3@gated-at.bofh.it> <sF0it-4V9-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Em Fri, Nov 18, 2016 at 05:54:01PM -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.

We already have it in tools/include/linux/time64.h :-)

- Arnaldo
 
> Link: http://lkml.kernel.org/r/20160209204237.006667394@goodmis.org
> 
> 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 d6f3cc0a29b0..2b85b339f6b9 100644
> --- a/tools/lib/traceevent/event-parse.c
> +++ b/tools/lib/traceevent/event-parse.c
> @@ -5465,8 +5465,8 @@ void pevent_print_event_time(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 41b3d2238ed3..b09dd49465b0 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.10.2
> 

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/2] tools lib traceevent: A couple of updates Steven Rostedt <rostedt@goodmis.org> - 2016-11-19 00:00 +0100
  [PATCH 1/2] tools lib traceevent: Add retrieval of preempt count and latency  flags Steven Rostedt <rostedt@goodmis.org> - 2016-11-19 00:00 +0100
    Re: [PATCH 1/2] tools lib traceevent: Add retrieval of preempt count  and latency flags Namhyung Kim <namhyung@kernel.org> - 2016-11-22 08:00 +0100
      Re: [PATCH 1/2] tools lib traceevent: Add retrieval of preempt  count and latency flags Steven Rostedt <rostedt@goodmis.org> - 2016-11-22 15:40 +0100
      [PATCH v2] tools lib traceevent: Add retrieval of preempt count and  latency flags Steven Rostedt <rostedt@goodmis.org> - 2016-11-22 17:40 +0100
        Re: [PATCH v2] tools lib traceevent: Add retrieval of preempt count  and latency flags Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-11-22 19:10 +0100
          Re: [PATCH v2] tools lib traceevent: Add retrieval of preempt count  and latency flags Namhyung Kim <namhyung@kernel.org> - 2016-11-23 05:50 +0100
        [tip:perf/core] tools lib traceevent: Add retrieval of preempt  count and latency flags tip-bot for Steven Rostedt <tipbot@zytor.com> - 2016-11-24 05:20 +0100
  [PATCH 2/2] tools lib traceevent: Use USECS_PER_SEC instead of hardcoded number Steven Rostedt <rostedt@goodmis.org> - 2016-11-19 00:00 +0100
    Re: [PATCH 2/2] tools lib traceevent: Use USECS_PER_SEC instead of  hardcoded number Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-11-19 00:50 +0100
      Re: [PATCH 2/2] tools lib traceevent: Use USECS_PER_SEC instead of  hardcoded number Steven Rostedt <rostedt@goodmis.org> - 2016-11-21 17:50 +0100
        Re: [PATCH 2/2] tools lib traceevent: Use USECS_PER_SEC instead of  hardcoded number Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-11-21 20:20 +0100
        Re: [PATCH 2/2] tools lib traceevent: Use USECS_PER_SEC instead of  hardcoded number Namhyung Kim <namhyung@kernel.org> - 2016-11-22 08:00 +0100
        [tip:perf/core] tools lib traceevent: Use USECS_PER_SEC instead of  hardcoded number tip-bot for Steven Rostedt <tipbot@zytor.com> - 2016-11-24 05:20 +0100

csiph-web