mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-05 01:54:09 +08:00
tracing: consolidate print_lat_fmt and print_trace_fmt
Impact: clean up Both print_lat_fmt and print_trace_fmt do pretty much the same thing except for one different function call. This patch consolidates the two functions and adds an if statement to perform the difference. Signed-off-by: Steven Rostedt <srostedt@redhat.com>
This commit is contained in:
parent
5fd73f8624
commit
27d48be844
@ -1468,33 +1468,6 @@ static void test_cpu_buff_start(struct trace_iterator *iter)
|
|||||||
trace_seq_printf(s, "##### CPU %u buffer started ####\n", iter->cpu);
|
trace_seq_printf(s, "##### CPU %u buffer started ####\n", iter->cpu);
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum print_line_t print_lat_fmt(struct trace_iterator *iter)
|
|
||||||
{
|
|
||||||
struct trace_seq *s = &iter->seq;
|
|
||||||
unsigned long sym_flags = (trace_flags & TRACE_ITER_SYM_MASK);
|
|
||||||
struct trace_event *event;
|
|
||||||
struct trace_entry *entry = iter->ent;
|
|
||||||
|
|
||||||
test_cpu_buff_start(iter);
|
|
||||||
|
|
||||||
event = ftrace_find_event(entry->type);
|
|
||||||
|
|
||||||
if (trace_flags & TRACE_ITER_CONTEXT_INFO) {
|
|
||||||
if (!trace_print_lat_context(iter))
|
|
||||||
goto partial;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (event)
|
|
||||||
return event->trace(iter, sym_flags);
|
|
||||||
|
|
||||||
if (!trace_seq_printf(s, "Unknown type %d\n", entry->type))
|
|
||||||
goto partial;
|
|
||||||
|
|
||||||
return TRACE_TYPE_HANDLED;
|
|
||||||
partial:
|
|
||||||
return TRACE_TYPE_PARTIAL_LINE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static enum print_line_t print_trace_fmt(struct trace_iterator *iter)
|
static enum print_line_t print_trace_fmt(struct trace_iterator *iter)
|
||||||
{
|
{
|
||||||
struct trace_seq *s = &iter->seq;
|
struct trace_seq *s = &iter->seq;
|
||||||
@ -1509,8 +1482,13 @@ static enum print_line_t print_trace_fmt(struct trace_iterator *iter)
|
|||||||
event = ftrace_find_event(entry->type);
|
event = ftrace_find_event(entry->type);
|
||||||
|
|
||||||
if (trace_flags & TRACE_ITER_CONTEXT_INFO) {
|
if (trace_flags & TRACE_ITER_CONTEXT_INFO) {
|
||||||
if (!trace_print_context(iter))
|
if (iter->iter_flags & TRACE_FILE_LAT_FMT) {
|
||||||
goto partial;
|
if (!trace_print_lat_context(iter))
|
||||||
|
goto partial;
|
||||||
|
} else {
|
||||||
|
if (!trace_print_context(iter))
|
||||||
|
goto partial;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event)
|
if (event)
|
||||||
@ -1652,9 +1630,6 @@ static enum print_line_t print_trace_line(struct trace_iterator *iter)
|
|||||||
if (trace_flags & TRACE_ITER_RAW)
|
if (trace_flags & TRACE_ITER_RAW)
|
||||||
return print_raw_fmt(iter);
|
return print_raw_fmt(iter);
|
||||||
|
|
||||||
if (iter->iter_flags & TRACE_FILE_LAT_FMT)
|
|
||||||
return print_lat_fmt(iter);
|
|
||||||
|
|
||||||
return print_trace_fmt(iter);
|
return print_trace_fmt(iter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user