History

ftrace: Reuse the output of the function tracer for func_repeats

The func_repeats event shows the output of the function tracer followed by a count of the number of repeats the previous function had made, as well as the timestamp of the last function that was repeated. The printing of the function should be the same as is for the function it is displaying. Reuse the code in trace_fn_trace() by making a helper function print_fn_trace() and use it for trace_func_repeats_print().

Steven Rostedt (VMware) committed 5 years ago

Commit e1db6331 parent 22db0951 file · +13 −10Browse files

Unified · Split

kernel/trace/trace_output.c+13−10
@@ -845,6 +845,17 @@ enum print_line_t trace_nop_print(struct trace_iterator *iter, int flags, · 844 unmodified lines
845845 return trace_handle_return(&iter->seq);
846846 }
847847
848+static void print_fn_trace(struct trace_seq *s, unsigned long ip,
849+ unsigned long parent_ip, int flags)
850+{
851+ seq_print_ip_sym(s, ip, flags);
852+
853+ if ((flags & TRACE_ITER_PRINT_PARENT) && parent_ip) {
854+ trace_seq_puts(s, " <-");
855+ seq_print_ip_sym(s, parent_ip, flags);
856+ }
857+}
858+
848859 /* TRACE_FN */
849860 static enum print_line_t trace_fn_trace(struct trace_iterator *iter, int flags,
850861 struct trace_event *event)
@@ -854,13 +865,7 @@ static enum print_line_t trace_fn_trace(struct trace_iterator *iter, int flags, · 3 unmodified lines
854865
855866 trace_assign_type(field, iter->ent);
856867
857− seq_print_ip_sym(s, field->ip, flags);
858−
859− if ((flags & TRACE_ITER_PRINT_PARENT) && field->parent_ip) {
860− trace_seq_puts(s, " <-");
861− seq_print_ip_sym(s, field->parent_ip, flags);
862− }
863−
868+ print_fn_trace(s, field->ip, field->parent_ip, flags);
864869 trace_seq_putc(s, '\n');
865870
866871 return trace_handle_return(s);
@@ -1408,9 +1413,7 @@ trace_func_repeats_print(struct trace_iterator *iter, int flags, · 541 unmodified lines
14081413
14091414 trace_assign_type(field, iter->ent);
14101415
1411− seq_print_ip_sym(s, field->ip, flags);
1412− trace_seq_puts(s, " <-");
1413− seq_print_ip_sym(s, field->parent_ip, flags);
1416+ print_fn_trace(s, field->ip, field->parent_ip, flags);
14141417 trace_seq_printf(s, " (repeats: %u, last_ts:", field->count);
14151418 trace_print_time(s, iter,
14161419 iter->ts - FUNC_REPEATS_GET_DELTA_TS(field));

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t