summaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2009-06-11 14:06:28 +0200
committerIngo Molnar <mingo@elte.hu>2009-06-11 17:54:15 +0200
commitf4dbfa8f3131a84257223393905f7efad0ca5996 (patch)
tree67bb2666868c4449c2fa9ba6dc931721f60deb6c /tools/perf
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/perf')
-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 84cd336ae79..29259e74dcf 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -378,12 +378,12 @@ try_again:
* is always available even if no PMU support:
*/
if (attr->type == PERF_TYPE_HARDWARE
- && attr->config == PERF_COUNT_CPU_CYCLES) {
+ && attr->config == PERF_COUNT_HW_CPU_CYCLES) {
if (verbose)
warning(" ... trying to fall back to cpu-clock-ticks\n");
attr->type = PERF_TYPE_SOFTWARE;
- attr->config = PERF_COUNT_CPU_CLOCK;
+ attr->config = PERF_COUNT_SW_CPU_CLOCK;
goto try_again;
}
printf("\n");
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 6404906924f..c43e4a97dc4 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -46,15 +46,16 @@
static struct perf_counter_attr default_attrs[MAX_COUNTERS] = {
- { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_TASK_CLOCK },
- { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_CONTEXT_SWITCHES },
- { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_CPU_MIGRATIONS },
- { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_PAGE_FAULTS },
-
- { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_CPU_CYCLES },
- { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_INSTRUCTIONS },
- { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_CACHE_REFERENCES },
- { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_CACHE_MISSES },
+ { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_TASK_CLOCK },
+ { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_CONTEXT_SWITCHES},
+ { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_CPU_MIGRATIONS },
+ { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_PAGE_FAULTS },
+
+ { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_CPU_CYCLES },
+ { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_INSTRUCTIONS },
+ { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_CACHE_REFERENCES},
+ { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_CACHE_MISSES },
+
};
static int system_wide = 0;
@@ -120,10 +121,10 @@ static inline int nsec_counter(int counter)
if (attrs[counter].type != PERF_TYPE_SOFTWARE)
return 0;
- if (attrs[counter].config == PERF_COUNT_CPU_CLOCK)
+ if (attrs[counter].config == PERF_COUNT_SW_CPU_CLOCK)
return 1;
- if (attrs[counter].config == PERF_COUNT_TASK_CLOCK)
+ if (attrs[counter].config == PERF_COUNT_SW_TASK_CLOCK)
return 1;
return 0;
@@ -176,10 +177,10 @@ static void read_counter(int counter)
* Save the full runtime - to allow normalization during printout:
*/
if (attrs[counter].type == PERF_TYPE_SOFTWARE &&
- attrs[counter].config == PERF_COUNT_TASK_CLOCK)
+ attrs[counter].config == PERF_COUNT_SW_TASK_CLOCK)
runtime_nsecs = count[0];
if (attrs[counter].type == PERF_TYPE_HARDWARE &&
- attrs[counter].config == PERF_COUNT_CPU_CYCLES)
+ attrs[counter].config == PERF_COUNT_HW_CPU_CYCLES)
runtime_cycles = count[0];
}
@@ -206,7 +207,7 @@ static void print_counter(int counter)
fprintf(stderr, " %14.6f %-20s",
msecs, event_name(counter));
if (attrs[counter].type == PERF_TYPE_SOFTWARE &&
- attrs[counter].config == PERF_COUNT_TASK_CLOCK) {
+ attrs[counter].config == PERF_COUNT_SW_TASK_CLOCK) {
if (walltime_nsecs)
fprintf(stderr, " # %11.3f CPU utilization factor",
@@ -220,7 +221,7 @@ static void print_counter(int counter)
(double)count[0]/runtime_nsecs*1000.0);
if (runtime_cycles &&
attrs[counter].type == PERF_TYPE_HARDWARE &&
- attrs[counter].config == PERF_COUNT_INSTRUCTIONS) {
+ attrs[counter].config == PERF_COUNT_HW_INSTRUCTIONS) {
fprintf(stderr, " # %1.3f per cycle",
(double)count[0] / (double)runtime_cycles);
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 309dbc76ec8..fe338d3c5d7 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -562,13 +562,13 @@ try_again:
* is always available even if no PMU support:
*/
if (attr->type == PERF_TYPE_HARDWARE
- && attr->config == PERF_COUNT_CPU_CYCLES) {
+ && attr->config == PERF_COUNT_HW_CPU_CYCLES) {
if (verbose)
warning(" ... trying to fall back to cpu-clock-ticks\n");
attr->type = PERF_TYPE_SOFTWARE;
- attr->config = PERF_COUNT_CPU_CLOCK;
+ attr->config = PERF_COUNT_SW_CPU_CLOCK;
goto try_again;
}
printf("\n");
diff --git a/tools/perf/design.txt b/tools/perf/design.txt
index d3250763dc9..860e116d979 100644
--- a/tools/perf/design.txt
+++ b/tools/perf/design.txt
@@ -99,13 +99,13 @@ enum hw_event_ids {
/*
* Common hardware events, generalized by the kernel:
*/
- PERF_COUNT_CPU_CYCLES = 0,
- PERF_COUNT_INSTRUCTIONS = 1,
- PERF_COUNT_CACHE_REFERENCES = 2,
- PERF_COUNT_CACHE_MISSES = 3,
- PERF_COUNT_BRANCH_INSTRUCTIONS = 4,
- PERF_COUNT_BRANCH_MISSES = 5,
- PERF_COUNT_BUS_CYCLES = 6,
+ PERF_COUNT_HW_CPU_CYCLES = 0,
+ PERF_COUNT_HW_INSTRUCTIONS = 1,
+ PERF_COUNT_HW_CACHE_REFERENCES = 2,
+ PERF_COUNT_HW_CACHE_MISSES = 3,
+ PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 4,
+ PERF_COUNT_HW_BRANCH_MISSES = 5,
+ PERF_COUNT_HW_BUS_CYCLES = 6,
};
These are standardized types of events that work relatively uniformly
@@ -130,13 +130,13 @@ software events, selected by 'event_id':
* well):
*/
enum sw_event_ids {
- PERF_COUNT_CPU_CLOCK = 0,
- PERF_COUNT_TASK_CLOCK = 1,
- PERF_COUNT_PAGE_FAULTS = 2,
- PERF_COUNT_CONTEXT_SWITCHES = 3,
- PERF_COUNT_CPU_MIGRATIONS = 4,
- PERF_COUNT_PAGE_FAULTS_MIN = 5,
- PERF_COUNT_PAGE_FAULTS_MAJ = 6,
+ PERF_COUNT_SW_CPU_CLOCK = 0,
+ PERF_COUNT_SW_TASK_CLOCK = 1,
+ PERF_COUNT_SW_PAGE_FAULTS = 2,
+ PERF_COUNT_SW_CONTEXT_SWITCHES = 3,
+ PERF_COUNT_SW_CPU_MIGRATIONS = 4,
+ PERF_COUNT_SW_PAGE_FAULTS_MIN = 5,
+ PERF_COUNT_SW_PAGE_FAULTS_MAJ = 6,
};
Counters 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 f18a9a006e1..9d5f1ca50e6 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -22,26 +22,26 @@ struct event_symbol {
#define CR(x, y) .type = PERF_TYPE_##x, .config = y
static struct event_symbol event_symbols[] = {
- { C(HARDWARE, CPU_CYCLES), "cpu-cycles", },
- { C(HARDWARE, CPU_CYCLES), "cycles", },
- { C(HARDWARE, INSTRUCTIONS), "instructions", },
- { C(HARDWARE, CACHE_REFERENCES), "cache-references", },
- { C(HARDWARE, CACHE_MISSES), "cache-misses", },
- { C(HARDWARE, BRANCH_INSTRUCTIONS), "branch-instructions", },
- { C(HARDWARE, BRANCH_INSTRUCTIONS), "branches", },
- { C(HARDWARE, BRANCH_MISSES), "branch-misses", },
- { C(HARDWARE, BUS_CYCLES), "bus-cycles", },
-
- { C(SOFTWARE, CPU_CLOCK), "cpu-clock", },
- { C(SOFTWARE, TASK_CLOCK), "task-clock", },
- { C(SOFTWARE, PAGE_FAULTS), "page-faults", },
- { C(SOFTWARE, PAGE_FAULTS), "faults", },
- { C(SOFTWARE, PAGE_FAULTS_MIN), "minor-faults", },
- { C(SOFTWARE, PAGE_FAULTS_MAJ), "major-faults", },
- { C(SOFTWARE, CONTEXT_SWITCHES), "context-switches", },
- { C(SOFTWARE, CONTEXT_SWITCHES), "cs", },
- { C(SOFTWARE, CPU_MIGRATIONS), "cpu-migrations", },
- { C(SOFTWARE, CPU_MIGRATIONS), "migrations", },
+ { C(HARDWARE, HW_CPU_CYCLES), "cpu-cycles", },
+ { C(HARDWARE, HW_CPU_CYCLES), "cycles", },
+ { C(HARDWARE, HW_INSTRUCTIONS), "instructions", },
+ { C(HARDWARE, HW_CACHE_REFERENCES), "cache-references", },
+ { C(HARDWARE, HW_CACHE_MISSES), "cache-misses", },
+ { C(HARDWARE, HW_BRANCH_INSTRUCTIONS),"branch-instructions", },
+ { C(HARDWARE, HW_BRANCH_INSTRUCTIONS),"branches", },
+ { C(HARDWARE, HW_BRANCH_MISSES), "branch-misses", },
+ { C(HARDWARE, HW_BUS_CYCLES), "bus-cycles", },
+
+ { C(SOFTWARE, SW_CPU_CLOCK), "cpu-clock", },
+ { C(SOFTWARE, SW_TASK_CLOCK), "task-clock", },
+ { C(SOFTWARE, SW_PAGE_FAULTS), "page-faults", },
+ { C(SOFTWARE, SW_PAGE_FAULTS), "faults", },
+ { C(SOFTWARE, SW_PAGE_FAULTS_MIN), "minor-faults", },
+ { C(SOFTWARE, SW_PAGE_FAULTS_MAJ), "major-faults", },
+ { C(SOFTWARE, SW_CONTEXT_SWITCHES), "context-switches", },
+ { C(SOFTWARE, SW_CONTEXT_SWITCHES), "cs", },
+ { C(SOFTWARE, SW_CPU_MIGRATIONS), "cpu-migrations", },
+ { C(SOFTWARE, SW_CPU_MIGRATIONS), "migrations", },
};
#define __PERF_COUNTER_FIELD(config, name) \
@@ -107,7 +107,7 @@ char *event_name(int counter)
switch (type) {
case PERF_TYPE_HARDWARE:
- if (config < PERF_HW_EVENTS_MAX)
+ if (config < PERF_COUNT_HW_MAX)
return hw_event_names[config];
return "unknown-hardware";
@@ -136,7 +136,7 @@ char *event_name(int counter)
}
case PERF_TYPE_SOFTWARE:
- if (config < PERF_SW_EVENTS_MAX)
+ if (config < PERF_COUNT_SW_MAX)
return sw_event_names[config];
return "unknown-software";