diff options
| -rw-r--r-- | arch/x86/kernel/cpu/perf_event_amd.c | 14 | ||||
| -rw-r--r-- | arch/x86/kernel/cpu/perf_event_intel.c | 31 | ||||
| -rw-r--r-- | include/linux/perf_event.h | 2 | ||||
| -rw-r--r-- | tools/perf/builtin-stat.c | 284 | ||||
| -rw-r--r-- | tools/perf/util/parse-events.c | 120 | ||||
| -rw-r--r-- | tools/perf/util/python.c | 3 |
6 files changed, 352 insertions, 102 deletions
diff --git a/arch/x86/kernel/cpu/perf_event_amd.c b/arch/x86/kernel/cpu/perf_event_amd.c index cf4e369cea67..fe29c1d2219e 100644 --- a/arch/x86/kernel/cpu/perf_event_amd.c +++ b/arch/x86/kernel/cpu/perf_event_amd.c | |||
| @@ -96,12 +96,14 @@ static __initconst const u64 amd_hw_cache_event_ids | |||
| 96 | */ | 96 | */ |
| 97 | static const u64 amd_perfmon_event_map[] = | 97 | static const u64 amd_perfmon_event_map[] = |
| 98 | { | 98 | { |
| 99 | [PERF_COUNT_HW_CPU_CYCLES] = 0x0076, | 99 | [PERF_COUNT_HW_CPU_CYCLES] = 0x0076, |
| 100 | [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0, | 100 | [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0, |
| 101 | [PERF_COUNT_HW_CACHE_REFERENCES] = 0x0080, | 101 | [PERF_COUNT_HW_CACHE_REFERENCES] = 0x0080, |
| 102 | [PERF_COUNT_HW_CACHE_MISSES] = 0x0081, | 102 | [PERF_COUNT_HW_CACHE_MISSES] = 0x0081, |
| 103 | [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x00c2, | 103 | [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x00c2, |
| 104 | [PERF_COUNT_HW_BRANCH_MISSES] = 0x00c3, | 104 | [PERF_COUNT_HW_BRANCH_MISSES] = 0x00c3, |
| 105 | [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = 0x00d0, /* "Decoder empty" event */ | ||
| 106 | [PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = 0x00d1, /* "Dispatch stalls" event */ | ||
| 105 | }; | 107 | }; |
| 106 | 108 | ||
| 107 | static u64 amd_pmu_event_map(int hw_event) | 109 | static u64 amd_pmu_event_map(int hw_event) |
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c index 7cf2ec59c813..61cbf4831d71 100644 --- a/arch/x86/kernel/cpu/perf_event_intel.c +++ b/arch/x86/kernel/cpu/perf_event_intel.c | |||
| @@ -36,7 +36,7 @@ static u64 intel_perfmon_event_map[PERF_COUNT_HW_MAX] __read_mostly = | |||
| 36 | [PERF_COUNT_HW_BUS_CYCLES] = 0x013c, | 36 | [PERF_COUNT_HW_BUS_CYCLES] = 0x013c, |
| 37 | }; | 37 | }; |
| 38 | 38 | ||
| 39 | static struct event_constraint intel_core_event_constraints[] = | 39 | static struct event_constraint intel_core_event_constraints[] __read_mostly = |
| 40 | { | 40 | { |
| 41 | INTEL_EVENT_CONSTRAINT(0x11, 0x2), /* FP_ASSIST */ | 41 | INTEL_EVENT_CONSTRAINT(0x11, 0x2), /* FP_ASSIST */ |
| 42 | INTEL_EVENT_CONSTRAINT(0x12, 0x2), /* MUL */ | 42 | INTEL_EVENT_CONSTRAINT(0x12, 0x2), /* MUL */ |
| @@ -47,7 +47,7 @@ static struct event_constraint intel_core_event_constraints[] = | |||
| 47 | EVENT_CONSTRAINT_END | 47 | EVENT_CONSTRAINT_END |
| 48 | }; | 48 | }; |
| 49 | 49 | ||
| 50 | static struct event_constraint intel_core2_event_constraints[] = | 50 | static struct event_constraint intel_core2_event_constraints[] __read_mostly = |
| 51 | { | 51 | { |
| 52 | FIXED_EVENT_CONSTRAINT(0x00c0, 0), /* INST_RETIRED.ANY */ | 52 | FIXED_EVENT_CONSTRAINT(0x00c0, 0), /* INST_RETIRED.ANY */ |
| 53 | FIXED_EVENT_CONSTRAINT(0x003c, 1), /* CPU_CLK_UNHALTED.CORE */ | 53 | FIXED_EVENT_CONSTRAINT(0x003c, 1), /* CPU_CLK_UNHALTED.CORE */ |
| @@ -70,7 +70,7 @@ static struct event_constraint intel_core2_event_constraints[] = | |||
| 70 | EVENT_CONSTRAINT_END | 70 | EVENT_CONSTRAINT_END |
| 71 | }; | 71 | }; |
| 72 | 72 | ||
| 73 | static struct event_constraint intel_nehalem_event_constraints[] = | 73 | static struct event_constraint intel_nehalem_event_constraints[] __read_mostly = |
| 74 | { | 74 | { |
| 75 | FIXED_EVENT_CONSTRAINT(0x00c0, 0), /* INST_RETIRED.ANY */ | 75 | FIXED_EVENT_CONSTRAINT(0x00c0, 0), /* INST_RETIRED.ANY */ |
| 76 | FIXED_EVENT_CONSTRAINT(0x003c, 1), /* CPU_CLK_UNHALTED.CORE */ | 76 | FIXED_EVENT_CONSTRAINT(0x003c, 1), /* CPU_CLK_UNHALTED.CORE */ |
| @@ -86,19 +86,19 @@ static struct event_constraint intel_nehalem_event_constraints[] = | |||
| 86 | EVENT_CONSTRAINT_END | 86 | EVENT_CONSTRAINT_END |
| 87 | }; | 87 | }; |
| 88 | 88 | ||
| 89 | static struct extra_reg intel_nehalem_extra_regs[] = | 89 | static struct extra_reg intel_nehalem_extra_regs[] __read_mostly = |
| 90 | { | 90 | { |
| 91 | INTEL_EVENT_EXTRA_REG(0xb7, MSR_OFFCORE_RSP_0, 0xffff), | 91 | INTEL_EVENT_EXTRA_REG(0xb7, MSR_OFFCORE_RSP_0, 0xffff), |
| 92 | EVENT_EXTRA_END | 92 | EVENT_EXTRA_END |
| 93 | }; | 93 | }; |
| 94 | 94 | ||
| 95 | static struct event_constraint intel_nehalem_percore_constraints[] = | 95 | static struct event_constraint intel_nehalem_percore_constraints[] __read_mostly = |
| 96 | { | 96 | { |
| 97 | INTEL_EVENT_CONSTRAINT(0xb7, 0), | 97 | INTEL_EVENT_CONSTRAINT(0xb7, 0), |
| 98 | EVENT_CONSTRAINT_END | 98 | EVENT_CONSTRAINT_END |
| 99 | }; | 99 | }; |
| 100 | 100 | ||
| 101 | static struct event_constraint intel_westmere_event_constraints[] = | 101 | static struct event_constraint intel_westmere_event_constraints[] __read_mostly = |
| 102 | { | 102 | { |
| 103 | FIXED_EVENT_CONSTRAINT(0x00c0, 0), /* INST_RETIRED.ANY */ | 103 | FIXED_EVENT_CONSTRAINT(0x00c0, 0), /* INST_RETIRED.ANY */ |
| 104 | FIXED_EVENT_CONSTRAINT(0x003c, 1), /* CPU_CLK_UNHALTED.CORE */ | 104 | FIXED_EVENT_CONSTRAINT(0x003c, 1), /* CPU_CLK_UNHALTED.CORE */ |
| @@ -110,7 +110,7 @@ static struct event_constraint intel_westmere_event_constraints[] = | |||
| 110 | EVENT_CONSTRAINT_END | 110 | EVENT_CONSTRAINT_END |
| 111 | }; | 111 | }; |
| 112 | 112 | ||
| 113 | static struct event_constraint intel_snb_event_constraints[] = | 113 | static struct event_constraint intel_snb_event_constraints[] __read_mostly = |
| 114 | { | 114 | { |
| 115 | FIXED_EVENT_CONSTRAINT(0x00c0, 0), /* INST_RETIRED.ANY */ | 115 | FIXED_EVENT_CONSTRAINT(0x00c0, 0), /* INST_RETIRED.ANY */ |
| 116 | FIXED_EVENT_CONSTRAINT(0x003c, 1), /* CPU_CLK_UNHALTED.CORE */ | 116 | FIXED_EVENT_CONSTRAINT(0x003c, 1), /* CPU_CLK_UNHALTED.CORE */ |
| @@ -123,21 +123,21 @@ static struct event_constraint intel_snb_event_constraints[] = | |||
| 123 | EVENT_CONSTRAINT_END | 123 | EVENT_CONSTRAINT_END |
| 124 | }; | 124 | }; |
| 125 | 125 | ||
| 126 | static struct extra_reg intel_westmere_extra_regs[] = | 126 | static struct extra_reg intel_westmere_extra_regs[] __read_mostly = |
| 127 | { | 127 | { |
| 128 | INTEL_EVENT_EXTRA_REG(0xb7, MSR_OFFCORE_RSP_0, 0xffff), | 128 | INTEL_EVENT_EXTRA_REG(0xb7, MSR_OFFCORE_RSP_0, 0xffff), |
| 129 | INTEL_EVENT_EXTRA_REG(0xbb, MSR_OFFCORE_RSP_1, 0xffff), | 129 | INTEL_EVENT_EXTRA_REG(0xbb, MSR_OFFCORE_RSP_1, 0xffff), |
| 130 | EVENT_EXTRA_END | 130 | EVENT_EXTRA_END |
| 131 | }; | 131 | }; |
| 132 | 132 | ||
| 133 | static struct event_constraint intel_westmere_percore_constraints[] = | 133 | static struct event_constraint intel_westmere_percore_constraints[] __read_mostly = |
| 134 | { | 134 | { |
| 135 | INTEL_EVENT_CONSTRAINT(0xb7, 0), | 135 | INTEL_EVENT_CONSTRAINT(0xb7, 0), |
| 136 | INTEL_EVENT_CONSTRAINT(0xbb, 0), | 136 | INTEL_EVENT_CONSTRAINT(0xbb, 0), |
| 137 | EVENT_CONSTRAINT_END | 137 | EVENT_CONSTRAINT_END |
| 138 | }; | 138 | }; |
| 139 | 139 | ||
| 140 | static struct event_constraint intel_gen_event_constraints[] = | 140 | static struct event_constraint intel_gen_event_constraints[] __read_mostly = |
| 141 | { | 141 | { |
| 142 | FIXED_EVENT_CONSTRAINT(0x00c0, 0), /* INST_RETIRED.ANY */ | 142 | FIXED_EVENT_CONSTRAINT(0x00c0, 0), /* INST_RETIRED.ANY */ |
| 143 | FIXED_EVENT_CONSTRAINT(0x003c, 1), /* CPU_CLK_UNHALTED.CORE */ | 143 | FIXED_EVENT_CONSTRAINT(0x003c, 1), /* CPU_CLK_UNHALTED.CORE */ |
| @@ -1423,6 +1423,11 @@ static __init int intel_pmu_init(void) | |||
| 1423 | x86_pmu.enable_all = intel_pmu_nhm_enable_all; | 1423 | x86_pmu.enable_all = intel_pmu_nhm_enable_all; |
| 1424 | x86_pmu.extra_regs = intel_nehalem_extra_regs; | 1424 | x86_pmu.extra_regs = intel_nehalem_extra_regs; |
| 1425 | 1425 | ||
| 1426 | /* UOPS_ISSUED.STALLED_CYCLES */ | ||
| 1427 | intel_perfmon_event_map[PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = 0x180010e; | ||
| 1428 | /* UOPS_EXECUTED.CORE_ACTIVE_CYCLES,c=1,i=1 */ | ||
| 1429 | intel_perfmon_event_map[PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = 0x1803fb1; | ||
| 1430 | |||
| 1426 | if (ebx & 0x40) { | 1431 | if (ebx & 0x40) { |
| 1427 | /* | 1432 | /* |
| 1428 | * Erratum AAJ80 detected, we work it around by using | 1433 | * Erratum AAJ80 detected, we work it around by using |
| @@ -1463,6 +1468,12 @@ static __init int intel_pmu_init(void) | |||
| 1463 | x86_pmu.enable_all = intel_pmu_nhm_enable_all; | 1468 | x86_pmu.enable_all = intel_pmu_nhm_enable_all; |
| 1464 | x86_pmu.pebs_constraints = intel_westmere_pebs_event_constraints; | 1469 | x86_pmu.pebs_constraints = intel_westmere_pebs_event_constraints; |
| 1465 | x86_pmu.extra_regs = intel_westmere_extra_regs; | 1470 | x86_pmu.extra_regs = intel_westmere_extra_regs; |
| 1471 | |||
| 1472 | /* UOPS_ISSUED.STALLED_CYCLES */ | ||
| 1473 | intel_perfmon_event_map[PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = 0x180010e; | ||
| 1474 | /* UOPS_EXECUTED.CORE_ACTIVE_CYCLES,c=1,i=1 */ | ||
| 1475 | intel_perfmon_event_map[PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = 0x1803fb1; | ||
| 1476 | |||
| 1466 | pr_cont("Westmere events, "); | 1477 | pr_cont("Westmere events, "); |
| 1467 | break; | 1478 | break; |
| 1468 | 1479 | ||
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 207c16976a17..3412684ce5d5 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h | |||
| @@ -52,6 +52,8 @@ 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_FRONTEND = 7, | ||
| 56 | PERF_COUNT_HW_STALLED_CYCLES_BACKEND = 8, | ||
| 55 | 57 | ||
| 56 | PERF_COUNT_HW_MAX, /* non-ABI */ | 58 | PERF_COUNT_HW_MAX, /* non-ABI */ |
| 57 | }; | 59 | }; |
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 03f0e45f1479..602c3c96fa1e 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c | |||
| @@ -46,6 +46,7 @@ | |||
| 46 | #include "util/evlist.h" | 46 | #include "util/evlist.h" |
