aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2011-04-26 23:20:22 -0400
committerIngo Molnar <mingo@elte.hu>2011-04-26 14:04:57 -0400
commit1fc570ad89e55dc32dfa4dda1311948b38f26524 (patch)
tree5e775a1f2627301110bd11246dd68cf727961c94 /tools/perf/util
parent481f988a016f7a0327a5537bde4794349fc4625c (diff)
perf stat: Add stalled cycles to the default output
The new default output looks like this: Performance counter stats for './loop_1b_instructions': 236.010686 task-clock # 0.996 CPUs utilized 0 context-switches # 0.000 M/sec 0 CPU-migrations # 0.000 M/sec 99 page-faults # 0.000 M/sec 756,487,646 cycles # 3.205 GHz 354,938,996 stalled-cycles # 46.92% of all cycles are idle 1,001,403,797 instructions # 1.32 insns per cycle # 0.35 stalled cycles per insn 100,279,773 branches # 424.895 M/sec 12,646 branch-misses # 0.013 % of all branches 0.236902540 seconds time elapsed We dropped cache-refs and cache-misses and added stalled-cycles - this is a more generic "how well utilized is the CPU" metric. If the stalled-cycles ratio is too high then more specific measurements can be taken to figure out the source of the inefficiency. Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Link: http://lkml.kernel.org/n/tip-pbpl2l4mn797s69bclfpwkwn@git.kernel.org Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/util')
-rw-r--r--tools/perf/util/parse-events.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index b5bfef12f399..bbbb735268ef 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -32,13 +32,13 @@ char debugfs_path[MAXPATHLEN];
32 32
33static struct event_symbol event_symbols[] = { 33static struct event_symbol event_symbols[] = {
34 { CHW(CPU_CYCLES), "cpu-cycles", "cycles" }, 34 { CHW(CPU_CYCLES), "cpu-cycles", "cycles" },
35 { CHW(STALLED_CYCLES), "stalled-cycles", "idle-cycles" },
35 { CHW(INSTRUCTIONS), "instructions", "" }, 36 { CHW(INSTRUCTIONS), "instructions", "" },
36 { CHW(CACHE_REFERENCES), "cache-references", "" }, 37 { CHW(CACHE_REFERENCES), "cache-references", "" },
37 { CHW(CACHE_MISSES), "cache-misses", "" }, 38 { CHW(CACHE_MISSES), "cache-misses", "" },
38 { CHW(BRANCH_INSTRUCTIONS), "branch-instructions", "branches" }, 39 { CHW(BRANCH_INSTRUCTIONS), "branch-instructions", "branches" },
39 { CHW(BRANCH_MISSES), "branch-misses", "" }, 40 { CHW(BRANCH_MISSES), "branch-misses", "" },
40 { CHW(BUS_CYCLES), "bus-cycles", "" }, 41 { CHW(BUS_CYCLES), "bus-cycles", "" },
41 { CHW(STALLED_CYCLES), "stalled-cycles", "" },
42 42
43 { CSW(CPU_CLOCK), "cpu-clock", "" }, 43 { CSW(CPU_CLOCK), "cpu-clock", "" },
44 { CSW(TASK_CLOCK), "task-clock", "" }, 44 { CSW(TASK_CLOCK), "task-clock", "" },
@@ -54,9 +54,9 @@ static struct event_symbol event_symbols[] = {
54#define __PERF_EVENT_FIELD(config, name) \ 54#define __PERF_EVENT_FIELD(config, name) \
55 ((config & PERF_EVENT_##name##_MASK) >> PERF_EVENT_##name##_SHIFT) 55 ((config & PERF_EVENT_##name##_MASK) >> PERF_EVENT_##name##_SHIFT)
56 56
57#define PERF_EVENT_RAW(config) __PERF_EVENT_FIELD(config, RAW) 57#define PERF_EVENT_RAW(config) __PERF_EVENT_FIELD(config, RAW)
58#define PERF_EVENT_CONFIG(config) __PERF_EVENT_FIELD(config, CONFIG) 58#define PERF_EVENT_CONFIG(config) __PERF_EVENT_FIELD(config, CONFIG)
59#define PERF_EVENT_TYPE(config) __PERF_EVENT_FIELD(config, TYPE) 59#define PERF_EVENT_TYPE(config) __PERF_EVENT_FIELD(config, TYPE)
60#define PERF_EVENT_ID(config) __PERF_EVENT_FIELD(config, EVENT) 60#define PERF_EVENT_ID(config) __PERF_EVENT_FIELD(config, EVENT)
61 61
62static const char *hw_event_names[] = { 62static const char *hw_event_names[] = {
@@ -67,6 +67,7 @@ static const char *hw_event_names[] = {
67 "branches", 67 "branches",
68 "branch-misses", 68 "branch-misses",
69 "bus-cycles", 69 "bus-cycles",
70 "stalled-cycles",
70}; 71};
71 72
72static const char *sw_event_names[] = { 73static const char *sw_event_names[] = {
@@ -308,7 +309,7 @@ const char *__event_name(int type, u64 config)
308 309
309 switch (type) { 310 switch (type) {
310 case PERF_TYPE_HARDWARE: 311 case PERF_TYPE_HARDWARE:
311 if (config < PERF_COUNT_HW_MAX) 312 if (config < PERF_COUNT_HW_MAX && hw_event_names[config])
312 return hw_event_names[config]; 313 return hw_event_names[config];
313 return "unknown-hardware"; 314 return "unknown-hardware";
314 315
@@ -334,7 +335,7 @@ const char *__event_name(int type, u64 config)
334 } 335 }
335 336
336 case PERF_TYPE_SOFTWARE: 337 case PERF_TYPE_SOFTWARE:
337 if (config < PERF_COUNT_SW_MAX) 338 if (config < PERF_COUNT_SW_MAX && sw_event_names[config])
338 return sw_event_names[config]; 339 return sw_event_names[config];
339 return "unknown-software"; 340 return "unknown-software";
340 341