diff options
author | Steven Rostedt <srostedt@redhat.com> | 2008-11-07 22:36:02 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-11-08 03:51:54 -0500 |
commit | a309720c876d7ad2e224bfd1982c92ae4364c82e (patch) | |
tree | a161d06f29e3739b95d8b96c3cfb67198de9af22 /kernel/trace/trace.c | |
parent | 769c48eb2530c5c1a393e2c82063f4f050571d24 (diff) |
ftrace: display start of CPU buffer in trace output
Impact: change in trace output
Because the trace buffers are per cpu ring buffers, the start of
the trace can be confusing. If one CPU is very active at the
end of the trace, its history will not go as far back as the
other CPU traces. This means that output for a particular CPU
may not appear for the first part of a trace.
To help annotate what is happening, and to prevent any more
confusion, this patch adds a line that annotates the start of
a CPU buffer output.
For example:
automount-3495 [001] 184.596443: dnotify_parent <-vfs_write
[...]
automount-3495 [001] 184.596449: dput <-path_put
automount-3496 [002] 184.596450: down_read_trylock <-do_page_fault
[...]
sshd-3497 [001] 184.597069: up_read <-do_page_fault
<idle>-0 [000] 184.597074: __exit_idle <-exit_idle
[...]
automount-3496 [002] 184.597257: filemap_fault <-__do_fault
<idle>-0 [003] 184.597261: exit_idle <-smp_apic_timer_interrupt
Note, parsers of a trace output should always ignore any lines that
start with a '#'.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/trace/trace.c')
-rw-r--r-- | kernel/trace/trace.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 58435415b366..f147f198b9a6 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -1478,6 +1478,17 @@ void trace_seq_print_cont(struct trace_seq *s, struct trace_iterator *iter) | |||
1478 | trace_seq_putc(s, '\n'); | 1478 | trace_seq_putc(s, '\n'); |
1479 | } | 1479 | } |
1480 | 1480 | ||
1481 | static void test_cpu_buff_start(struct trace_iterator *iter) | ||
1482 | { | ||
1483 | struct trace_seq *s = &iter->seq; | ||
1484 | |||
1485 | if (cpu_isset(iter->cpu, iter->started)) | ||
1486 | return; | ||
1487 | |||
1488 | cpu_set(iter->cpu, iter->started); | ||
1489 | trace_seq_printf(s, "##### CPU %u buffer started ####\n", iter->cpu); | ||
1490 | } | ||
1491 | |||
1481 | static enum print_line_t | 1492 | static enum print_line_t |
1482 | print_lat_fmt(struct trace_iterator *iter, unsigned int trace_idx, int cpu) | 1493 | print_lat_fmt(struct trace_iterator *iter, unsigned int trace_idx, int cpu) |
1483 | { | 1494 | { |
@@ -1497,6 +1508,8 @@ print_lat_fmt(struct trace_iterator *iter, unsigned int trace_idx, int cpu) | |||
1497 | if (entry->type == TRACE_CONT) | 1508 | if (entry->type == TRACE_CONT) |
1498 | return TRACE_TYPE_HANDLED; | 1509 | return TRACE_TYPE_HANDLED; |
1499 | 1510 | ||
1511 | test_cpu_buff_start(iter); | ||
1512 | |||
1500 | next_entry = find_next_entry(iter, NULL, &next_ts); | 1513 | next_entry = find_next_entry(iter, NULL, &next_ts); |
1501 | if (!next_entry) | 1514 | if (!next_entry) |
1502 | next_ts = iter->ts; | 1515 | next_ts = iter->ts; |
@@ -1612,6 +1625,8 @@ static enum print_line_t print_trace_fmt(struct trace_iterator *iter) | |||
1612 | if (entry->type == TRACE_CONT) | 1625 | if (entry->type == TRACE_CONT) |
1613 | return TRACE_TYPE_HANDLED; | 1626 | return TRACE_TYPE_HANDLED; |
1614 | 1627 | ||
1628 | test_cpu_buff_start(iter); | ||
1629 | |||
1615 | comm = trace_find_cmdline(iter->ent->pid); | 1630 | comm = trace_find_cmdline(iter->ent->pid); |
1616 | 1631 | ||
1617 | t = ns2usecs(iter->ts); | 1632 | t = ns2usecs(iter->ts); |
@@ -2631,6 +2646,10 @@ static int tracing_open_pipe(struct inode *inode, struct file *filp) | |||
2631 | return -ENOMEM; | 2646 | return -ENOMEM; |
2632 | 2647 | ||
2633 | mutex_lock(&trace_types_lock); | 2648 | mutex_lock(&trace_types_lock); |
2649 | |||
2650 | /* trace pipe does not show start of buffer */ | ||
2651 | cpus_setall(iter->started); | ||
2652 | |||
2634 | iter->tr = &global_trace; | 2653 | iter->tr = &global_trace; |
2635 | iter->trace = current_trace; | 2654 | iter->trace = current_trace; |
2636 | filp->private_data = iter; | 2655 | filp->private_data = iter; |