aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2011-04-24 02:18:31 -0400
committerIngo Molnar <mingo@elte.hu>2011-04-26 14:04:53 -0400
commit94403f8863d0d1d2005291b2ef0719c2534aa303 (patch)
treeb0c8d9cf3ce49bf9faadcf5564e9996d0090b5c8
parent7bd5fafeb414cf00deee32c82834f8bf1426b9ac (diff)
perf events: Add stalled cycles generic event - PERF_COUNT_HW_STALLED_CYCLES
The new PERF_COUNT_HW_STALLED_CYCLES event tries to approximate cycles the CPU does nothing useful, because it is stalled on a cache-miss or some other condition. Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Link: http://lkml.kernel.org/n/tip-fue11vymwqsoo5to72jxxjyl@git.kernel.org Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel.c3
-rw-r--r--include/linux/perf_event.h1
-rw-r--r--tools/perf/util/parse-events.c1
-rw-r--r--tools/perf/util/python.c1
4 files changed, 6 insertions, 0 deletions
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
index 9ae4a2aa7398..efa2704c9dfd 100644
--- a/arch/x86/kernel/cpu/perf_event_intel.c
+++ b/arch/x86/kernel/cpu/perf_event_intel.c
@@ -1413,6 +1413,9 @@ static __init int intel_pmu_init(void)
1413 x86_pmu.enable_all = intel_pmu_nhm_enable_all; 1413 x86_pmu.enable_all = intel_pmu_nhm_enable_all;
1414 x86_pmu.extra_regs = intel_nehalem_extra_regs; 1414 x86_pmu.extra_regs = intel_nehalem_extra_regs;
1415 1415
1416 /* Install the stalled-cycles event: 0xff: All reasons, 0xa2: Resource stalls */
1417 intel_perfmon_event_map[PERF_COUNT_HW_STALLED_CYCLES] = 0xffa2;
1418
1416 if (ebx & 0x40) { 1419 if (ebx & 0x40) {
1417 /* 1420 /*
1418 * Erratum AAJ80 detected, we work it around by using 1421 * Erratum AAJ80 detected, we work it around by using
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index ee9f1e782800..ac636dd20a0c 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -52,6 +52,7 @@ enum perf_hw_id {
52 PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 4, 52 PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 4,
53 PERF_COUNT_HW_BRANCH_MISSES = 5, 53 PERF_COUNT_HW_BRANCH_MISSES = 5,
54 PERF_COUNT_HW_BUS_CYCLES = 6, 54 PERF_COUNT_HW_BUS_CYCLES = 6,
55 PERF_COUNT_HW_STALLED_CYCLES = 7,
55 56
56 PERF_COUNT_HW_MAX, /* non-ABI */ 57 PERF_COUNT_HW_MAX, /* non-ABI */
57}; 58};
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 952b4ae3d954..1869e4c646db 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -38,6 +38,7 @@ static struct event_symbol event_symbols[] = {
38 { CHW(BRANCH_INSTRUCTIONS), "branch-instructions", "branches" }, 38 { CHW(BRANCH_INSTRUCTIONS), "branch-instructions", "branches" },
39 { CHW(BRANCH_MISSES), "branch-misses", "" }, 39 { CHW(BRANCH_MISSES), "branch-misses", "" },
40 { CHW(BUS_CYCLES), "bus-cycles", "" }, 40 { CHW(BUS_CYCLES), "bus-cycles", "" },
41 { CHW(STALLED_CYCLES), "stalled-cycles", "" },
41 42
42 { CSW(CPU_CLOCK), "cpu-clock", "" }, 43 { CSW(CPU_CLOCK), "cpu-clock", "" },
43 { CSW(TASK_CLOCK), "task-clock", "" }, 44 { CSW(TASK_CLOCK), "task-clock", "" },
diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c
index f5e38451fdc5..406f613ee619 100644
--- a/tools/perf/util/python.c
+++ b/tools/perf/util/python.c
@@ -798,6 +798,7 @@ 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 },
801 { "COUNT_HW_CACHE_L1D", PERF_COUNT_HW_CACHE_L1D }, 802 { "COUNT_HW_CACHE_L1D", PERF_COUNT_HW_CACHE_L1D },
802 { "COUNT_HW_CACHE_L1I", PERF_COUNT_HW_CACHE_L1I }, 803 { "COUNT_HW_CACHE_L1I", PERF_COUNT_HW_CACHE_L1I },
803 { "COUNT_HW_CACHE_LL", PERF_COUNT_HW_CACHE_LL }, 804 { "COUNT_HW_CACHE_LL", PERF_COUNT_HW_CACHE_LL },