Skip to content

Commit

Permalink
tracing: Add numeric delta time to the trace event benchmark
Browse files Browse the repository at this point in the history
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/[email protected]

Cc: Ingo Molnar <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Masami Hiramatsu <[email protected]>
Cc: Tom Zanussi <[email protected]>
Signed-off-by: Steven Rostedt (Google) <[email protected]>
  • Loading branch information
rostedt committed Sep 26, 2022
1 parent 4359a01 commit b7b037e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion kernel/trace/trace_benchmark.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
8 changes: 5 additions & 3 deletions kernel/trace/trace_benchmark.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
Expand Down

0 comments on commit b7b037e

Please sign in to comment.