diff options
author | Jamie Gennis <jgennis@google.com> | 2012-11-21 15:04:25 -0800 |
---|---|---|
committer | John Stultz <john.stultz@linaro.org> | 2016-02-16 13:53:27 -0800 |
commit | 6019e59489e288c1eb7276387ea45d8ceb69f6b2 (patch) | |
tree | 3dbc140cf1c8eec9c9c95e4021968fe4e49890ac /kernel/trace/trace_output.c | |
parent | e2dba5ee5fa27dace155194163ce970c63e6fe7a (diff) |
trace: Add an option to show tgids in trace output
The tgids are tracked along side the saved_cmdlines tracking, and can be
included in trace output by enabling the 'print-tgid' trace option. This is
useful when doing post-processing of the trace data, as it allows events to be
grouped by tgid.
Change-Id: I52ed04c3a8ca7fddbb868b792ce5d21ceb76250e
Signed-off-by: Jamie Gennis <jgennis@google.com>
Diffstat (limited to 'kernel/trace/trace_output.c')
-rw-r--r-- | kernel/trace/trace_output.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c index 282982195e09..a2fc60a74e27 100644 --- a/kernel/trace/trace_output.c +++ b/kernel/trace/trace_output.c @@ -526,11 +526,21 @@ int trace_print_context(struct trace_iterator *iter) unsigned long long t; unsigned long secs, usec_rem; char comm[TASK_COMM_LEN]; + int tgid; trace_find_cmdline(entry->pid, comm); - trace_seq_printf(s, "%16s-%-5d [%03d] ", - comm, entry->pid, iter->cpu); + trace_seq_printf(s, "%16s-%-5d ", comm, entry->pid); + + if (tr->trace_flags & TRACE_ITER_TGID) { + tgid = trace_find_tgid(entry->pid); + if (tgid < 0) + trace_seq_puts(s, "(-----) "); + else + trace_seq_printf(s, "(%5d) ", tgid); + } + + trace_seq_printf(s, "[%03d] ", iter->cpu); if (tr->trace_flags & TRACE_ITER_IRQ_INFO) trace_print_lat_fmt(s, entry); |