]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
perf_event: Add alignment-faults and emulation-faults software events
authorAnton Blanchard <anton@samba.org>
Sun, 18 Oct 2009 01:09:29 +0000 (01:09 +0000)
committerPaul Mackerras <paulus@samba.org>
Wed, 28 Oct 2009 05:13:03 +0000 (16:13 +1100)
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>
include/linux/perf_counter.h
include/linux/perf_event.h
kernel/perf_event.c
tools/perf/design.txt
tools/perf/util/parse-events.c

index 7b7fbf433cffb6377605eea61682c48905c7b33e..d6b95d1e79f03fc895bd06e40ea65e32dae20730 100644 (file)
@@ -106,6 +106,8 @@ enum perf_sw_ids {
        PERF_COUNT_SW_CPU_MIGRATIONS            = 4,
        PERF_COUNT_SW_PAGE_FAULTS_MIN           = 5,
        PERF_COUNT_SW_PAGE_FAULTS_MAJ           = 6,
+       PERF_COUNT_SW_ALIGNMENT_FAULTS          = 7,
+       PERF_COUNT_SW_EMULATION_FAULTS          = 8,
 
        PERF_COUNT_SW_MAX,                      /* non-ABI */
 };
index 2e6d95f97419e489632a7f65ba4d4890851bbaeb..a33707a3a78882135b0b1c5d82faa18fa1f79a3b 100644 (file)
@@ -102,6 +102,8 @@ enum perf_sw_ids {
        PERF_COUNT_SW_CPU_MIGRATIONS            = 4,
        PERF_COUNT_SW_PAGE_FAULTS_MIN           = 5,
        PERF_COUNT_SW_PAGE_FAULTS_MAJ           = 6,
+       PERF_COUNT_SW_ALIGNMENT_FAULTS          = 7,
+       PERF_COUNT_SW_EMULATION_FAULTS          = 8,
 
        PERF_COUNT_SW_MAX,                      /* non-ABI */
 };
index 9d0b5c6658837606108308841a4ce092a29701a1..0683b33cbb28054326564960de687020acb88131 100644 (file)
@@ -4186,6 +4186,8 @@ static const struct pmu *sw_perf_event_init(struct perf_event *event)
        case PERF_COUNT_SW_PAGE_FAULTS_MAJ:
        case PERF_COUNT_SW_CONTEXT_SWITCHES:
        case PERF_COUNT_SW_CPU_MIGRATIONS:
+       case PERF_COUNT_SW_ALIGNMENT_FAULTS:
+       case PERF_COUNT_SW_EMULATION_FAULTS:
                if (!event->parent) {
                        atomic_inc(&perf_swevent_enabled[event_id]);
                        event->destroy = sw_perf_event_destroy;
index fdd42a824c9870be6c1cfce297dc552093fa45f6..f000c30877acf3eb153c8a499b61d51660fde917 100644 (file)
@@ -137,6 +137,8 @@ enum sw_event_ids {
        PERF_COUNT_SW_CPU_MIGRATIONS    = 4,
        PERF_COUNT_SW_PAGE_FAULTS_MIN   = 5,
        PERF_COUNT_SW_PAGE_FAULTS_MAJ   = 6,
+       PERF_COUNT_SW_ALIGNMENT_FAULTS  = 7,
+       PERF_COUNT_SW_EMULATION_FAULTS  = 8,
 };
 
 Counters of the type PERF_TYPE_TRACEPOINT are available when the ftrace event
index 8cfb48cbbea01d8fbd5ba6aee541d07c360b7d3d..34bd844239337fbf8bdef4e41969d960ee1a0503 100644 (file)
@@ -46,6 +46,8 @@ static struct event_symbol event_symbols[] = {
   { CSW(PAGE_FAULTS_MAJ),      "major-faults",         ""              },
   { CSW(CONTEXT_SWITCHES),     "context-switches",     "cs"            },
   { CSW(CPU_MIGRATIONS),       "cpu-migrations",       "migrations"    },
+  { CSW(ALIGNMENT_FAULTS),     "alignment-faults",     ""              },
+  { CSW(EMULATION_FAULTS),     "emulation-faults",     ""              },
 };
 
 #define __PERF_EVENT_FIELD(config, name) \
@@ -74,6 +76,8 @@ static const char *sw_event_names[] = {
        "CPU-migrations",
        "minor-faults",
        "major-faults",
+       "alignment-faults",
+       "emulation-faults",
 };
 
 #define MAX_ALIASES 8