diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-05-30 06:38:51 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-05-30 06:41:12 -0400 |
commit | d7c29318c2daa96d64b7312afd8283488c1cb29f (patch) | |
tree | 4cfaddbe76b0670941b77ed093380efef310f822 /Documentation/perf_counter/builtin-stat.c | |
parent | c44613a4c1092e85841b78b7ab52a06654fcd321 (diff) |
perf_counter tools: Print 'CPU utilization factor' in builtin-stat
Before:
Performance counter stats for '/home/mingo/hackbench':
5728.862689 task clock ticks (msecs)
34426 context switches # 0.006 M/sec
3835 CPU migrations # 0.001 M/sec
18158 pagefaults # 0.003 M/sec
16218109156 CPU cycles # 2830.947 M/sec
13519616840 instructions # 2359.913 M/sec
55941661 cache references # 9.765 M/sec
23554938 cache misses # 4.112 M/sec
Wall-clock time elapsed: 528.886980 msecs
After:
Performance counter stats for '/home/mingo/hackbench':
5845.443541 task clock ticks # 11.886 CPU utilization factor
38289 context switches # 0.007 M/sec
4208 CPU migrations # 0.001 M/sec
17755 pagefaults # 0.003 M/sec
16664668576 CPU cycles # 2850.882 M/sec
13468113991 instructions # 2304.036 M/sec
57445468 cache references # 9.827 M/sec
26896502 cache misses # 4.601 M/sec
Wall-clock time elapsed: 491.802357 msecs
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: John Kacur <jkacur@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'Documentation/perf_counter/builtin-stat.c')
-rw-r--r-- | Documentation/perf_counter/builtin-stat.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/Documentation/perf_counter/builtin-stat.c b/Documentation/perf_counter/builtin-stat.c index ef7e0e1192cb..588679167c88 100644 --- a/Documentation/perf_counter/builtin-stat.c +++ b/Documentation/perf_counter/builtin-stat.c | |||
@@ -75,6 +75,7 @@ static __u64 event_res[MAX_COUNTERS][3]; | |||
75 | static __u64 event_scaled[MAX_COUNTERS]; | 75 | static __u64 event_scaled[MAX_COUNTERS]; |
76 | 76 | ||
77 | static __u64 runtime_nsecs; | 77 | static __u64 runtime_nsecs; |
78 | static __u64 walltime_nsecs; | ||
78 | 79 | ||
79 | static void create_perfstat_counter(int counter) | 80 | static void create_perfstat_counter(int counter) |
80 | { | 81 | { |
@@ -194,13 +195,19 @@ static void print_counter(int counter) | |||
194 | if (nsec_counter(counter)) { | 195 | if (nsec_counter(counter)) { |
195 | double msecs = (double)count[0] / 1000000; | 196 | double msecs = (double)count[0] / 1000000; |
196 | 197 | ||
197 | fprintf(stderr, " %14.6f %-20s (msecs)", | 198 | fprintf(stderr, " %14.6f %-20s", |
198 | msecs, event_name(counter)); | 199 | msecs, event_name(counter)); |
200 | if (event_id[counter] == | ||
201 | EID(PERF_TYPE_SOFTWARE, PERF_COUNT_TASK_CLOCK)) { | ||
202 | |||
203 | fprintf(stderr, " # %11.3f CPU utilization factor", | ||
204 | (double)count[0] / (double)walltime_nsecs); | ||
205 | } | ||
199 | } else { | 206 | } else { |
200 | fprintf(stderr, " %14Ld %-20s", | 207 | fprintf(stderr, " %14Ld %-20s", |
201 | count[0], event_name(counter)); | 208 | count[0], event_name(counter)); |
202 | if (runtime_nsecs) | 209 | if (runtime_nsecs) |
203 | fprintf(stderr, " # %12.3f M/sec", | 210 | fprintf(stderr, " # %11.3f M/sec", |
204 | (double)count[0]/runtime_nsecs*1000.0); | 211 | (double)count[0]/runtime_nsecs*1000.0); |
205 | } | 212 | } |
206 | if (scaled) | 213 | if (scaled) |
@@ -241,6 +248,8 @@ static int do_perfstat(int argc, const char **argv) | |||
241 | prctl(PR_TASK_PERF_COUNTERS_DISABLE); | 248 | prctl(PR_TASK_PERF_COUNTERS_DISABLE); |
242 | t1 = rdclock(); | 249 | t1 = rdclock(); |
243 | 250 | ||
251 | walltime_nsecs = t1 - t0; | ||
252 | |||
244 | fflush(stdout); | 253 | fflush(stdout); |
245 | 254 | ||
246 | fprintf(stderr, "\n"); | 255 | fprintf(stderr, "\n"); |