aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2009-06-11 08:06:28 -0400
committerIngo Molnar <mingo@elte.hu>2009-06-11 11:54:15 -0400
commitf4dbfa8f3131a84257223393905f7efad0ca5996 (patch)
tree67bb2666868c4449c2fa9ba6dc931721f60deb6c /tools
parent1c432d899d32d36371ee4ee310fa3609cf0e5742 (diff)
perf_counter: Standardize event names
Pure renames only, to PERF_COUNT_HW_* and PERF_COUNT_SW_*. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> 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.c4
-rw-r--r--tools/perf/builtin-stat.c31
-rw-r--r--tools/perf/builtin-top.c4
-rw-r--r--tools/perf/design.txt28
-rw-r--r--tools/perf/util/parse-events.c44
5 files changed, 56 insertions, 55 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 84cd336ae79b..29259e74dcfa 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -378,12 +378,12 @@ try_again:
378 * is always available even if no PMU support: 378 * is always available even if no PMU support:
379 */ 379 */
380 if (attr->type == PERF_TYPE_HARDWARE 380 if (attr->type == PERF_TYPE_HARDWARE
381 && attr->config == PERF_COUNT_CPU_CYCLES) { 381 && attr->config == PERF_COUNT_HW_CPU_CYCLES) {
382 382
383 if (verbose) 383 if (verbose)
384 warning(" ... trying to fall back to cpu-clock-ticks\n"); 384 warning(" ... trying to fall back to cpu-clock-ticks\n");
385 attr->type = PERF_TYPE_SOFTWARE; 385 attr->type = PERF_TYPE_SOFTWARE;
386 attr->config = PERF_COUNT_CPU_CLOCK; 386 attr->config = PERF_COUNT_SW_CPU_CLOCK;
387 goto try_again; 387 goto try_again;
388 } 388 }
389 printf("\n"); 389 printf("\n");
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 6404906924fa..c43e4a97dc42 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -46,15 +46,16 @@
46 46
47static struct perf_counter_attr default_attrs[MAX_COUNTERS] = { 47static struct perf_counter_attr default_attrs[MAX_COUNTERS] = {
48 48
49 { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_TASK_CLOCK }, 49 { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_TASK_CLOCK },
50 { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_CONTEXT_SWITCHES }, 50 { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_CONTEXT_SWITCHES},
51 { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_CPU_MIGRATIONS }, 51 { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_CPU_MIGRATIONS },
52 { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_PAGE_FAULTS }, 52 { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_PAGE_FAULTS },
53 53
54 { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_CPU_CYCLES }, 54 { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_CPU_CYCLES },
55 { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_INSTRUCTIONS }, 55 { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_INSTRUCTIONS },
56 { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_CACHE_REFERENCES }, 56 { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_CACHE_REFERENCES},
57 { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_CACHE_MISSES }, 57 { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_CACHE_MISSES },
58
58}; 59};
59 60
60static int system_wide = 0; 61static int system_wide = 0;
@@ -120,10 +121,10 @@ static inline int nsec_counter(int counter)
120 if (attrs[counter].type != PERF_TYPE_SOFTWARE) 121 if (attrs[counter].type != PERF_TYPE_SOFTWARE)
121 return 0; 122 return 0;
122 123
123 if (attrs[counter].config == PERF_COUNT_CPU_CLOCK) 124 if (attrs[counter].config == PERF_COUNT_SW_CPU_CLOCK)
124 return 1; 125 return 1;
125 126
126 if (attrs[counter].config == PERF_COUNT_TASK_CLOCK) 127 if (attrs[counter].config == PERF_COUNT_SW_TASK_CLOCK)
127 return 1; 128 return 1;
128 129
129 return 0; 130 return 0;
@@ -176,10 +177,10 @@ static void read_counter(int counter)
176 * Save the full runtime - to allow normalization during printout: 177 * Save the full runtime - to allow normalization during printout:
177 */ 178 */
178 if (attrs[counter].type == PERF_TYPE_SOFTWARE && 179 if (attrs[counter].type == PERF_TYPE_SOFTWARE &&
179 attrs[counter].config == PERF_COUNT_TASK_CLOCK) 180 attrs[counter].config == PERF_COUNT_SW_TASK_CLOCK)
180 runtime_nsecs = count[0]; 181 runtime_nsecs = count[0];
181 if (attrs[counter].type == PERF_TYPE_HARDWARE && 182 if (attrs[counter].type == PERF_TYPE_HARDWARE &&
182 attrs[counter].config == PERF_COUNT_CPU_CYCLES) 183 attrs[counter].config == PERF_COUNT_HW_CPU_CYCLES)
183 runtime_cycles = count[0]; 184 runtime_cycles = count[0];
184} 185}
185 186
@@ -206,7 +207,7 @@ static void print_counter(int counter)
206 fprintf(stderr, " %14.6f %-20s", 207 fprintf(stderr, " %14.6f %-20s",
207 msecs, event_name(counter)); 208 msecs, event_name(counter));
208 if (attrs[counter].type == PERF_TYPE_SOFTWARE && 209 if (attrs[counter].type == PERF_TYPE_SOFTWARE &&
209 attrs[counter].config == PERF_COUNT_TASK_CLOCK) { 210 attrs[counter].config == PERF_COUNT_SW_TASK_CLOCK) {
210 211
211 if (walltime_nsecs) 212 if (walltime_nsecs)
212 fprintf(stderr, " # %11.3f CPU utilization factor", 213 fprintf(stderr, " # %11.3f CPU utilization factor",
@@ -220,7 +221,7 @@ static void print_counter(int counter)
220 (double)count[0]/runtime_nsecs*1000.0); 221 (double)count[0]/runtime_nsecs*1000.0);
221 if (runtime_cycles && 222 if (runtime_cycles &&
222 attrs[counter].type == PERF_TYPE_HARDWARE && 223 attrs[counter].type == PERF_TYPE_HARDWARE &&
223 attrs[counter].config == PERF_COUNT_INSTRUCTIONS) { 224 attrs[counter].config == PERF_COUNT_HW_INSTRUCTIONS) {
224 225
225 fprintf(stderr, " # %1.3f per cycle", 226 fprintf(stderr, " # %1.3f per cycle",
226 (double)count[0] / (double)runtime_cycles); 227 (double)count[0] / (double)runtime_cycles);
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 309dbc76ec88..fe338d3c5d7e 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -562,13 +562,13 @@ try_again:
562 * is always available even if no PMU support: 562 * is always available even if no PMU support:
563 */ 563 */
564 if (attr->type == PERF_TYPE_HARDWARE 564 if (attr->type == PERF_TYPE_HARDWARE
565 && attr->config == PERF_COUNT_CPU_CYCLES) { 565 && attr->config == PERF_COUNT_HW_CPU_CYCLES) {
566 566
567 if (verbose) 567 if (verbose)
568 warning(" ... trying to fall back to cpu-clock-ticks\n"); 568 warning(" ... trying to fall back to cpu-clock-ticks\n");
569 569
570 attr->type = PERF_TYPE_SOFTWARE; 570 attr->type = PERF_TYPE_SOFTWARE;
571 attr->config = PERF_COUNT_CPU_CLOCK; 571 attr->config = PERF_COUNT_SW_CPU_CLOCK;
572 goto try_again; 572 goto try_again;
573 } 573 }
574 printf("\n"); 574 printf("\n");
diff --git a/tools/perf/design.txt b/tools/perf/design.txt
index d3250763dc92..860e116d979c 100644
--- a/tools/perf/design.txt
+++ b/tools/perf/design.txt
@@ -99,13 +99,13 @@ enum hw_event_ids {
99 /* 99 /*
100 * Common hardware events, generalized by the kernel: 100 * Common hardware events, generalized by the kernel:
101 */ 101 */
102 PERF_COUNT_CPU_CYCLES = 0, 102 PERF_COUNT_HW_CPU_CYCLES = 0,
103 PERF_COUNT_INSTRUCTIONS = 1, 103 PERF_COUNT_HW_INSTRUCTIONS = 1,
104 PERF_COUNT_CACHE_REFERENCES = 2, 104 PERF_COUNT_HW_CACHE_REFERENCES = 2,
105 PERF_COUNT_CACHE_MISSES = 3, 105 PERF_COUNT_HW_CACHE_MISSES = 3,
106 PERF_COUNT_BRANCH_INSTRUCTIONS = 4, 106 PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 4,
107 PERF_COUNT_BRANCH_MISSES = 5, 107 PERF_COUNT_HW_BRANCH_MISSES = 5,
108 PERF_COUNT_BUS_CYCLES = 6, 108 PERF_COUNT_HW_BUS_CYCLES = 6,
109}; 109};
110 110
111These are standardized types of events that work relatively uniformly 111These are standardized types of events that work relatively uniformly
@@ -130,13 +130,13 @@ software events, selected by 'event_id':
130 * well): 130 * well):
131 */ 131 */
132enum sw_event_ids { 132enum sw_event_ids {
133 PERF_COUNT_CPU_CLOCK = 0, 133 PERF_COUNT_SW_CPU_CLOCK = 0,
134 PERF_COUNT_TASK_CLOCK = 1, 134 PERF_COUNT_SW_TASK_CLOCK = 1,
135 PERF_COUNT_PAGE_FAULTS = 2, 135 PERF_COUNT_SW_PAGE_FAULTS = 2,
136 PERF_COUNT_CONTEXT_SWITCHES = 3, 136 PERF_COUNT_SW_CONTEXT_SWITCHES = 3,
137 PERF_COUNT_CPU_MIGRATIONS = 4, 137 PERF_COUNT_SW_CPU_MIGRATIONS = 4,
138 PERF_COUNT_PAGE_FAULTS_MIN = 5, 138 PERF_COUNT_SW_PAGE_FAULTS_MIN = 5,
139 PERF_COUNT_PAGE_FAULTS_MAJ = 6, 139 PERF_COUNT_SW_PAGE_FAULTS_MAJ = 6,
140}; 140};
141 141
142Counters of the type PERF_TYPE_TRACEPOINT are available when the ftrace event 142Counters of the type PERF_TYPE_TRACEPOINT are available when the ftrace event
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index f18a9a006e1b..9d5f1ca50e6f 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -22,26 +22,26 @@ struct event_symbol {
22#define CR(x, y) .type = PERF_TYPE_##x, .config = y 22#define CR(x, y) .type = PERF_TYPE_##x, .config = y
23 23
24static struct event_symbol event_symbols[] = { 24static struct event_symbol event_symbols[] = {
25 { C(HARDWARE, CPU_CYCLES), "cpu-cycles", }, 25 { C(HARDWARE, HW_CPU_CYCLES), "cpu-cycles", },
26 { C(HARDWARE, CPU_CYCLES), "cycles", }, 26 { C(HARDWARE, HW_CPU_CYCLES), "cycles", },
27 { C(HARDWARE, INSTRUCTIONS), "instructions", }, 27 { C(HARDWARE, HW_INSTRUCTIONS), "instructions", },
28 { C(HARDWARE, CACHE_REFERENCES), "cache-references", }, 28 { C(HARDWARE, HW_CACHE_REFERENCES), "cache-references", },
29 { C(HARDWARE, CACHE_MISSES), "cache-misses", }, 29 { C(HARDWARE, HW_CACHE_MISSES), "cache-misses", },
30 { C(HARDWARE, BRANCH_INSTRUCTIONS), "branch-instructions", }, 30 { C(HARDWARE, HW_BRANCH_INSTRUCTIONS),"branch-instructions", },
31 { C(HARDWARE, BRANCH_INSTRUCTIONS), "branches", }, 31 { C(HARDWARE, HW_BRANCH_INSTRUCTIONS),"branches", },
32 { C(HARDWARE, BRANCH_MISSES), "branch-misses", }, 32 { C(HARDWARE, HW_BRANCH_MISSES), "branch-misses", },
33 { C(HARDWARE, BUS_CYCLES), "bus-cycles", }, 33 { C(HARDWARE, HW_BUS_CYCLES), "bus-cycles", },
34 34
35 { C(SOFTWARE, CPU_CLOCK), "cpu-clock", }, 35 { C(SOFTWARE, SW_CPU_CLOCK), "cpu-clock", },
36 { C(SOFTWARE, TASK_CLOCK), "task-clock", }, 36 { C(SOFTWARE, SW_TASK_CLOCK), "task-clock", },
37 { C(SOFTWARE, PAGE_FAULTS), "page-faults", }, 37 { C(SOFTWARE, SW_PAGE_FAULTS), "page-faults", },
38 { C(SOFTWARE, PAGE_FAULTS), "faults", }, 38 { C(SOFTWARE, SW_PAGE_FAULTS), "faults", },
39 { C(SOFTWARE, PAGE_FAULTS_MIN), "minor-faults", }, 39 { C(SOFTWARE, SW_PAGE_FAULTS_MIN), "minor-faults", },
40 { C(SOFTWARE, PAGE_FAULTS_MAJ), "major-faults", }, 40 { C(SOFTWARE, SW_PAGE_FAULTS_MAJ), "major-faults", },
41 { C(SOFTWARE, CONTEXT_SWITCHES), "context-switches", }, 41 { C(SOFTWARE, SW_CONTEXT_SWITCHES), "context-switches", },
42 { C(SOFTWARE, CONTEXT_SWITCHES), "cs", }, 42 { C(SOFTWARE, SW_CONTEXT_SWITCHES), "cs", },
43 { C(SOFTWARE, CPU_MIGRATIONS), "cpu-migrations", }, 43 { C(SOFTWARE, SW_CPU_MIGRATIONS), "cpu-migrations", },
44 { C(SOFTWARE, CPU_MIGRATIONS), "migrations", }, 44 { C(SOFTWARE, SW_CPU_MIGRATIONS), "migrations", },
45}; 45};
46 46
47#define __PERF_COUNTER_FIELD(config, name) \ 47#define __PERF_COUNTER_FIELD(config, name) \
@@ -107,7 +107,7 @@ char *event_name(int counter)
107 107
108 switch (type) { 108 switch (type) {
109 case PERF_TYPE_HARDWARE: 109 case PERF_TYPE_HARDWARE:
110 if (config < PERF_HW_EVENTS_MAX) 110 if (config < PERF_COUNT_HW_MAX)
111 return hw_event_names[config]; 111 return hw_event_names[config];
112 return "unknown-hardware"; 112 return "unknown-hardware";
113 113
@@ -136,7 +136,7 @@ char *event_name(int counter)
136 } 136 }
137 137
138 case PERF_TYPE_SOFTWARE: 138 case PERF_TYPE_SOFTWARE:
139 if (config < PERF_SW_EVENTS_MAX) 139 if (config < PERF_COUNT_SW_MAX)
140 return sw_event_names[config]; 140 return sw_event_names[config];
141 return "unknown-software"; 141 return "unknown-software";
142 142