Commit 441dae8f authored by Joel Fernandes's avatar Joel Fernandes Committed by Steven Rostedt (VMware)

tracing: Add support for display of tgid in trace output

Earlier patches introduced ability to record the tgid using the 'record-tgid'
option. Here we read the tgid and output it if the option is enabled.

Link: http://lkml.kernel.org/r/20170626053844.5746-3-joelaf@google.com

Cc: kernel-team@android.com
Cc: Ingo Molnar <mingo@redhat.com>
Tested-by: default avatarMichael Sartain <mikesart@gmail.com>
Signed-off-by: default avatarJoel Fernandes <joelaf@google.com>
Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
parent d914ba37
...@@ -3319,23 +3319,29 @@ static void print_event_info(struct trace_buffer *buf, struct seq_file *m) ...@@ -3319,23 +3319,29 @@ static void print_event_info(struct trace_buffer *buf, struct seq_file *m)
seq_puts(m, "#\n"); seq_puts(m, "#\n");
} }
static void print_func_help_header(struct trace_buffer *buf, struct seq_file *m) static void print_func_help_header(struct trace_buffer *buf, struct seq_file *m,
unsigned int flags)
{ {
bool tgid = flags & TRACE_ITER_RECORD_TGID;
print_event_info(buf, m); print_event_info(buf, m);
seq_puts(m, "# TASK-PID CPU# TIMESTAMP FUNCTION\n"
"# | | | | |\n"); seq_printf(m, "# TASK-PID CPU# %s TIMESTAMP FUNCTION\n", tgid ? "TGID " : "");
seq_printf(m, "# | | | %s | |\n", tgid ? " | " : "");
} }
static void print_func_help_header_irq(struct trace_buffer *buf, struct seq_file *m) static void print_func_help_header_irq(struct trace_buffer *buf, struct seq_file *m,
unsigned int flags)
{ {
print_event_info(buf, m); bool tgid = flags & TRACE_ITER_RECORD_TGID;
seq_puts(m, "# _-----=> irqs-off\n"
"# / _----=> need-resched\n" seq_printf(m, "# %s _-----=> irqs-off\n", tgid ? " " : "");
"# | / _---=> hardirq/softirq\n" seq_printf(m, "# %s / _----=> need-resched\n", tgid ? " " : "");
"# || / _--=> preempt-depth\n" seq_printf(m, "# %s| / _---=> hardirq/softirq\n", tgid ? " " : "");
"# ||| / delay\n" seq_printf(m, "# %s|| / _--=> preempt-depth\n", tgid ? " " : "");
"# TASK-PID CPU# |||| TIMESTAMP FUNCTION\n" seq_printf(m, "# %s||| / delay\n", tgid ? " " : "");
"# | | | |||| | |\n"); seq_printf(m, "# TASK-PID CPU#%s|||| TIMESTAMP FUNCTION\n", tgid ? " TGID " : "");
seq_printf(m, "# | | | %s|||| | |\n", tgid ? " | " : "");
} }
void void
...@@ -3651,9 +3657,11 @@ void trace_default_header(struct seq_file *m) ...@@ -3651,9 +3657,11 @@ void trace_default_header(struct seq_file *m)
} else { } else {
if (!(trace_flags & TRACE_ITER_VERBOSE)) { if (!(trace_flags & TRACE_ITER_VERBOSE)) {
if (trace_flags & TRACE_ITER_IRQ_INFO) if (trace_flags & TRACE_ITER_IRQ_INFO)
print_func_help_header_irq(iter->trace_buffer, m); print_func_help_header_irq(iter->trace_buffer,
m, trace_flags);
else else
print_func_help_header(iter->trace_buffer, m); print_func_help_header(iter->trace_buffer, m,
trace_flags);
} }
} }
} }
......
...@@ -597,6 +597,15 @@ int trace_print_context(struct trace_iterator *iter) ...@@ -597,6 +597,15 @@ int trace_print_context(struct trace_iterator *iter)
trace_seq_printf(s, "%16s-%-5d [%03d] ", trace_seq_printf(s, "%16s-%-5d [%03d] ",
comm, entry->pid, iter->cpu); comm, entry->pid, iter->cpu);
if (tr->trace_flags & TRACE_ITER_RECORD_TGID) {
unsigned int tgid = trace_find_tgid(entry->pid);
if (!tgid)
trace_seq_printf(s, "(-----) ");
else
trace_seq_printf(s, "(%5d) ", tgid);
}
if (tr->trace_flags & TRACE_ITER_IRQ_INFO) if (tr->trace_flags & TRACE_ITER_IRQ_INFO)
trace_print_lat_fmt(s, entry); trace_print_lat_fmt(s, entry);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment