tracing: Define new ftrace event "func_repeats"
The event aims to consolidate the function tracing record in the cases when a single function is called number of times consecutively. while (cond) do_func(); This may happen in various scenarios (busy waiting for example). The new ftrace event can be used to show repeated function events with a single event and save space on the ring buffer Link: https://lkml.kernel.org/r/20210415181854.147448-3-y.karadz@gmail.com Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
This commit is contained in:
committed by
Steven Rostedt (VMware)
parent
eaa7a89720
commit
f689e4f280
@@ -1381,6 +1381,53 @@ static struct trace_event trace_raw_data_event = {
|
||||
.funcs = &trace_raw_data_funcs,
|
||||
};
|
||||
|
||||
static enum print_line_t
|
||||
trace_func_repeats_raw(struct trace_iterator *iter, int flags,
|
||||
struct trace_event *event)
|
||||
{
|
||||
struct func_repeats_entry *field;
|
||||
struct trace_seq *s = &iter->seq;
|
||||
|
||||
trace_assign_type(field, iter->ent);
|
||||
|
||||
trace_seq_printf(s, "%lu %lu %u %llu\n",
|
||||
field->ip,
|
||||
field->parent_ip,
|
||||
field->count,
|
||||
FUNC_REPEATS_GET_DELTA_TS(field));
|
||||
|
||||
return trace_handle_return(s);
|
||||
}
|
||||
|
||||
static enum print_line_t
|
||||
trace_func_repeats_print(struct trace_iterator *iter, int flags,
|
||||
struct trace_event *event)
|
||||
{
|
||||
struct func_repeats_entry *field;
|
||||
struct trace_seq *s = &iter->seq;
|
||||
|
||||
trace_assign_type(field, iter->ent);
|
||||
|
||||
seq_print_ip_sym(s, field->ip, flags);
|
||||
trace_seq_puts(s, " <-");
|
||||
seq_print_ip_sym(s, field->parent_ip, flags);
|
||||
trace_seq_printf(s, " (repeats: %u, last_ts:", field->count);
|
||||
trace_print_time(s, iter,
|
||||
iter->ts - FUNC_REPEATS_GET_DELTA_TS(field));
|
||||
trace_seq_puts(s, ")\n");
|
||||
|
||||
return trace_handle_return(s);
|
||||
}
|
||||
|
||||
static struct trace_event_functions trace_func_repeats_funcs = {
|
||||
.trace = trace_func_repeats_print,
|
||||
.raw = trace_func_repeats_raw,
|
||||
};
|
||||
|
||||
static struct trace_event trace_func_repeats_event = {
|
||||
.type = TRACE_FUNC_REPEATS,
|
||||
.funcs = &trace_func_repeats_funcs,
|
||||
};
|
||||
|
||||
static struct trace_event *events[] __initdata = {
|
||||
&trace_fn_event,
|
||||
@@ -1393,6 +1440,7 @@ static struct trace_event *events[] __initdata = {
|
||||
&trace_print_event,
|
||||
&trace_hwlat_event,
|
||||
&trace_raw_data_event,
|
||||
&trace_func_repeats_event,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user