diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2009-06-11 08:06:28 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-06-11 11:54:15 -0400 |
commit | f4dbfa8f3131a84257223393905f7efad0ca5996 (patch) | |
tree | 67bb2666868c4449c2fa9ba6dc931721f60deb6c | |
parent | 1c432d899d32d36371ee4ee310fa3609cf0e5742 (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>
-rw-r--r-- | arch/powerpc/kernel/power4-pmu.c | 12 | ||||
-rw-r--r-- | arch/powerpc/kernel/power5+-pmu.c | 12 | ||||
-rw-r--r-- | arch/powerpc/kernel/power5-pmu.c | 12 | ||||
-rw-r--r-- | arch/powerpc/kernel/power6-pmu.c | 12 | ||||
-rw-r--r-- | arch/powerpc/kernel/ppc970-pmu.c | 12 | ||||
-rw-r--r-- | arch/powerpc/mm/fault.c | 6 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/perf_counter.c | 32 | ||||
-rw-r--r-- | arch/x86/mm/fault.c | 6 | ||||
-rw-r--r-- | include/linux/perf_counter.h | 36 | ||||
-rw-r--r-- | kernel/perf_counter.c | 20 | ||||
-rw-r--r-- | tools/perf/builtin-record.c | 4 | ||||
-rw-r--r-- | tools/perf/builtin-stat.c | 31 | ||||
-rw-r--r-- | tools/perf/builtin-top.c | 4 | ||||
-rw-r--r-- | tools/perf/design.txt | 28 | ||||
-rw-r--r-- | tools/perf/util/parse-events.c | 44 |
15 files changed, 136 insertions, 135 deletions
diff --git a/arch/powerpc/kernel/power4-pmu.c b/arch/powerpc/kernel/power4-pmu.c index 0e94b6857220..73956f084b29 100644 --- a/arch/powerpc/kernel/power4-pmu.c +++ b/arch/powerpc/kernel/power4-pmu.c | |||
@@ -535,12 +535,12 @@ static void p4_disable_pmc(unsigned int pmc, u64 mmcr[]) | |||
535 | } | 535 | } |
536 | 536 | ||
537 | static int p4_generic_events[] = { | 537 | static int p4_generic_events[] = { |
538 | [PERF_COUNT_CPU_CYCLES] = 7, | 538 | [PERF_COUNT_HW_CPU_CYCLES] = 7, |
539 | [PERF_COUNT_INSTRUCTIONS] = 0x1001, | 539 | [PERF_COUNT_HW_INSTRUCTIONS] = 0x1001, |
540 | [PERF_COUNT_CACHE_REFERENCES] = 0x8c10, /* PM_LD_REF_L1 */ | 540 | [PERF_COUNT_HW_CACHE_REFERENCES] = 0x8c10, /* PM_LD_REF_L1 */ |
541 | [PERF_COUNT_CACHE_MISSES] = 0x3c10, /* PM_LD_MISS_L1 */ | 541 | [PERF_COUNT_HW_CACHE_MISSES] = 0x3c10, /* PM_LD_MISS_L1 */ |
542 | [PERF_COUNT_BRANCH_INSTRUCTIONS] = 0x330, /* PM_BR_ISSUED */ | 542 | [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x330, /* PM_BR_ISSUED */ |
543 | [PERF_COUNT_BRANCH_MISSES] = 0x331, /* PM_BR_MPRED_CR */ | 543 | [PERF_COUNT_HW_BRANCH_MISSES] = 0x331, /* PM_BR_MPRED_CR */ |
544 | }; | 544 | }; |
545 | 545 | ||
546 | #define C(x) PERF_COUNT_HW_CACHE_##x | 546 | #define C(x) PERF_COUNT_HW_CACHE_##x |
diff --git a/arch/powerpc/kernel/power5+-pmu.c b/arch/powerpc/kernel/power5+-pmu.c index bbf2cbb07388..5f8b7741e970 100644 --- a/arch/powerpc/kernel/power5+-pmu.c +++ b/arch/powerpc/kernel/power5+-pmu.c | |||
@@ -606,12 +606,12 @@ static void power5p_disable_pmc(unsigned int pmc, u64 mmcr[]) | |||
606 | } | 606 | } |
607 | 607 | ||
608 | static int power5p_generic_events[] = { | 608 | static int power5p_generic_events[] = { |
609 | [PERF_COUNT_CPU_CYCLES] = 0xf, | 609 | [PERF_COUNT_HW_CPU_CYCLES] = 0xf, |
610 | [PERF_COUNT_INSTRUCTIONS] = 0x100009, | 610 | [PERF_COUNT_HW_INSTRUCTIONS] = 0x100009, |
611 | [PERF_COUNT_CACHE_REFERENCES] = 0x1c10a8, /* LD_REF_L1 */ | 611 | [PERF_COUNT_HW_CACHE_REFERENCES] = 0x1c10a8, /* LD_REF_L1 */ |
612 | [PERF_COUNT_CACHE_MISSES] = 0x3c1088, /* LD_MISS_L1 */ | 612 | [PERF_COUNT_HW_CACHE_MISSES] = 0x3c1088, /* LD_MISS_L1 */ |
613 | [PERF_COUNT_BRANCH_INSTRUCTIONS] = 0x230e4, /* BR_ISSUED */ | 613 | [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x230e4, /* BR_ISSUED */ |
614 | [PERF_COUNT_BRANCH_MISSES] = 0x230e5, /* BR_MPRED_CR */ | 614 | [PERF_COUNT_HW_BRANCH_MISSES] = 0x230e5, /* BR_MPRED_CR */ |
615 | }; | 615 | }; |
616 | 616 | ||
617 | #define C(x) PERF_COUNT_HW_CACHE_##x | 617 | #define C(x) PERF_COUNT_HW_CACHE_##x |
diff --git a/arch/powerpc/kernel/power5-pmu.c b/arch/powerpc/kernel/power5-pmu.c index 670cf10b91e8..d54723ab627d 100644 --- a/arch/powerpc/kernel/power5-pmu.c +++ b/arch/powerpc/kernel/power5-pmu.c | |||
@@ -548,12 +548,12 @@ static void power5_disable_pmc(unsigned int pmc, u64 mmcr[]) | |||
548 | } | 548 | } |
549 | 549 | ||
550 | static int power5_generic_events[] = { | 550 | static int power5_generic_events[] = { |
551 | [PERF_COUNT_CPU_CYCLES] = 0xf, | 551 | [PERF_COUNT_HW_CPU_CYCLES] = 0xf, |
552 | [PERF_COUNT_INSTRUCTIONS] = 0x100009, | 552 | [PERF_COUNT_HW_INSTRUCTIONS] = 0x100009, |
553 | [PERF_COUNT_CACHE_REFERENCES] = 0x4c1090, /* LD_REF_L1 */ | 553 | [PERF_COUNT_HW_CACHE_REFERENCES] = 0x4c1090, /* LD_REF_L1 */ |
554 | [PERF_COUNT_CACHE_MISSES] = 0x3c1088, /* LD_MISS_L1 */ | 554 | [PERF_COUNT_HW_CACHE_MISSES] = 0x3c1088, /* LD_MISS_L1 */ |
555 | [PERF_COUNT_BRANCH_INSTRUCTIONS] = 0x230e4, /* BR_ISSUED */ | 555 | [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x230e4, /* BR_ISSUED */ |
556 | [PERF_COUNT_BRANCH_MISSES] = 0x230e5, /* BR_MPRED_CR */ | 556 | [PERF_COUNT_HW_BRANCH_MISSES] = 0x230e5, /* BR_MPRED_CR */ |
557 | }; | 557 | }; |
558 | 558 | ||
559 | #define C(x) PERF_COUNT_HW_CACHE_##x | 559 | #define C(x) PERF_COUNT_HW_CACHE_##x |
diff --git a/arch/powerpc/kernel/power6-pmu.c b/arch/powerpc/kernel/power6-pmu.c index 4da707866097..0cd406ee765b 100644 --- a/arch/powerpc/kernel/power6-pmu.c +++ b/arch/powerpc/kernel/power6-pmu.c | |||
@@ -466,12 +466,12 @@ static void p6_disable_pmc(unsigned int pmc, u64 mmcr[]) | |||
466 | } | 466 | } |
467 | 467 | ||
468 | static int power6_generic_events[] = { | 468 | static int power6_generic_events[] = { |
469 | [PERF_COUNT_CPU_CYCLES] = 0x1e, | 469 | [PERF_COUNT_HW_CPU_CYCLES] = 0x1e, |
470 | [PERF_COUNT_INSTRUCTIONS] = 2, | 470 | [PERF_COUNT_HW_INSTRUCTIONS] = 2, |
471 | [PERF_COUNT_CACHE_REFERENCES] = 0x280030, /* LD_REF_L1 */ | 471 | [PERF_COUNT_HW_CACHE_REFERENCES] = 0x280030, /* LD_REF_L1 */ |
472 | [PERF_COUNT_CACHE_MISSES] = 0x30000c, /* LD_MISS_L1 */ | 472 | [PERF_COUNT_HW_CACHE_MISSES] = 0x30000c, /* LD_MISS_L1 */ |
473 | [PERF_COUNT_BRANCH_INSTRUCTIONS] = 0x410a0, /* BR_PRED */ | 473 | [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x410a0, /* BR_PRED */ |
474 | [PERF_COUNT_BRANCH_MISSES] = 0x400052, /* BR_MPRED */ | 474 | [PERF_COUNT_HW_BRANCH_MISSES] = 0x400052, /* BR_MPRED */ |
475 | }; | 475 | }; |
476 | 476 | ||
477 | #define C(x) PERF_COUNT_HW_CACHE_##x | 477 | #define C(x) PERF_COUNT_HW_CACHE_##x |
diff --git a/arch/powerpc/kernel/ppc970-pmu.c b/arch/powerpc/kernel/ppc970-pmu.c index 336adf1736af..46a206409420 100644 --- a/arch/powerpc/kernel/ppc970-pmu.c +++ b/arch/powerpc/kernel/ppc970-pmu.c | |||
@@ -419,12 +419,12 @@ static void p970_disable_pmc(unsigned int pmc, u64 mmcr[]) | |||
419 | } | 419 | } |
420 | 420 | ||
421 | static int ppc970_generic_events[] = { | 421 | static int ppc970_generic_events[] = { |
422 | [PERF_COUNT_CPU_CYCLES] = 7, | 422 | [PERF_COUNT_HW_CPU_CYCLES] = 7, |
423 | [PERF_COUNT_INSTRUCTIONS] = 1, | 423 | [PERF_COUNT_HW_INSTRUCTIONS] = 1, |
424 | [PERF_COUNT_CACHE_REFERENCES] = 0x8810, /* PM_LD_REF_L1 */ | 424 | [PERF_COUNT_HW_CACHE_REFERENCES] = 0x8810, /* PM_LD_REF_L1 */ |
425 | [PERF_COUNT_CACHE_MISSES] = 0x3810, /* PM_LD_MISS_L1 */ | 425 | [PERF_COUNT_HW_CACHE_MISSES] = 0x3810, /* PM_LD_MISS_L1 */ |
426 | [PERF_COUNT_BRANCH_INSTRUCTIONS] = 0x431, /* PM_BR_ISSUED */ | 426 | [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x431, /* PM_BR_ISSUED */ |
427 | [PERF_COUNT_BRANCH_MISSES] = 0x327, /* PM_GRP_BR_MPRED */ | 427 | [PERF_COUNT_HW_BRANCH_MISSES] = 0x327, /* PM_GRP_BR_MPRED */ |
428 | }; | 428 | }; |
429 | 429 | ||
430 | #define C(x) PERF_COUNT_HW_CACHE_##x | 430 | #define C(x) PERF_COUNT_HW_CACHE_##x |
diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c index ac0e112031b2..5beffc8f481e 100644 --- a/arch/powerpc/mm/fault.c +++ b/arch/powerpc/mm/fault.c | |||
@@ -171,7 +171,7 @@ int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address, | |||
171 | die("Weird page fault", regs, SIGSEGV); | 171 | die("Weird page fault", regs, SIGSEGV); |
172 | } | 172 | } |
173 | 173 | ||
174 | perf_swcounter_event(PERF_COUNT_PAGE_FAULTS, 1, 0, regs, address); | 174 | perf_swcounter_event(PERF_COUNT_SW_PAGE_FAULTS, 1, 0, regs, address); |
175 | 175 | ||
176 | /* When running in the kernel we expect faults to occur only to | 176 | /* When running in the kernel we expect faults to occur only to |
177 | * addresses in user space. All other faults represent errors in the | 177 | * addresses in user space. All other faults represent errors in the |
@@ -312,7 +312,7 @@ good_area: | |||
312 | } | 312 | } |
313 | if (ret & VM_FAULT_MAJOR) { | 313 | if (ret & VM_FAULT_MAJOR) { |
314 | current->maj_flt++; | 314 | current->maj_flt++; |
315 | perf_swcounter_event(PERF_COUNT_PAGE_FAULTS_MAJ, 1, 0, | 315 | perf_swcounter_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, 0, |
316 | regs, address); | 316 | regs, address); |
317 | #ifdef CONFIG_PPC_SMLPAR | 317 | #ifdef CONFIG_PPC_SMLPAR |
318 | if (firmware_has_feature(FW_FEATURE_CMO)) { | 318 | if (firmware_has_feature(FW_FEATURE_CMO)) { |
@@ -323,7 +323,7 @@ good_area: | |||
323 | #endif | 323 | #endif |
324 | } else { | 324 | } else { |
325 | current->min_flt++; | 325 | current->min_flt++; |
326 | perf_swcounter_event(PERF_COUNT_PAGE_FAULTS_MIN, 1, 0, | 326 | perf_swcounter_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, 0, |
327 | regs, address); | 327 | regs, address); |
328 | } | 328 | } |
329 | up_read(&mm->mmap_sem); | 329 | up_read(&mm->mmap_sem); |
diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c index 57ae1bec81be..572fb434a666 100644 --- a/arch/x86/kernel/cpu/perf_counter.c +++ b/arch/x86/kernel/cpu/perf_counter.c | |||
@@ -69,13 +69,13 @@ static DEFINE_PER_CPU(struct cpu_hw_counters, cpu_hw_counters) = { | |||
69 | */ | 69 | */ |
70 | static const u64 intel_perfmon_event_map[] = | 70 | static const u64 intel_perfmon_event_map[] = |
71 | { | 71 | { |
72 | [PERF_COUNT_CPU_CYCLES] = 0x003c, | 72 | [PERF_COUNT_HW_CPU_CYCLES] = 0x003c, |
73 | [PERF_COUNT_INSTRUCTIONS] = 0x00c0, | 73 | [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0, |
74 | [PERF_COUNT_CACHE_REFERENCES] = 0x4f2e, | 74 | [PERF_COUNT_HW_CACHE_REFERENCES] = 0x4f2e, |
75 | [PERF_COUNT_CACHE_MISSES] = 0x412e, | 75 | [PERF_COUNT_HW_CACHE_MISSES] = 0x412e, |
76 | [PERF_COUNT_BRANCH_INSTRUCTIONS] = 0x00c4, | 76 | [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x00c4, |
77 | [PERF_COUNT_BRANCH_MISSES] = 0x00c5, | 77 | [PERF_COUNT_HW_BRANCH_MISSES] = 0x00c5, |
78 | [PERF_COUNT_BUS_CYCLES] = 0x013c, | 78 | [PERF_COUNT_HW_BUS_CYCLES] = 0x013c, |
79 | }; | 79 | }; |
80 | 80 | ||
81 | static u64 intel_pmu_event_map(int event) | 81 | static u64 intel_pmu_event_map(int event) |
@@ -485,12 +485,12 @@ static const u64 amd_0f_hw_cache_event_ids | |||
485 | */ | 485 | */ |
486 | static const u64 amd_perfmon_event_map[] = | 486 | static const u64 amd_perfmon_event_map[] = |
487 | { | 487 | { |
488 | [PERF_COUNT_CPU_CYCLES] = 0x0076, | 488 | [PERF_COUNT_HW_CPU_CYCLES] = 0x0076, |
489 | [PERF_COUNT_INSTRUCTIONS] = 0x00c0, | 489 | [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0, |
490 | [PERF_COUNT_CACHE_REFERENCES] = 0x0080, | 490 | [PERF_COUNT_HW_CACHE_REFERENCES] = 0x0080, |
491 | [PERF_COUNT_CACHE_MISSES] = 0x0081, | 491 | [PERF_COUNT_HW_CACHE_MISSES] = 0x0081, |
492 | [PERF_COUNT_BRANCH_INSTRUCTIONS] = 0x00c4, | 492 | [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x00c4, |
493 | [PERF_COUNT_BRANCH_MISSES] = 0x00c5, | 493 | [PERF_COUNT_HW_BRANCH_MISSES] = 0x00c5, |
494 | }; | 494 | }; |
495 | 495 | ||
496 | static u64 amd_pmu_event_map(int event) | 496 | static u64 amd_pmu_event_map(int event) |
@@ -970,11 +970,11 @@ fixed_mode_idx(struct perf_counter *counter, struct hw_perf_counter *hwc) | |||
970 | 970 | ||
971 | event = hwc->config & ARCH_PERFMON_EVENT_MASK; | 971 | event = hwc->config & ARCH_PERFMON_EVENT_MASK; |
972 | 972 | ||
973 | if (unlikely(event == x86_pmu.event_map(PERF_COUNT_INSTRUCTIONS))) | 973 | if (unlikely(event == x86_pmu.event_map(PERF_COUNT_HW_INSTRUCTIONS))) |
974 | return X86_PMC_IDX_FIXED_INSTRUCTIONS; | 974 | return X86_PMC_IDX_FIXED_INSTRUCTIONS; |
975 | if (unlikely(event == x86_pmu.event_map(PERF_COUNT_CPU_CYCLES))) | 975 | if (unlikely(event == x86_pmu.event_map(PERF_COUNT_HW_CPU_CYCLES))) |
976 | return X86_PMC_IDX_FIXED_CPU_CYCLES; | 976 | return X86_PMC_IDX_FIXED_CPU_CYCLES; |
977 | if (unlikely(event == x86_pmu.event_map(PERF_COUNT_BUS_CYCLES))) | 977 | if (unlikely(event == x86_pmu.event_map(PERF_COUNT_HW_BUS_CYCLES))) |
978 | return X86_PMC_IDX_FIXED_BUS_CYCLES; | 978 | return X86_PMC_IDX_FIXED_BUS_CYCLES; |
979 | 979 | ||
980 | return -1; | 980 | return -1; |
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index 6f9df2babe48..5c6d816f30b4 100644 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c | |||
@@ -1045,7 +1045,7 @@ do_page_fault(struct pt_regs *regs, unsigned long error_code) | |||
1045 | if (unlikely(error_code & PF_RSVD)) | 1045 | if (unlikely(error_code & PF_RSVD)) |
1046 | pgtable_bad(regs, error_code, address); | 1046 | pgtable_bad(regs, error_code, address); |
1047 | 1047 | ||
1048 | perf_swcounter_event(PERF_COUNT_PAGE_FAULTS, 1, 0, regs, address); | 1048 | perf_swcounter_event(PERF_COUNT_SW_PAGE_FAULTS, 1, 0, regs, address); |
1049 | 1049 | ||
1050 | /* | 1050 | /* |
1051 | * If we're in an interrupt, have no user context or are running | 1051 | * If we're in an interrupt, have no user context or are running |
@@ -1142,11 +1142,11 @@ good_area: | |||
1142 | 1142 | ||
1143 | if (fault & VM_FAULT_MAJOR) { | 1143 | if (fault & VM_FAULT_MAJOR) { |
1144 | tsk->maj_flt++; | 1144 | tsk->maj_flt++; |
1145 | perf_swcounter_event(PERF_COUNT_PAGE_FAULTS_MAJ, 1, 0, | 1145 | perf_swcounter_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, 0, |
1146 | regs, address); | 1146 | regs, address); |
1147 | } else { | 1147 | } else { |
1148 | tsk->min_flt++; | 1148 | tsk->min_flt++; |
1149 | perf_swcounter_event(PERF_COUNT_PAGE_FAULTS_MIN, 1, 0, | 1149 | perf_swcounter_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, 0, |
1150 | regs, address); | 1150 | regs, address); |
1151 | } | 1151 | } |
1152 | 1152 | ||
diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h index d5911b02bc8c..887df88a9c2a 100644 --- a/include/linux/perf_counter.h +++ b/include/linux/perf_counter.h | |||
@@ -42,15 +42,15 @@ enum perf_hw_id { | |||
42 | /* | 42 | /* |
43 | * Common hardware events, generalized by the kernel: | 43 | * Common hardware events, generalized by the kernel: |
44 | */ | 44 | */ |
45 | PERF_COUNT_CPU_CYCLES = 0, | 45 | PERF_COUNT_HW_CPU_CYCLES = 0, |
46 | PERF_COUNT_INSTRUCTIONS = 1, | 46 | PERF_COUNT_HW_INSTRUCTIONS = 1, |
47 | PERF_COUNT_CACHE_REFERENCES = 2, | 47 | PERF_COUNT_HW_CACHE_REFERENCES = 2, |
48 | PERF_COUNT_CACHE_MISSES = 3, | 48 | PERF_COUNT_HW_CACHE_MISSES = 3, |
49 | PERF_COUNT_BRANCH_INSTRUCTIONS = 4, | 49 | PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 4, |
50 | PERF_COUNT_BRANCH_MISSES = 5, | 50 | PERF_COUNT_HW_BRANCH_MISSES = 5, |
51 | PERF_COUNT_BUS_CYCLES = 6, | 51 | PERF_COUNT_HW_BUS_CYCLES = 6, |
52 | 52 | ||
53 | PERF_HW_EVENTS_MAX, /* non ABI */ | 53 | PERF_COUNT_HW_MAX, /* non ABI */ |
54 | }; | 54 | }; |
55 | 55 | ||
56 | /* | 56 | /* |
@@ -93,15 +93,15 @@ enum perf_hw_cache_op_result_id { | |||
93 | * well): | 93 | * well): |
94 | */ | 94 | */ |
95 | enum perf_sw_ids { | 95 | enum perf_sw_ids { |
96 | PERF_COUNT_CPU_CLOCK = 0, | 96 | PERF_COUNT_SW_CPU_CLOCK = 0, |
97 | PERF_COUNT_TASK_CLOCK = 1, | 97 | PERF_COUNT_SW_TASK_CLOCK = 1, |
98 | PERF_COUNT_PAGE_FAULTS = 2, | 98 | PERF_COUNT_SW_PAGE_FAULTS = 2, |
99 | PERF_COUNT_CONTEXT_SWITCHES = 3, | 99 | PERF_COUNT_SW_CONTEXT_SWITCHES = 3, |
100 | PERF_COUNT_CPU_MIGRATIONS = 4, | 100 | PERF_COUNT_SW_CPU_MIGRATIONS = 4, |
101 | PERF_COUNT_PAGE_FAULTS_MIN = 5, | 101 | PERF_COUNT_SW_PAGE_FAULTS_MIN = 5, |
102 | PERF_COUNT_PAGE_FAULTS_MAJ = 6, | 102 | PERF_COUNT_SW_PAGE_FAULTS_MAJ = 6, |
103 | 103 | ||
104 | PERF_SW_EVENTS_MAX, /* non ABI */ | 104 | PERF_COUNT_SW_MAX, /* non ABI */ |
105 | }; | 105 | }; |
106 | 106 | ||
107 | /* | 107 | /* |
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c index c02535bed26f..8859b97390ec 100644 --- a/kernel/perf_counter.c +++ b/kernel/perf_counter.c | |||
@@ -1024,7 +1024,7 @@ void perf_counter_task_sched_out(struct task_struct *task, | |||
1024 | int do_switch = 1; | 1024 | int do_switch = 1; |
1025 | 1025 | ||
1026 | regs = task_pt_regs(task); | 1026 | regs = task_pt_regs(task); |
1027 | perf_swcounter_event(PERF_COUNT_CONTEXT_SWITCHES, 1, 1, regs, 0); | 1027 | perf_swcounter_event(PERF_COUNT_SW_CONTEXT_SWITCHES, 1, 1, regs, 0); |
1028 | 1028 | ||
1029 | if (likely(!ctx || !cpuctx->task_ctx)) | 1029 | if (likely(!ctx || !cpuctx->task_ctx)) |
1030 | return; | 1030 | return; |
@@ -3411,13 +3411,13 @@ void perf_counter_task_migration(struct task_struct *task, int cpu) | |||
3411 | struct perf_counter_context *ctx; | 3411 | struct perf_counter_context *ctx; |
3412 | 3412 | ||
3413 | perf_swcounter_ctx_event(&cpuctx->ctx, PERF_TYPE_SOFTWARE, | 3413 | perf_swcounter_ctx_event(&cpuctx->ctx, PERF_TYPE_SOFTWARE, |
3414 | PERF_COUNT_CPU_MIGRATIONS, | 3414 | PERF_COUNT_SW_CPU_MIGRATIONS, |
3415 | 1, 1, NULL, 0); | 3415 | 1, 1, NULL, 0); |
3416 | 3416 | ||
3417 | ctx = perf_pin_task_context(task); | 3417 | ctx = perf_pin_task_context(task); |
3418 | if (ctx) { | 3418 | if (ctx) { |
3419 | perf_swcounter_ctx_event(ctx, PERF_TYPE_SOFTWARE, | 3419 | perf_swcounter_ctx_event(ctx, PERF_TYPE_SOFTWARE, |
3420 | PERF_COUNT_CPU_MIGRATIONS, | 3420 | PERF_COUNT_SW_CPU_MIGRATIONS, |
3421 | 1, 1, NULL, 0); | 3421 | 1, 1, NULL, 0); |
3422 | perf_unpin_context(ctx); | 3422 | perf_unpin_context(ctx); |
3423 | } | 3423 | } |
@@ -3475,11 +3475,11 @@ static const struct pmu *sw_perf_counter_init(struct perf_counter *counter) | |||
3475 | * events. | 3475 | * events. |
3476 | */ | 3476 | */ |
3477 | switch (counter->attr.config) { | 3477 | switch (counter->attr.config) { |
3478 | case PERF_COUNT_CPU_CLOCK: | 3478 | case PERF_COUNT_SW_CPU_CLOCK: |
3479 | pmu = &perf_ops_cpu_clock; | 3479 | pmu = &perf_ops_cpu_clock; |
3480 | 3480 | ||
3481 | break; | 3481 | break; |
3482 | case PERF_COUNT_TASK_CLOCK: | 3482 | case PERF_COUNT_SW_TASK_CLOCK: |
3483 | /* | 3483 | /* |
3484 | * If the user instantiates this as a per-cpu counter, | 3484 | * If the user instantiates this as a per-cpu counter, |
3485 | * use the cpu_clock counter instead. | 3485 | * use the cpu_clock counter instead. |
@@ -3490,11 +3490,11 @@ static const struct pmu *sw_perf_counter_init(struct perf_counter *counter) | |||
3490 | pmu = &perf_ops_cpu_clock; | 3490 | pmu = &perf_ops_cpu_clock; |
3491 | 3491 | ||
3492 | break; | 3492 | break; |
3493 | case PERF_COUNT_PAGE_FAULTS: | 3493 | case PERF_COUNT_SW_PAGE_FAULTS: |
3494 | case PERF_COUNT_PAGE_FAULTS_MIN: | 3494 | case PERF_COUNT_SW_PAGE_FAULTS_MIN: |
3495 | case PERF_COUNT_PAGE_FAULTS_MAJ: | 3495 | case PERF_COUNT_SW_PAGE_FAULTS_MAJ: |
3496 | case PERF_COUNT_CONTEXT_SWITCHES: | 3496 | case PERF_COUNT_SW_CONTEXT_SWITCHES: |
3497 | case PERF_COUNT_CPU_MIGRATIONS: | 3497 | case PERF_COUNT_SW_CPU_MIGRATIONS: |
3498 | pmu = &perf_ops_generic; | 3498 | pmu = &perf_ops_generic; |
3499 | break; | 3499 | break; |
3500 | } | 3500 | } |
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 84cd336ae79b..29259e74dcfa 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -378,12 +378,12 @@ try_again: | |||
378 | * is always available even if no PMU support: | 378 | * is always available even if no PMU support: |
379 | */ | 379 | */ |
380 | if (attr->type == PERF_TYPE_HARDWARE | 380 | if (attr->type == PERF_TYPE_HARDWARE |
381 | && attr->config == PERF_COUNT_CPU_CYCLES) { | 381 | && attr->config == PERF_COUNT_HW_CPU_CYCLES) { |
382 | 382 | ||
383 | if (verbose) | 383 | if (verbose) |
384 | warning(" ... trying to fall back to cpu-clock-ticks\n"); | 384 | warning(" ... trying to fall back to cpu-clock-ticks\n"); |
385 | attr->type = PERF_TYPE_SOFTWARE; | 385 | attr->type = PERF_TYPE_SOFTWARE; |
386 | attr->config = PERF_COUNT_CPU_CLOCK; | 386 | attr->config = PERF_COUNT_SW_CPU_CLOCK; |
387 | goto try_again; | 387 | goto try_again; |
388 | } | 388 | } |
389 | printf("\n"); | 389 | printf("\n"); |
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 6404906924fa..c43e4a97dc42 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c | |||
@@ -46,15 +46,16 @@ | |||
46 | 46 | ||
47 | static struct perf_counter_attr default_attrs[MAX_COUNTERS] = { | 47 | static struct perf_counter_attr default_attrs[MAX_COUNTERS] = { |
48 | 48 | ||
49 | { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_TASK_CLOCK }, | 49 | { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_TASK_CLOCK }, |
50 | { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_CONTEXT_SWITCHES }, | 50 | { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_CONTEXT_SWITCHES}, |
51 | { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_CPU_MIGRATIONS }, | 51 | { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_CPU_MIGRATIONS }, |
52 | { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_PAGE_FAULTS }, | 52 | { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_PAGE_FAULTS }, |
53 | 53 | ||
54 | { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_CPU_CYCLES }, | 54 | { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_CPU_CYCLES }, |
55 | { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_INSTRUCTIONS }, | 55 | { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_INSTRUCTIONS }, |
56 | { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_CACHE_REFERENCES }, | 56 | { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_CACHE_REFERENCES}, |
57 | { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_CACHE_MISSES }, | 57 | { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_CACHE_MISSES }, |
58 | |||
58 | }; | 59 | }; |
59 | 60 | ||
60 | static int system_wide = 0; | 61 | static int system_wide = 0; |
@@ -120,10 +121,10 @@ static inline int nsec_counter(int counter) | |||
120 | if (attrs[counter].type != PERF_TYPE_SOFTWARE) | 121 | if (attrs[counter].type != PERF_TYPE_SOFTWARE) |
121 | return 0; | 122 | return 0; |
122 | 123 | ||
123 | if (attrs[counter].config == PERF_COUNT_CPU_CLOCK) | 124 | if (attrs[counter].config == PERF_COUNT_SW_CPU_CLOCK) |
124 | return 1; | 125 | return 1; |
125 | 126 | ||
126 | if (attrs[counter].config == PERF_COUNT_TASK_CLOCK) | 127 | if (attrs[counter].config == PERF_COUNT_SW_TASK_CLOCK) |
127 | return 1; | 128 | return 1; |
128 | 129 | ||
129 | return 0; | 130 | return 0; |
@@ -176,10 +177,10 @@ static void read_counter(int counter) | |||
176 | * Save the full runtime - to allow normalization during printout: | 177 | * Save the full runtime - to allow normalization during printout: |
177 | */ | 178 | */ |
178 | if (attrs[counter].type == PERF_TYPE_SOFTWARE && | 179 | if (attrs[counter].type == PERF_TYPE_SOFTWARE && |
179 | attrs[counter].config == PERF_COUNT_TASK_CLOCK) | 180 | attrs[counter].config == PERF_COUNT_SW_TASK_CLOCK) |
180 | runtime_nsecs = count[0]; | 181 | runtime_nsecs = count[0]; |
181 | if (attrs[counter].type == PERF_TYPE_HARDWARE && | 182 | if (attrs[counter].type == PERF_TYPE_HARDWARE && |
182 | attrs[counter].config == PERF_COUNT_CPU_CYCLES) | 183 | attrs[counter].config == PERF_COUNT_HW_CPU_CYCLES) |
183 | runtime_cycles = count[0]; | 184 | runtime_cycles = count[0]; |
184 | } | 185 | } |
185 | 186 | ||
@@ -206,7 +207,7 @@ static void print_counter(int counter) | |||
206 | fprintf(stderr, " %14.6f %-20s", | 207 | fprintf(stderr, " %14.6f %-20s", |
207 | msecs, event_name(counter)); | 208 | msecs, event_name(counter)); |
208 | if (attrs[counter].type == PERF_TYPE_SOFTWARE && | 209 | if (attrs[counter].type == PERF_TYPE_SOFTWARE && |
209 | attrs[counter].config == PERF_COUNT_TASK_CLOCK) { | 210 | attrs[counter].config == PERF_COUNT_SW_TASK_CLOCK) { |
210 | 211 | ||
211 | if (walltime_nsecs) | 212 | if (walltime_nsecs) |
212 | fprintf(stderr, " # %11.3f CPU utilization factor", | 213 | fprintf(stderr, " # %11.3f CPU utilization factor", |
@@ -220,7 +221,7 @@ static void print_counter(int counter) | |||
220 | (double)count[0]/runtime_nsecs*1000.0); | 221 | (double)count[0]/runtime_nsecs*1000.0); |
221 | if (runtime_cycles && | 222 | if (runtime_cycles && |
222 | attrs[counter].type == PERF_TYPE_HARDWARE && | 223 | attrs[counter].type == PERF_TYPE_HARDWARE && |
223 | attrs[counter].config == PERF_COUNT_INSTRUCTIONS) { | 224 | attrs[counter].config == PERF_COUNT_HW_INSTRUCTIONS) { |
224 | 225 | ||
225 | fprintf(stderr, " # %1.3f per cycle", | 226 | fprintf(stderr, " # %1.3f per cycle", |
226 | (double)count[0] / (double)runtime_cycles); | 227 | (double)count[0] / (double)runtime_cycles); |
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index 309dbc76ec88..fe338d3c5d7e 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -562,13 +562,13 @@ try_again: | |||
562 | * is always available even if no PMU support: | 562 | * is always available even if no PMU support: |
563 | */ | 563 | */ |
564 | if (attr->type == PERF_TYPE_HARDWARE | 564 | if (attr->type == PERF_TYPE_HARDWARE |
565 | && attr->config == PERF_COUNT_CPU_CYCLES) { | 565 | && attr->config == PERF_COUNT_HW_CPU_CYCLES) { |
566 | 566 | ||
567 | if (verbose) | 567 | if (verbose) |
568 | warning(" ... trying to fall back to cpu-clock-ticks\n"); | 568 | warning(" ... trying to fall back to cpu-clock-ticks\n"); |
569 | 569 | ||
570 | attr->type = PERF_TYPE_SOFTWARE; | 570 | attr->type = PERF_TYPE_SOFTWARE; |
571 | attr->config = PERF_COUNT_CPU_CLOCK; | 571 | attr->config = PERF_COUNT_SW_CPU_CLOCK; |
572 | goto try_again; | 572 | goto try_again; |
573 | } | 573 | } |
574 | printf("\n"); | 574 | printf("\n"); |
diff --git a/tools/perf/design.txt b/tools/perf/design.txt index d3250763dc92..860e116d979c 100644 --- a/tools/perf/design.txt +++ b/tools/perf/design.txt | |||
@@ -99,13 +99,13 @@ enum hw_event_ids { | |||
99 | /* | 99 | /* |
100 | * Common hardware events, generalized by the kernel: | 100 | * Common hardware events, generalized by the kernel: |
101 | */ | 101 | */ |
102 | PERF_COUNT_CPU_CYCLES = 0, | 102 | PERF_COUNT_HW_CPU_CYCLES = 0, |
103 | PERF_COUNT_INSTRUCTIONS = 1, | 103 | PERF_COUNT_HW_INSTRUCTIONS = 1, |
104 | PERF_COUNT_CACHE_REFERENCES = 2, | 104 | PERF_COUNT_HW_CACHE_REFERENCES = 2, |
105 | PERF_COUNT_CACHE_MISSES = 3, | 105 | PERF_COUNT_HW_CACHE_MISSES = 3, |
106 | PERF_COUNT_BRANCH_INSTRUCTIONS = 4, | 106 | PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 4, |
107 | PERF_COUNT_BRANCH_MISSES = 5, | 107 | PERF_COUNT_HW_BRANCH_MISSES = 5, |
108 | PERF_COUNT_BUS_CYCLES = 6, | 108 | PERF_COUNT_HW_BUS_CYCLES = 6, |
109 | }; | 109 | }; |
110 | 110 | ||
111 | These are standardized types of events that work relatively uniformly | 111 | These are standardized types of events that work relatively uniformly |
@@ -130,13 +130,13 @@ software events, selected by 'event_id': | |||
130 | * well): | 130 | * well): |
131 | */ | 131 | */ |
132 | enum sw_event_ids { | 132 | enum sw_event_ids { |
133 | PERF_COUNT_CPU_CLOCK = 0, | 133 | PERF_COUNT_SW_CPU_CLOCK = 0, |
134 | PERF_COUNT_TASK_CLOCK = 1, | 134 | PERF_COUNT_SW_TASK_CLOCK = 1, |
135 | PERF_COUNT_PAGE_FAULTS = 2, | 135 | PERF_COUNT_SW_PAGE_FAULTS = 2, |
136 | PERF_COUNT_CONTEXT_SWITCHES = 3, | 136 | PERF_COUNT_SW_CONTEXT_SWITCHES = 3, |
137 | PERF_COUNT_CPU_MIGRATIONS = 4, | 137 | PERF_COUNT_SW_CPU_MIGRATIONS = 4, |
138 | PERF_COUNT_PAGE_FAULTS_MIN = 5, | 138 | PERF_COUNT_SW_PAGE_FAULTS_MIN = 5, |
139 | PERF_COUNT_PAGE_FAULTS_MAJ = 6, | 139 | PERF_COUNT_SW_PAGE_FAULTS_MAJ = 6, |
140 | }; | 140 | }; |
141 | 141 | ||
142 | Counters of the type PERF_TYPE_TRACEPOINT are available when the ftrace event | 142 | 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 f18a9a006e1b..9d5f1ca50e6f 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c | |||
@@ -22,26 +22,26 @@ struct event_symbol { | |||
22 | #define CR(x, y) .type = PERF_TYPE_##x, .config = y | 22 | #define CR(x, y) .type = PERF_TYPE_##x, .config = y |
23 | 23 | ||
24 | static struct event_symbol event_symbols[] = { | 24 | static struct event_symbol event_symbols[] = { |
25 | { C(HARDWARE, CPU_CYCLES), "cpu-cycles", }, | 25 | { C(HARDWARE, HW_CPU_CYCLES), "cpu-cycles", }, |
26 | { C(HARDWARE, CPU_CYCLES), "cycles", }, | 26 | { C(HARDWARE, HW_CPU_CYCLES), "cycles", }, |
27 | { C(HARDWARE, INSTRUCTIONS), "instructions", }, | 27 | { C(HARDWARE, HW_INSTRUCTIONS), "instructions", }, |
28 | { C(HARDWARE, CACHE_REFERENCES), "cache-references", }, | 28 | { C(HARDWARE, HW_CACHE_REFERENCES), "cache-references", }, |
29 | { C(HARDWARE, CACHE_MISSES), "cache-misses", }, | 29 | { C(HARDWARE, HW_CACHE_MISSES), "cache-misses", }, |
30 | { C(HARDWARE, BRANCH_INSTRUCTIONS), "branch-instructions", }, | 30 | { C(HARDWARE, HW_BRANCH_INSTRUCTIONS),"branch-instructions", }, |
31 | { C(HARDWARE, BRANCH_INSTRUCTIONS), "branches", }, | 31 | { C(HARDWARE, HW_BRANCH_INSTRUCTIONS),"branches", }, |
32 | { C(HARDWARE, BRANCH_MISSES), "branch-misses", }, | 32 | { C(HARDWARE, HW_BRANCH_MISSES), "branch-misses", }, |
33 | { C(HARDWARE, BUS_CYCLES), "bus-cycles", }, | 33 | { C(HARDWARE, HW_BUS_CYCLES), "bus-cycles", }, |
34 | 34 | ||
35 | { C(SOFTWARE, CPU_CLOCK), "cpu-clock", }, | 35 | { C(SOFTWARE, SW_CPU_CLOCK), "cpu-clock", }, |
36 | { C(SOFTWARE, TASK_CLOCK), "task-clock", }, | 36 | { C(SOFTWARE, SW_TASK_CLOCK), "task-clock", }, |
37 | { C(SOFTWARE, PAGE_FAULTS), "page-faults", }, | 37 | { C(SOFTWARE, SW_PAGE_FAULTS), "page-faults", }, |
38 | { C(SOFTWARE, PAGE_FAULTS), "faults", }, | 38 | { C(SOFTWARE, SW_PAGE_FAULTS), "faults", }, |
39 | { C(SOFTWARE, PAGE_FAULTS_MIN), "minor-faults", }, | 39 | { C(SOFTWARE, SW_PAGE_FAULTS_MIN), "minor-faults", }, |
40 | { C(SOFTWARE, PAGE_FAULTS_MAJ), "major-faults", }, | 40 | { C(SOFTWARE, SW_PAGE_FAULTS_MAJ), "major-faults", }, |
41 | { C(SOFTWARE, CONTEXT_SWITCHES), "context-switches", }, | 41 | { C(SOFTWARE, SW_CONTEXT_SWITCHES), "context-switches", }, |
42 | { C(SOFTWARE, CONTEXT_SWITCHES), "cs", }, | 42 | { C(SOFTWARE, SW_CONTEXT_SWITCHES), "cs", }, |
43 | { C(SOFTWARE, CPU_MIGRATIONS), "cpu-migrations", }, | 43 | { C(SOFTWARE, SW_CPU_MIGRATIONS), "cpu-migrations", }, |
44 | { C(SOFTWARE, CPU_MIGRATIONS), "migrations", }, | 44 | { C(SOFTWARE, SW_CPU_MIGRATIONS), "migrations", }, |
45 | }; | 45 | }; |
46 | 46 | ||
47 | #define __PERF_COUNTER_FIELD(config, name) \ | 47 | #define __PERF_COUNTER_FIELD(config, name) \ |
@@ -107,7 +107,7 @@ char *event_name(int counter) | |||
107 | 107 | ||
108 | switch (type) { | 108 | switch (type) { |
109 | case PERF_TYPE_HARDWARE: | 109 | case PERF_TYPE_HARDWARE: |
110 | if (config < PERF_HW_EVENTS_MAX) | 110 | if (config < PERF_COUNT_HW_MAX) |
111 | return hw_event_names[config]; | 111 | return hw_event_names[config]; |
112 | return "unknown-hardware"; | 112 | return "unknown-hardware"; |
113 | 113 | ||
@@ -136,7 +136,7 @@ char *event_name(int counter) | |||
136 | } | 136 | } |
137 | 137 | ||
138 | case PERF_TYPE_SOFTWARE: | 138 | case PERF_TYPE_SOFTWARE: |
139 | if (config < PERF_SW_EVENTS_MAX) | 139 | if (config < PERF_COUNT_SW_MAX) |
140 | return sw_event_names[config]; | 140 | return sw_event_names[config]; |
141 | return "unknown-software"; | 141 | return "unknown-software"; |
142 | 142 | ||