[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210603172902.41648183@gandalf.local.home>
Date: Thu, 3 Jun 2021 17:29:02 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Daniel Bristot de Oliveira <bristot@...hat.com>
Cc: linux-kernel@...r.kernel.org, Phil Auld <pauld@...hat.com>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Kate Carcia <kcarcia@...hat.com>,
Jonathan Corbet <corbet@....net>,
Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>,
Alexandre Chartre <alexandre.chartre@...cle.com>,
Clark Willaims <williams@...hat.com>,
John Kacur <jkacur@...hat.com>,
Juri Lelli <juri.lelli@...hat.com>, linux-doc@...r.kernel.org
Subject: Re: [PATCH V3 7/9] tracing: Add __print_ns_to_secs() and
__print_ns_without_secs() helpers
On Fri, 14 May 2021 22:51:16 +0200
Daniel Bristot de Oliveira <bristot@...hat.com> wrote:
> +++ b/include/trace/trace_events.h
> @@ -358,6 +358,21 @@ TRACE_MAKE_SYSTEM_STR();
> trace_print_hex_dump_seq(p, prefix_str, prefix_type, \
> rowsize, groupsize, buf, len, ascii)
>
> +#undef __print_ns_to_secs
> +#define __print_ns_to_secs(value) \
> + ({ \
> + u64 ____val = (u64)value; \
> + do_div(____val, NSEC_PER_SEC); \
> + ____val; \
> + })
I know my name is on this, but we need parenthesis around "value".
> +
> +#undef __print_ns_without_secs
> +#define __print_ns_without_secs(value) \
> + ({ \
> + u64 ____val = (u64)value; \
Here too.
> + (u32) do_div(____val, NSEC_PER_SEC); \
> + })
> +
> #undef DECLARE_EVENT_CLASS
> #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
> static notrace enum print_line_t \
> @@ -736,6 +751,16 @@ static inline void ftrace_test_probe_##call(void) \
> #undef __print_array
> #undef __print_hex_dump
>
> +/*
> + * The below is not executed in the kernel. It is only what is
> + * displayed in the print format for userspace to parse.
> + */
> +#undef __print_ns_to_secs
> +#define __print_ns_to_secs(val) val / 1000000000UL
> +
> +#undef __print_ns_without_secs
> +#define __print_ns_without_secs(val) val % 1000000000UL
And around "val" in the above two macros.
-- Steve
> +
> #undef TP_printk
> #define TP_printk(fmt, args...) "\"" fmt "\", " __stringify(args)
>
Powered by blists - more mailing lists