tracing: Add numeric delta time to the trace event benchmark
authorSteven Rostedt (Google) <rostedt@goodmis.org>
Tue, 6 Sep 2022 22:53:14 +0000 (18:53 -0400)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Mon, 26 Sep 2022 17:01:09 +0000 (13:01 -0400)
In order to testing filtering and histograms via the trace event
benchmark, record the delta time of the last event as a numeric value
(currently, it just saves it within the string) so that filters and
histograms can use it.

Link: https://lkml.kernel.org/r/20220906225529.213677569@goodmis.org
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Tom Zanussi <zanussi@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
kernel/trace/trace_benchmark.c
kernel/trace/trace_benchmark.h

index 801c2a7..54d5fa3 100644 (file)
@@ -51,7 +51,7 @@ static void trace_do_benchmark(void)
 
        local_irq_disable();
        start = trace_clock_local();
-       trace_benchmark_event(bm_str);
+       trace_benchmark_event(bm_str, bm_last);
        stop = trace_clock_local();
        local_irq_enable();
 
index 79e6fbe..c3e9106 100644 (file)
@@ -14,19 +14,21 @@ extern void trace_benchmark_unreg(void);
 
 TRACE_EVENT_FN(benchmark_event,
 
-       TP_PROTO(const char *str),
+       TP_PROTO(const char *str, u64 delta),
 
-       TP_ARGS(str),
+       TP_ARGS(str, delta),
 
        TP_STRUCT__entry(
                __array(        char,   str,    BENCHMARK_EVENT_STRLEN  )
+               __field(        u64,    delta)
        ),
 
        TP_fast_assign(
                memcpy(__entry->str, str, BENCHMARK_EVENT_STRLEN);
+               __entry->delta = delta;
        ),
 
-       TP_printk("%s", __entry->str),
+       TP_printk("%s delta=%llu", __entry->str, __entry->delta),
 
        trace_benchmark_reg, trace_benchmark_unreg
 );