aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2011-04-29 08:41:28 -0400
committerIngo Molnar <mingo@elte.hu>2011-04-29 08:35:49 -0400
commit129c04cb8ce2e4bf3f17223f58ef16aa8a2cb3b8 (patch)
treedd6bacbcefee60d18e0f962df5650d2b48febcf8 /tools
parent91fc4cc00099986bc1ba50e1f421c3548cffae42 (diff)
perf tools: Add front-end and back-end stalled cycles support
Update perf tooling to deal with front-end and back-end stalled cycles events. Add both the default 'perf stat' output. Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Link: http://lkml.kernel.org/n/tip-7y40wib8n002io7hjpn1dsrm@git.kernel.org Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/builtin-stat.c10
-rw-r--r--tools/perf/util/parse-events.c37
-rw-r--r--tools/perf/util/python.c4
3 files changed, 28 insertions, 23 deletions
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index da77077450cf..6a4a8a399d95 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -66,7 +66,8 @@ static struct perf_event_attr default_attrs[] = {
66 { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_PAGE_FAULTS }, 66 { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_PAGE_FAULTS },
67 67
68 { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_CPU_CYCLES }, 68 { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_CPU_CYCLES },
69 { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_STALLED_CYCLES }, 69 { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_STALLED_CYCLES_FRONTEND },
70 { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_STALLED_CYCLES_BACKEND },
70 { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_INSTRUCTIONS }, 71 { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_INSTRUCTIONS },
71 { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_BRANCH_INSTRUCTIONS }, 72 { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_BRANCH_INSTRUCTIONS },
72 { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_BRANCH_MISSES }, 73 { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_BRANCH_MISSES },
@@ -84,7 +85,8 @@ static struct perf_event_attr detailed_attrs[] = {
84 { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_PAGE_FAULTS }, 85 { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_PAGE_FAULTS },
85 86
86 { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_CPU_CYCLES }, 87 { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_CPU_CYCLES },
87 { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_STALLED_CYCLES }, 88 { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_STALLED_CYCLES_FRONTEND },
89 { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_STALLED_CYCLES_BACKEND },
88 { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_INSTRUCTIONS }, 90 { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_INSTRUCTIONS },
89 { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_BRANCH_INSTRUCTIONS }, 91 { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_BRANCH_INSTRUCTIONS },
90 { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_BRANCH_MISSES }, 92 { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_BRANCH_MISSES },
@@ -249,7 +251,7 @@ static void update_shadow_stats(struct perf_evsel *counter, u64 *count)
249 update_stats(&runtime_nsecs_stats[0], count[0]); 251 update_stats(&runtime_nsecs_stats[0], count[0]);
250 else if (perf_evsel__match(counter, HARDWARE, HW_CPU_CYCLES)) 252 else if (perf_evsel__match(counter, HARDWARE, HW_CPU_CYCLES))
251 update_stats(&runtime_cycles_stats[0], count[0]); 253 update_stats(&runtime_cycles_stats[0], count[0]);
252 else if (perf_evsel__match(counter, HARDWARE, HW_STALLED_CYCLES)) 254 else if (perf_evsel__match(counter, HARDWARE, HW_STALLED_CYCLES_BACKEND))
253 update_stats(&runtime_stalled_cycles_stats[0], count[0]); 255 update_stats(&runtime_stalled_cycles_stats[0], count[0]);
254 else if (perf_evsel__match(counter, HARDWARE, HW_BRANCH_INSTRUCTIONS)) 256 else if (perf_evsel__match(counter, HARDWARE, HW_BRANCH_INSTRUCTIONS))
255 update_stats(&runtime_branches_stats[0], count[0]); 257 update_stats(&runtime_branches_stats[0], count[0]);
@@ -607,7 +609,7 @@ static void abs_printout(int cpu, struct perf_evsel *evsel, double avg)
607 609
608 fprintf(stderr, " # %8.3f %% of all cache refs ", ratio); 610 fprintf(stderr, " # %8.3f %% of all cache refs ", ratio);
609 611
610 } else if (perf_evsel__match(evsel, HARDWARE, HW_STALLED_CYCLES)) { 612 } else if (perf_evsel__match(evsel, HARDWARE, HW_STALLED_CYCLES_BACKEND)) {
611 print_stalled_cycles(cpu, evsel, avg); 613 print_stalled_cycles(cpu, evsel, avg);
612 } else if (perf_evsel__match(evsel, HARDWARE, HW_CPU_CYCLES)) { 614 } else if (perf_evsel__match(evsel, HARDWARE, HW_CPU_CYCLES)) {
613 total = avg_stats(&runtime_nsecs_stats[cpu]); 615 total = avg_stats(&runtime_nsecs_stats[cpu]);
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index bbbb735268ef..04d2f0a96674 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -31,24 +31,25 @@ char debugfs_path[MAXPATHLEN];
31#define CSW(x) .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_##x 31#define CSW(x) .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_##x
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(STALLED_CYCLES_FRONTEND), "stalled-cycles-frontend", "idle-cycles-frontend" },
36 { CHW(INSTRUCTIONS), "instructions", "" }, 36 { CHW(STALLED_CYCLES_BACKEND), "stalled-cycles-backend", "idle-cycles-backend" },
37 { CHW(CACHE_REFERENCES), "cache-references", "" }, 37 { CHW(INSTRUCTIONS), "instructions", "" },
38 { CHW(CACHE_MISSES), "cache-misses", "" }, 38 { CHW(CACHE_REFERENCES), "cache-references", "" },
39 { CHW(BRANCH_INSTRUCTIONS), "branch-instructions", "branches" }, 39 { CHW(CACHE_MISSES), "cache-misses", "" },
40 { CHW(BRANCH_MISSES), "branch-misses", "" }, 40 { CHW(BRANCH_INSTRUCTIONS), "branch-instructions", "branches" },
41 { CHW(BUS_CYCLES), "bus-cycles", "" }, 41 { CHW(BRANCH_MISSES), "branch-misses", "" },
42 42 { CHW(BUS_CYCLES), "bus-cycles", "" },
43 { CSW(CPU_CLOCK), "cpu-clock", "" }, 43
44 { CSW(TASK_CLOCK), "task-clock", "" }, 44 { CSW(CPU_CLOCK), "cpu-clock", "" },
45 { CSW(PAGE_FAULTS), "page-faults", "faults" }, 45 { CSW(TASK_CLOCK), "task-clock", "" },
46 { CSW(PAGE_FAULTS_MIN), "minor-faults", "" }, 46 { CSW(PAGE_FAULTS), "page-faults", "faults" },
47 { CSW(PAGE_FAULTS_MAJ), "major-faults", "" }, 47 { CSW(PAGE_FAULTS_MIN), "minor-faults", "" },
48 { CSW(CONTEXT_SWITCHES), "context-switches", "cs" }, 48 { CSW(PAGE_FAULTS_MAJ), "major-faults", "" },
49 { CSW(CPU_MIGRATIONS), "cpu-migrations", "migrations" }, 49 { CSW(CONTEXT_SWITCHES), "context-switches", "cs" },
50 { CSW(ALIGNMENT_FAULTS), "alignment-faults", "" }, 50 { CSW(CPU_MIGRATIONS), "cpu-migrations", "migrations" },
51 { CSW(EMULATION_FAULTS), "emulation-faults", "" }, 51 { CSW(ALIGNMENT_FAULTS), "alignment-faults", "" },
52 { CSW(EMULATION_FAULTS), "emulation-faults", "" },
52}; 53};
53 54
54#define __PERF_EVENT_FIELD(config, name) \ 55#define __PERF_EVENT_FIELD(config, name) \
diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c
index 406f613ee619..8b0eff8b8283 100644
--- a/tools/perf/util/python.c
+++ b/tools/perf/util/python.c
@@ -798,7 +798,6 @@ static struct {
798 { "COUNT_HW_BRANCH_INSTRUCTIONS", PERF_COUNT_HW_BRANCH_INSTRUCTIONS }, 798 { "COUNT_HW_BRANCH_INSTRUCTIONS", PERF_COUNT_HW_BRANCH_INSTRUCTIONS },
799 { "COUNT_HW_BRANCH_MISSES", PERF_COUNT_HW_BRANCH_MISSES }, 799 { "COUNT_HW_BRANCH_MISSES", PERF_COUNT_HW_BRANCH_MISSES },
800 { "COUNT_HW_BUS_CYCLES", PERF_COUNT_HW_BUS_CYCLES }, 800 { "COUNT_HW_BUS_CYCLES", PERF_COUNT_HW_BUS_CYCLES },
801 { "COUNT_HW_STALLED_CYCLES", PERF_COUNT_HW_STALLED_CYCLES },
802 { "COUNT_HW_CACHE_L1D", PERF_COUNT_HW_CACHE_L1D }, 801 { "COUNT_HW_CACHE_L1D", PERF_COUNT_HW_CACHE_L1D },
803 { "COUNT_HW_CACHE_L1I", PERF_COUNT_HW_CACHE_L1I }, 802 { "COUNT_HW_CACHE_L1I", PERF_COUNT_HW_CACHE_L1I },
804 { "COUNT_HW_CACHE_LL", PERF_COUNT_HW_CACHE_LL }, 803 { "COUNT_HW_CACHE_LL", PERF_COUNT_HW_CACHE_LL },
@@ -811,6 +810,9 @@ static struct {
811 { "COUNT_HW_CACHE_RESULT_ACCESS", PERF_COUNT_HW_CACHE_RESULT_ACCESS }, 810 { "COUNT_HW_CACHE_RESULT_ACCESS", PERF_COUNT_HW_CACHE_RESULT_ACCESS },
812 { "COUNT_HW_CACHE_RESULT_MISS", PERF_COUNT_HW_CACHE_RESULT_MISS }, 811 { "COUNT_HW_CACHE_RESULT_MISS", PERF_COUNT_HW_CACHE_RESULT_MISS },
813 812
813 { "COUNT_HW_STALLED_CYCLES_FRONTEND", PERF_COUNT_HW_STALLED_CYCLES_FRONTEND },
814 { "COUNT_HW_STALLED_CYCLES_BACKEND", PERF_COUNT_HW_STALLED_CYCLES_BACKEND },
815
814 { "COUNT_SW_CPU_CLOCK", PERF_COUNT_SW_CPU_CLOCK }, 816 { "COUNT_SW_CPU_CLOCK", PERF_COUNT_SW_CPU_CLOCK },
815 { "COUNT_SW_TASK_CLOCK", PERF_COUNT_SW_TASK_CLOCK }, 817 { "COUNT_SW_TASK_CLOCK", PERF_COUNT_SW_TASK_CLOCK },
816 { "COUNT_SW_PAGE_FAULTS", PERF_COUNT_SW_PAGE_FAULTS }, 818 { "COUNT_SW_PAGE_FAULTS", PERF_COUNT_SW_PAGE_FAULTS },