diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-09-02 14:20:38 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-09-02 15:28:50 -0400 |
commit | cd6feeeafddbef6abfe4d90fb26e42fd844d34ed (patch) | |
tree | 382a1afe242e7b8e8e7691a03e9ab39016c5c24b /tools | |
parent | 65014ab36196f6d86edc9ee23759d6930b9d89a8 (diff) |
perf trace: Sample the CPU too
Sample, record, parse and print the CPU field - it had all zeroes before.
Before (watch the second column, the CPU values):
perf-32685 [000] 0.000000: sched_wakeup_new: task perf:32686 [120] success=1 [011]
perf-32685 [000] 0.000000: sched_migrate_task: task perf:32685 [120] from: 1 to: 11
perf-32685 [000] 0.000000: sched_process_fork: parent perf:32685 child perf:32686
true-32686 [000] 0.000000: sched_wakeup: task migration/11:25 [0] success=1 [011]
true-32686 [000] 0.000000: sched_wakeup: task distccd:12793 [125] success=1 [015]
true-32686 [000] 0.000000: sched_wakeup: task distccd:12793 [125] success=1 [015]
perf-32685 [000] 0.000000: sched_switch: task perf:32685 [120] (S) ==> swapper:0 [140]
true-32686 [000] 0.000000: sched_switch: task perf:32686 [120] (R) ==> migration/11:25 [0]
true-32686 [000] 0.000000: sched_switch: task perf:32686 [120] (R) ==> distccd:12793 [125]
true-32686 [000] 0.000000: sched_switch: task true:32686 [120] (R) ==> distccd:12793 [125]
true-32686 [000] 0.000000: sched_process_exit: task true:32686 [120]
true-32686 [000] 0.000000: sched_stat_wait: task: distccd:12793 wait: 6767985949080 [ns]
true-32686 [000] 0.000000: sched_stat_wait: task: distccd:12793 wait: 6767986139446 [ns]
true-32686 [000] 0.000000: sched_stat_sleep: task: distccd:12793 sleep: 132844 [ns]
true-32686 [000] 0.000000: sched_stat_sleep: task: distccd:12793 sleep: 131724 [ns]
After:
perf-32685 [001] 0.000000: sched_wakeup_new: task perf:32686 [120] success=1 [011]
perf-32685 [001] 0.000000: sched_migrate_task: task perf:32685 [120] from: 1 to: 11
perf-32685 [001] 0.000000: sched_process_fork: parent perf:32685 child perf:32686
true-32686 [011] 0.000000: sched_wakeup: task migration/11:25 [0] success=1 [011]
true-32686 [015] 0.000000: sched_wakeup: task distccd:12793 [125] success=1 [015]
true-32686 [015] 0.000000: sched_wakeup: task distccd:12793 [125] success=1 [015]
perf-32685 [001] 0.000000: sched_switch: task perf:32685 [120] (S) ==> swapper:0 [140]
true-32686 [011] 0.000000: sched_switch: task perf:32686 [120] (R) ==> migration/11:25 [0]
true-32686 [015] 0.000000: sched_switch: task perf:32686 [120] (R) ==> distccd:12793 [125]
true-32686 [015] 0.000000: sched_switch: task true:32686 [120] (R) ==> distccd:12793 [125]
true-32686 [015] 0.000000: sched_process_exit: task true:32686 [120]
true-32686 [015] 0.000000: sched_stat_wait: task: distccd:12793 wait: 6767985949080 [ns]
true-32686 [015] 0.000000: sched_stat_wait: task: distccd:12793 wait: 6767986139446 [ns]
true-32686 [015] 0.000000: sched_stat_sleep: task: distccd:12793 sleep: 132844 [ns]
true-32686 [015] 0.000000: sched_stat_sleep: task: distccd:12793 sleep: 131724 [ns]
So we can now see how this workload migrated between CPUs.
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Li Zefan <lizf@cn.fujitsu.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/builtin-record.c | 4 | ||||
-rw-r--r-- | tools/perf/builtin-trace.c | 9 |
2 files changed, 11 insertions, 2 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index add514d53d2..ff93f8ecba2 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -403,8 +403,10 @@ static void create_counter(int counter, int cpu, pid_t pid) | |||
403 | if (call_graph) | 403 | if (call_graph) |
404 | attr->sample_type |= PERF_SAMPLE_CALLCHAIN; | 404 | attr->sample_type |= PERF_SAMPLE_CALLCHAIN; |
405 | 405 | ||
406 | if (raw_samples) | 406 | if (raw_samples) { |
407 | attr->sample_type |= PERF_SAMPLE_RAW; | 407 | attr->sample_type |= PERF_SAMPLE_RAW; |
408 | attr->sample_type |= PERF_SAMPLE_CPU; | ||
409 | } | ||
408 | 410 | ||
409 | attr->mmap = track; | 411 | attr->mmap = track; |
410 | attr->comm = track; | 412 | attr->comm = track; |
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 8247fd04745..bbe4c444ef8 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c | |||
@@ -58,12 +58,19 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head) | |||
58 | struct dso *dso = NULL; | 58 | struct dso *dso = NULL; |
59 | struct thread *thread; | 59 | struct thread *thread; |
60 | u64 ip = event->ip.ip; | 60 | u64 ip = event->ip.ip; |
61 | u32 cpu = -1; | ||
61 | u64 period = 1; | 62 | u64 period = 1; |
62 | void *more_data = event->ip.__more_data; | 63 | void *more_data = event->ip.__more_data; |
63 | int cpumode; | 64 | int cpumode; |
64 | 65 | ||
65 | thread = threads__findnew(event->ip.pid, &threads, &last_match); | 66 | thread = threads__findnew(event->ip.pid, &threads, &last_match); |
66 | 67 | ||
68 | if (sample_type & PERF_SAMPLE_CPU) { | ||
69 | cpu = *(u32 *)more_data; | ||
70 | more_data += sizeof(u32); | ||
71 | more_data += sizeof(u32); /* reserved */ | ||
72 | } | ||
73 | |||
67 | if (sample_type & PERF_SAMPLE_PERIOD) { | 74 | if (sample_type & PERF_SAMPLE_PERIOD) { |
68 | period = *(u64 *)more_data; | 75 | period = *(u64 *)more_data; |
69 | more_data += sizeof(u64); | 76 | more_data += sizeof(u64); |
@@ -120,7 +127,7 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head) | |||
120 | * field, although it should be the same than this perf | 127 | * field, although it should be the same than this perf |
121 | * event pid | 128 | * event pid |
122 | */ | 129 | */ |
123 | print_event(0, raw->data, raw->size, 0, thread->comm); | 130 | print_event(cpu, raw->data, raw->size, 0, thread->comm); |
124 | } | 131 | } |
125 | total += period; | 132 | total += period; |
126 | 133 | ||