aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Blanchard <anton@samba.org>2009-10-17 21:09:29 -0400
committerPaul Mackerras <paulus@samba.org>2009-10-28 01:13:03 -0400
commitf7d7986060b2890fc26db6ab5203efbd33aa2497 (patch)
tree0ed63257afd3fd02d83ab481af35855603ac4790
parent81cd5ae303e88a1e9d3a3e0f1fe8abd100edde16 (diff)
perf_event: Add alignment-faults and emulation-faults software events
Add two more software events that are common to many cpus. Alignment faults: When a load or store is not aligned properly. Emulation faults: When an instruction is emulated in software. Both cause a very significant slowdown (100x or worse), so identifying and fixing them is very important. Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r--include/linux/perf_counter.h2
-rw-r--r--include/linux/perf_event.h2
-rw-r--r--kernel/perf_event.c2
-rw-r--r--tools/perf/design.txt2
-rw-r--r--tools/perf/util/parse-events.c4
5 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index 7b7fbf433cff..d6b95d1e79f0 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -106,6 +106,8 @@ enum perf_sw_ids {
106 PERF_COUNT_SW_CPU_MIGRATIONS = 4, 106 PERF_COUNT_SW_CPU_MIGRATIONS = 4,
107 PERF_COUNT_SW_PAGE_FAULTS_MIN = 5, 107 PERF_COUNT_SW_PAGE_FAULTS_MIN = 5,
108 PERF_COUNT_SW_PAGE_FAULTS_MAJ = 6, 108 PERF_COUNT_SW_PAGE_FAULTS_MAJ = 6,
109 PERF_COUNT_SW_ALIGNMENT_FAULTS = 7,
110 PERF_COUNT_SW_EMULATION_FAULTS = 8,
109 111
110 PERF_COUNT_SW_MAX, /* non-ABI */ 112 PERF_COUNT_SW_MAX, /* non-ABI */
111}; 113};
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 2e6d95f97419..a33707a3a788 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -102,6 +102,8 @@ enum perf_sw_ids {
102 PERF_COUNT_SW_CPU_MIGRATIONS = 4, 102 PERF_COUNT_SW_CPU_MIGRATIONS = 4,
103 PERF_COUNT_SW_PAGE_FAULTS_MIN = 5, 103 PERF_COUNT_SW_PAGE_FAULTS_MIN = 5,
104 PERF_COUNT_SW_PAGE_FAULTS_MAJ = 6, 104 PERF_COUNT_SW_PAGE_FAULTS_MAJ = 6,
105 PERF_COUNT_SW_ALIGNMENT_FAULTS = 7,
106 PERF_COUNT_SW_EMULATION_FAULTS = 8,
105 107
106 PERF_COUNT_SW_MAX, /* non-ABI */ 108 PERF_COUNT_SW_MAX, /* non-ABI */
107}; 109};
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 9d0b5c665883..0683b33cbb28 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -4186,6 +4186,8 @@ static const struct pmu *sw_perf_event_init(struct perf_event *event)
4186 case PERF_COUNT_SW_PAGE_FAULTS_MAJ: 4186 case PERF_COUNT_SW_PAGE_FAULTS_MAJ:
4187 case PERF_COUNT_SW_CONTEXT_SWITCHES: 4187 case PERF_COUNT_SW_CONTEXT_SWITCHES:
4188 case PERF_COUNT_SW_CPU_MIGRATIONS: 4188 case PERF_COUNT_SW_CPU_MIGRATIONS:
4189 case PERF_COUNT_SW_ALIGNMENT_FAULTS:
4190 case PERF_COUNT_SW_EMULATION_FAULTS:
4189 if (!event->parent) { 4191 if (!event->parent) {
4190 atomic_inc(&perf_swevent_enabled[event_id]); 4192 atomic_inc(&perf_swevent_enabled[event_id]);
4191 event->destroy = sw_perf_event_destroy; 4193 event->destroy = sw_perf_event_destroy;
diff --git a/tools/perf/design.txt b/tools/perf/design.txt
index fdd42a824c98..f000c30877ac 100644
--- a/tools/perf/design.txt
+++ b/tools/perf/design.txt
@@ -137,6 +137,8 @@ enum sw_event_ids {
137 PERF_COUNT_SW_CPU_MIGRATIONS = 4, 137 PERF_COUNT_SW_CPU_MIGRATIONS = 4,
138 PERF_COUNT_SW_PAGE_FAULTS_MIN = 5, 138 PERF_COUNT_SW_PAGE_FAULTS_MIN = 5,
139 PERF_COUNT_SW_PAGE_FAULTS_MAJ = 6, 139 PERF_COUNT_SW_PAGE_FAULTS_MAJ = 6,
140 PERF_COUNT_SW_ALIGNMENT_FAULTS = 7,
141 PERF_COUNT_SW_EMULATION_FAULTS = 8,
140}; 142};
141 143
142Counters of the type PERF_TYPE_TRACEPOINT are available when the ftrace event 144Counters 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 8cfb48cbbea0..34bd84423933 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -46,6 +46,8 @@ static struct event_symbol event_symbols[] = {
46 { CSW(PAGE_FAULTS_MAJ), "major-faults", "" }, 46 { CSW(PAGE_FAULTS_MAJ), "major-faults", "" },
47 { CSW(CONTEXT_SWITCHES), "context-switches", "cs" }, 47 { CSW(CONTEXT_SWITCHES), "context-switches", "cs" },
48 { CSW(CPU_MIGRATIONS), "cpu-migrations", "migrations" }, 48 { CSW(CPU_MIGRATIONS), "cpu-migrations", "migrations" },
49 { CSW(ALIGNMENT_FAULTS), "alignment-faults", "" },
50 { CSW(EMULATION_FAULTS), "emulation-faults", "" },
49}; 51};
50 52
51#define __PERF_EVENT_FIELD(config, name) \ 53#define __PERF_EVENT_FIELD(config, name) \
@@ -74,6 +76,8 @@ static const char *sw_event_names[] = {
74 "CPU-migrations", 76 "CPU-migrations",
75 "minor-faults", 77 "minor-faults",
76 "major-faults", 78 "major-faults",
79 "alignment-faults",
80 "emulation-faults",
77}; 81};
78 82
79#define MAX_ALIASES 8 83#define MAX_ALIASES 8