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


Groups > linux.kernel > #1457234 > unrolled thread

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

Started bySteven Rostedt <rostedt@goodmis.org>
First post2016-08-05 20:30 +0200
Last post2016-08-06 22:20 +0200
Articles 4 — 2 participants

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 Steven Rostedt <rostedt@goodmis.org> - 2016-08-05 20:30 +0200
    Re: [PATCH 2/4] tools lib traceevent: Use USECS_PER_SEC instead of  hardcoded number Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-08-05 20:40 +0200
      Re: [PATCH 2/4] tools lib traceevent: Use USECS_PER_SEC instead of  hardcoded number Steven Rostedt <rostedt@goodmis.org> - 2016-08-05 21:20 +0200
        Re: [PATCH 2/4] tools lib traceevent: Use USECS_PER_SEC instead of  hardcoded number Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-08-06 22:20 +0200

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

FromSteven Rostedt <rostedt@goodmis.org>
Date2016-08-05 20:30 +0200
SubjectRe: [PATCH 2/4] tools lib traceevent: Use USECS_PER_SEC instead of hardcoded number
Message-ID<s2S2C-2EU-27@gated-at.bofh.it>
On Wed, 2 Mar 2016 09:20:04 -0300
Arnaldo Carvalho de Melo <acme@kernel.org> wrote:

> 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.

Was this ever applied? Anyway, I'll also go ahead and convert this to
the non plural versions to match the kernel.

-- Steve

> 
> - Arnaldo

[toc] | [next] | [standalone]


#1457241

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2016-08-05 20:40 +0200
Message-ID<s2Sci-2Ir-17@gated-at.bofh.it>
In reply to#1457234
Em Fri, Aug 05, 2016 at 02:19:42PM -0400, Steven Rostedt escreveu:
> On Wed, 2 Mar 2016 09:20:04 -0300
> Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> 
> > 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.
> 
> Was this ever applied? Anyway, I'll also go ahead and convert this to
> the non plural versions to match the kernel.

Fell thru the cracks :-\ The other patches in the series were applied
tho.

I'm introducing this and removing the definitions I have in
tools/perf/perf.h for NSEC_PER_SEC and NSEC_PER_USEC:

[acme@jouet linux]$ cat tools/include/linux/time64.h 
#ifndef _TOOLS_LINUX_TIME64_H
#define _TOOLS_LINUX_TIME64_H

#define MSEC_PER_SEC	1000L
#define USEC_PER_MSEC	1000L
#define NSEC_PER_USEC	1000L
#define NSEC_PER_MSEC	1000000L
#define USEC_PER_SEC	1000000L
#define NSEC_PER_SEC	1000000000L
#define FSEC_PER_SEC	1000000000000000LL

#endif /* _TOOLS_LINUX_TIME64_H */
[acme@jouet linux]$ 

So the header to include is the same as in the kernel, the constants as
well. We can go on adding more stuff from include/linux/time64.h as
tools use it.

- Arnaldo

[toc] | [prev] | [next] | [standalone]


#1457256

FromSteven Rostedt <rostedt@goodmis.org>
Date2016-08-05 21:20 +0200
Message-ID<s2SOZ-3fo-11@gated-at.bofh.it>
In reply to#1457241
On Fri, 5 Aug 2016 15:36:55 -0300
Arnaldo Carvalho de Melo <acme@kernel.org> wrote:


> [acme@jouet linux]$ cat tools/include/linux/time64.h 
> #ifndef _TOOLS_LINUX_TIME64_H
> #define _TOOLS_LINUX_TIME64_H
> 
> #define MSEC_PER_SEC	1000L
> #define USEC_PER_MSEC	1000L
> #define NSEC_PER_USEC	1000L
> #define NSEC_PER_MSEC	1000000L
> #define USEC_PER_SEC	1000000L
> #define NSEC_PER_SEC	1000000000L
> #define FSEC_PER_SEC	1000000000000000LL
> 
> #endif /* _TOOLS_LINUX_TIME64_H */
> [acme@jouet linux]$ 
> 
> So the header to include is the same as in the kernel, the constants as
> well. We can go on adding more stuff from include/linux/time64.h as
> tools use it.

OK, can you modify the scripting-engines/trace-event-*.c to use that
too. I'm going to move the macros locally into event-parse.c, as I work
to make that ready to be a separate library.

Thanks!

-- Steve

[toc] | [prev] | [next] | [standalone]


#1457318

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2016-08-06 22:20 +0200
Message-ID<s3geC-22d-23@gated-at.bofh.it>
In reply to#1457256
Em Fri, Aug 05, 2016 at 03:15:28PM -0400, Steven Rostedt escreveu:
> On Fri, 5 Aug 2016 15:36:55 -0300
> Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> 
> 
> > [acme@jouet linux]$ cat tools/include/linux/time64.h 
> > #ifndef _TOOLS_LINUX_TIME64_H
> > #define _TOOLS_LINUX_TIME64_H
> > 
> > #define MSEC_PER_SEC	1000L
> > #define USEC_PER_MSEC	1000L
> > #define NSEC_PER_USEC	1000L
> > #define NSEC_PER_MSEC	1000000L
> > #define USEC_PER_SEC	1000000L
> > #define NSEC_PER_SEC	1000000000L
> > #define FSEC_PER_SEC	1000000000000000LL
> > 
> > #endif /* _TOOLS_LINUX_TIME64_H */
> > [acme@jouet linux]$ 
> > 
> > So the header to include is the same as in the kernel, the constants as
> > well. We can go on adding more stuff from include/linux/time64.h as
> > tools use it.
> 
> OK, can you modify the scripting-engines/trace-event-*.c to use that
> too. I'm going to move the macros locally into event-parse.c, as I work
> to make that ready to be a separate library.

Ok, and I fix a few more, pushing to perf/core.
 
> Thanks!
> 
> -- Steve

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web