Commit f4dbfa8f authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Ingo Molnar

perf_counter: Standardize event names

Pure renames only, to PERF_COUNT_HW_* and PERF_COUNT_SW_*.
Signed-off-by: default avatarPeter 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: default avatarIngo Molnar <mingo@elte.hu>
parent 1c432d89
...@@ -535,12 +535,12 @@ static void p4_disable_pmc(unsigned int pmc, u64 mmcr[]) ...@@ -535,12 +535,12 @@ static void p4_disable_pmc(unsigned int pmc, u64 mmcr[])
} }
static int p4_generic_events[] = { static int p4_generic_events[] = {
[PERF_COUNT_CPU_CYCLES] = 7, [PERF_COUNT_HW_CPU_CYCLES] = 7,
[PERF_COUNT_INSTRUCTIONS] = 0x1001, [PERF_COUNT_HW_INSTRUCTIONS] = 0x1001,
[PERF_COUNT_CACHE_REFERENCES] = 0x8c10, /* PM_LD_REF_L1 */ [PERF_COUNT_HW_CACHE_REFERENCES] = 0x8c10, /* PM_LD_REF_L1 */
[PERF_COUNT_CACHE_MISSES] = 0x3c10, /* PM_LD_MISS_L1 */ [PERF_COUNT_HW_CACHE_MISSES] = 0x3c10, /* PM_LD_MISS_L1 */
[PERF_COUNT_BRANCH_INSTRUCTIONS] = 0x330, /* PM_BR_ISSUED */ [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x330, /* PM_BR_ISSUED */
[PERF_COUNT_BRANCH_MISSES] = 0x331, /* PM_BR_MPRED_CR */ [PERF_COUNT_HW_BRANCH_MISSES] = 0x331, /* PM_BR_MPRED_CR */
}; };
#define C(x) PERF_COUNT_HW_CACHE_##x #define C(x) PERF_COUNT_HW_CACHE_##x
......
...@@ -606,12 +606,12 @@ static void power5p_disable_pmc(unsigned int pmc, u64 mmcr[]) ...@@ -606,12 +606,12 @@ static void power5p_disable_pmc(unsigned int pmc, u64 mmcr[])
} }
static int power5p_generic_events[] = { static int power5p_generic_events[] = {
[PERF_COUNT_CPU_CYCLES] = 0xf, [PERF_COUNT_HW_CPU_CYCLES] = 0xf,
[PERF_COUNT_INSTRUCTIONS] = 0x100009, [PERF_COUNT_HW_INSTRUCTIONS] = 0x100009,
[PERF_COUNT_CACHE_REFERENCES] = 0x1c10a8, /* LD_REF_L1 */ [PERF_COUNT_HW_CACHE_REFERENCES] = 0x1c10a8, /* LD_REF_L1 */
[PERF_COUNT_CACHE_MISSES] = 0x3c1088, /* LD_MISS_L1 */ [PERF_COUNT_HW_CACHE_MISSES] = 0x3c1088, /* LD_MISS_L1 */
[PERF_COUNT_BRANCH_INSTRUCTIONS] = 0x230e4, /* BR_ISSUED */ [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x230e4, /* BR_ISSUED */
[PERF_COUNT_BRANCH_MISSES] = 0x230e5, /* BR_MPRED_CR */ [PERF_COUNT_HW_BRANCH_MISSES] = 0x230e5, /* BR_MPRED_CR */
}; };
#define C(x) PERF_COUNT_HW_CACHE_##x #define C(x) PERF_COUNT_HW_CACHE_##x
......
...@@ -548,12 +548,12 @@ static void power5_disable_pmc(unsigned int pmc, u64 mmcr[]) ...@@ -548,12 +548,12 @@ static void power5_disable_pmc(unsigned int pmc, u64 mmcr[])
} }
static int power5_generic_events[] = { static int power5_generic_events[] = {
[PERF_COUNT_CPU_CYCLES] = 0xf, [PERF_COUNT_HW_CPU_CYCLES] = 0xf,
[PERF_COUNT_INSTRUCTIONS] = 0x100009, [PERF_COUNT_HW_INSTRUCTIONS] = 0x100009,
[PERF_COUNT_CACHE_REFERENCES] = 0x4c1090, /* LD_REF_L1 */ [PERF_COUNT_HW_CACHE_REFERENCES] = 0x4c1090, /* LD_REF_L1 */
[PERF_COUNT_CACHE_MISSES] = 0x3c1088, /* LD_MISS_L1 */ [PERF_COUNT_HW_CACHE_MISSES] = 0x3c1088, /* LD_MISS_L1 */
[PERF_COUNT_BRANCH_INSTRUCTIONS] = 0x230e4, /* BR_ISSUED */ [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x230e4, /* BR_ISSUED */
[PERF_COUNT_BRANCH_MISSES] = 0x230e5, /* BR_MPRED_CR */ [PERF_COUNT_HW_BRANCH_MISSES] = 0x230e5, /* BR_MPRED_CR */
}; };
#define C(x) PERF_COUNT_HW_CACHE_##x #define C(x) PERF_COUNT_HW_CACHE_##x
......
...@@ -466,12 +466,12 @@ static void p6_disable_pmc(unsigned int pmc, u64 mmcr[]) ...@@ -466,12 +466,12 @@ static void p6_disable_pmc(unsigned int pmc, u64 mmcr[])
} }
static int power6_generic_events[] = { static int power6_generic_events[] = {
[PERF_COUNT_CPU_CYCLES] = 0x1e, [PERF_COUNT_HW_CPU_CYCLES] = 0x1e,
[PERF_COUNT_INSTRUCTIONS] = 2, [PERF_COUNT_HW_INSTRUCTIONS] = 2,
[PERF_COUNT_CACHE_REFERENCES] = 0x280030, /* LD_REF_L1 */ [PERF_COUNT_HW_CACHE_REFERENCES] = 0x280030, /* LD_REF_L1 */
[PERF_COUNT_CACHE_MISSES] = 0x30000c, /* LD_MISS_L1 */ [PERF_COUNT_HW_CACHE_MISSES] = 0x30000c, /* LD_MISS_L1 */
[PERF_COUNT_BRANCH_INSTRUCTIONS] = 0x410a0, /* BR_PRED */ [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x410a0, /* BR_PRED */
[PERF_COUNT_BRANCH_MISSES] = 0x400052, /* BR_MPRED */ [PERF_COUNT_HW_BRANCH_MISSES] = 0x400052, /* BR_MPRED */
}; };
#define C(x) PERF_COUNT_HW_CACHE_##x #define C(x) PERF_COUNT_HW_CACHE_##x
......
...@@ -419,12 +419,12 @@ static void p970_disable_pmc(unsigned int pmc, u64 mmcr[]) ...@@ -419,12 +419,12 @@ static void p970_disable_pmc(unsigned int pmc, u64 mmcr[])
} }
static int ppc970_generic_events[] = { static int ppc970_generic_events[] = {
[PERF_COUNT_CPU_CYCLES] = 7, [PERF_COUNT_HW_CPU_CYCLES] = 7,
[PERF_COUNT_INSTRUCTIONS] = 1, [PERF_COUNT_HW_INSTRUCTIONS] = 1,
[PERF_COUNT_CACHE_REFERENCES] = 0x8810, /* PM_LD_REF_L1 */ [PERF_COUNT_HW_CACHE_REFERENCES] = 0x8810, /* PM_LD_REF_L1 */
[PERF_COUNT_CACHE_MISSES] = 0x3810, /* PM_LD_MISS_L1 */ [PERF_COUNT_HW_CACHE_MISSES] = 0x3810, /* PM_LD_MISS_L1 */
[PERF_COUNT_BRANCH_INSTRUCTIONS] = 0x431, /* PM_BR_ISSUED */ [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x431, /* PM_BR_ISSUED */
[PERF_COUNT_BRANCH_MISSES] = 0x327, /* PM_GRP_BR_MPRED */ [PERF_COUNT_HW_BRANCH_MISSES] = 0x327, /* PM_GRP_BR_MPRED */
}; };
#define C(x) PERF_COUNT_HW_CACHE_##x #define C(x) PERF_COUNT_HW_CACHE_##x
......
...@@ -171,7 +171,7 @@ int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address, ...@@ -171,7 +171,7 @@ int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address,
die("Weird page fault", regs, SIGSEGV); die("Weird page fault", regs, SIGSEGV);
} }
perf_swcounter_event(PERF_COUNT_PAGE_FAULTS, 1, 0, regs, address); perf_swcounter_event(PERF_COUNT_SW_PAGE_FAULTS, 1, 0, regs, address);
/* When running in the kernel we expect faults to occur only to /* When running in the kernel we expect faults to occur only to
* addresses in user space. All other faults represent errors in the * addresses in user space. All other faults represent errors in the
...@@ -312,7 +312,7 @@ int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address, ...@@ -312,7 +312,7 @@ int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address,
} }
if (ret & VM_FAULT_MAJOR) { if (ret & VM_FAULT_MAJOR) {
current->maj_flt++; current->maj_flt++;
perf_swcounter_event(PERF_COUNT_PAGE_FAULTS_MAJ, 1, 0, perf_swcounter_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, 0,
regs, address); regs, address);
#ifdef CONFIG_PPC_SMLPAR #ifdef CONFIG_PPC_SMLPAR
if (firmware_has_feature(FW_FEATURE_CMO)) { if (firmware_has_feature(FW_FEATURE_CMO)) {
...@@ -323,7 +323,7 @@ int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address, ...@@ -323,7 +323,7 @@ int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address,
#endif #endif
} else { } else {
current->min_flt++; current->min_flt++;
perf_swcounter_event(PERF_COUNT_PAGE_FAULTS_MIN, 1, 0, perf_swcounter_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, 0,
regs, address); regs, address);
} }
up_read(&mm->mmap_sem); up_read(&mm->mmap_sem);
......
...@@ -69,13 +69,13 @@ static DEFINE_PER_CPU(struct cpu_hw_counters, cpu_hw_counters) = { ...@@ -69,13 +69,13 @@ static DEFINE_PER_CPU(struct cpu_hw_counters, cpu_hw_counters) = {
*/ */
static const u64 intel_perfmon_event_map[] = static const u64 intel_perfmon_event_map[] =
{ {
[PERF_COUNT_CPU_CYCLES] = 0x003c, [PERF_COUNT_HW_CPU_CYCLES] = 0x003c,
[PERF_COUNT_INSTRUCTIONS] = 0x00c0, [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0,
[PERF_COUNT_CACHE_REFERENCES] = 0x4f2e, [PERF_COUNT_HW_CACHE_REFERENCES] = 0x4f2e,
[PERF_COUNT_CACHE_MISSES] = 0x412e, [PERF_COUNT_HW_CACHE_MISSES] = 0x412e,
[PERF_COUNT_BRANCH_INSTRUCTIONS] = 0x00c4, [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x00c4,
[PERF_COUNT_BRANCH_MISSES] = 0x00c5, [PERF_COUNT_HW_BRANCH_MISSES] = 0x00c5,
[PERF_COUNT_BUS_CYCLES] = 0x013c, [PERF_COUNT_HW_BUS_CYCLES] = 0x013c,
}; };
static u64 intel_pmu_event_map(int event) static u64 intel_pmu_event_map(int event)
...@@ -485,12 +485,12 @@ static const u64 amd_0f_hw_cache_event_ids ...@@ -485,12 +485,12 @@ static const u64 amd_0f_hw_cache_event_ids
*/ */
static const u64 amd_perfmon_event_map[] = static const u64 amd_perfmon_event_map[] =
{ {
[PERF_COUNT_CPU_CYCLES] = 0x0076, [PERF_COUNT_HW_CPU_CYCLES] = 0x0076,
[PERF_COUNT_INSTRUCTIONS] = 0x00c0, [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0,
[PERF_COUNT_CACHE_REFERENCES] = 0x0080, [PERF_COUNT_HW_CACHE_REFERENCES] = 0x0080,
[PERF_COUNT_CACHE_MISSES] = 0x0081, [PERF_COUNT_HW_CACHE_MISSES] = 0x0081,
[PERF_COUNT_BRANCH_INSTRUCTIONS] = 0x00c4, [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x00c4,
[PERF_COUNT_BRANCH_MISSES] = 0x00c5, [PERF_COUNT_HW_BRANCH_MISSES] = 0x00c5,
}; };
static u64 amd_pmu_event_map(int event) 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,11 +970,11 @@ fixed_mode_idx(struct perf_counter *counter, struct hw_perf_counter *hwc)
event = hwc->config & ARCH_PERFMON_EVENT_MASK; event = hwc->config & ARCH_PERFMON_EVENT_MASK;
if (unlikely(event == x86_pmu.event_map(PERF_COUNT_INSTRUCTIONS))) if (unlikely(event == x86_pmu.event_map(PERF_COUNT_HW_INSTRUCTIONS)))
return X86_PMC_IDX_FIXED_INSTRUCTIONS; return X86_PMC_IDX_FIXED_INSTRUCTIONS;
if (unlikely(event == x86_pmu.event_map(PERF_COUNT_CPU_CYCLES))) if (unlikely(event == x86_pmu.event_map(PERF_COUNT_HW_CPU_CYCLES)))
return X86_PMC_IDX_FIXED_CPU_CYCLES; return X86_PMC_IDX_FIXED_CPU_CYCLES;
if (unlikely(event == x86_pmu.event_map(PERF_COUNT_BUS_CYCLES))) if (unlikely(event == x86_pmu.event_map(PERF_COUNT_HW_BUS_CYCLES)))
return X86_PMC_IDX_FIXED_BUS_CYCLES; return X86_PMC_IDX_FIXED_BUS_CYCLES;
return -1; return -1;
......
...@@ -1045,7 +1045,7 @@ do_page_fault(struct pt_regs *regs, unsigned long error_code) ...@@ -1045,7 +1045,7 @@ do_page_fault(struct pt_regs *regs, unsigned long error_code)
if (unlikely(error_code & PF_RSVD)) if (unlikely(error_code & PF_RSVD))
pgtable_bad(regs, error_code, address); pgtable_bad(regs, error_code, address);
perf_swcounter_event(PERF_COUNT_PAGE_FAULTS, 1, 0, regs, address); perf_swcounter_event(PERF_COUNT_SW_PAGE_FAULTS, 1, 0, regs, address);
/* /*
* If we're in an interrupt, have no user context or are running * If we're in an interrupt, have no user context or are running
...@@ -1142,11 +1142,11 @@ do_page_fault(struct pt_regs *regs, unsigned long error_code) ...@@ -1142,11 +1142,11 @@ do_page_fault(struct pt_regs *regs, unsigned long error_code)
if (fault & VM_FAULT_MAJOR) { if (fault & VM_FAULT_MAJOR) {
tsk->maj_flt++; tsk->maj_flt++;
perf_swcounter_event(PERF_COUNT_PAGE_FAULTS_MAJ, 1, 0, perf_swcounter_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, 0,
regs, address); regs, address);
} else { } else {
tsk->min_flt++; tsk->min_flt++;
perf_swcounter_event(PERF_COUNT_PAGE_FAULTS_MIN, 1, 0, perf_swcounter_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, 0,
regs, address); regs, address);
} }
......
...@@ -42,15 +42,15 @@ enum perf_hw_id { ...@@ -42,15 +42,15 @@ enum perf_hw_id {
/* /*
* Common hardware events, generalized by the kernel: * Common hardware events, generalized by the kernel:
*/ */
PERF_COUNT_CPU_CYCLES = 0, PERF_COUNT_HW_CPU_CYCLES = 0,
PERF_COUNT_INSTRUCTIONS = 1, PERF_COUNT_HW_INSTRUCTIONS = 1,
PERF_COUNT_CACHE_REFERENCES = 2, PERF_COUNT_HW_CACHE_REFERENCES = 2,
PERF_COUNT_CACHE_MISSES = 3, PERF_COUNT_HW_CACHE_MISSES = 3,
PERF_COUNT_BRANCH_INSTRUCTIONS = 4, PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 4,
PERF_COUNT_BRANCH_MISSES = 5, PERF_COUNT_HW_BRANCH_MISSES = 5,
PERF_COUNT_BUS_CYCLES = 6, PERF_COUNT_HW_BUS_CYCLES = 6,
PERF_HW_EVENTS_MAX, /* non ABI */ PERF_COUNT_HW_MAX, /* non ABI */
}; };
/* /*
...@@ -93,15 +93,15 @@ enum perf_hw_cache_op_result_id { ...@@ -93,15 +93,15 @@ enum perf_hw_cache_op_result_id {
* well): * well):
*/ */
enum perf_sw_ids { enum perf_sw_ids {
PERF_COUNT_CPU_CLOCK = 0, PERF_COUNT_SW_CPU_CLOCK = 0,
PERF_COUNT_TASK_CLOCK = 1, PERF_COUNT_SW_TASK_CLOCK = 1,
PERF_COUNT_PAGE_FAULTS = 2, PERF_COUNT_SW_PAGE_FAULTS = 2,
PERF_COUNT_CONTEXT_SWITCHES = 3, PERF_COUNT_SW_CONTEXT_SWITCHES = 3,
PERF_COUNT_CPU_MIGRATIONS = 4, PERF_COUNT_SW_CPU_MIGRATIONS = 4,
PERF_COUNT_PAGE_FAULTS_MIN = 5, PERF_COUNT_SW_PAGE_FAULTS_MIN = 5,
PERF_COUNT_PAGE_FAULTS_MAJ = 6, PERF_COUNT_SW_PAGE_FAULTS_MAJ = 6,
PERF_SW_EVENTS_MAX, /* non ABI */ PERF_COUNT_SW_MAX, /* non ABI */
}; };
/* /*
......
...@@ -1024,7 +1024,7 @@ void perf_counter_task_sched_out(struct task_struct *task, ...@@ -1024,7 +1024,7 @@ void perf_counter_task_sched_out(struct task_struct *task,
int do_switch = 1; int do_switch = 1;
regs = task_pt_regs(task); regs = task_pt_regs(task);
perf_swcounter_event(PERF_COUNT_CONTEXT_SWITCHES, 1, 1, regs, 0); perf_swcounter_event(PERF_COUNT_SW_CONTEXT_SWITCHES, 1, 1, regs, 0);
if (likely(!ctx || !cpuctx->task_ctx)) if (likely(!ctx || !cpuctx->task_ctx))
return; return;
...@@ -3411,13 +3411,13 @@ void perf_counter_task_migration(struct task_struct *task, int cpu) ...@@ -3411,13 +3411,13 @@ void perf_counter_task_migration(struct task_struct *task, int cpu)
struct perf_counter_context *ctx; struct perf_counter_context *ctx;
perf_swcounter_ctx_event(&cpuctx->ctx, PERF_TYPE_SOFTWARE, perf_swcounter_ctx_event(&cpuctx->ctx, PERF_TYPE_SOFTWARE,
PERF_COUNT_CPU_MIGRATIONS, PERF_COUNT_SW_CPU_MIGRATIONS,
1, 1, NULL, 0); 1, 1, NULL, 0);
ctx = perf_pin_task_context(task); ctx = perf_pin_task_context(task);
if (ctx) { if (ctx) {
perf_swcounter_ctx_event(ctx, PERF_TYPE_SOFTWARE, perf_swcounter_ctx_event(ctx, PERF_TYPE_SOFTWARE,
PERF_COUNT_CPU_MIGRATIONS, PERF_COUNT_SW_CPU_MIGRATIONS,
1, 1, NULL, 0); 1, 1, NULL, 0);
perf_unpin_context(ctx); perf_unpin_context(ctx);
} }
...@@ -3475,11 +3475,11 @@ static const struct pmu *sw_perf_counter_init(struct perf_counter *counter) ...@@ -3475,11 +3475,11 @@ static const struct pmu *sw_perf_counter_init(struct perf_counter *counter)
* events. * events.
*/ */
switch (counter->attr.config) { switch (counter->attr.config) {
case PERF_COUNT_CPU_CLOCK: case PERF_COUNT_SW_CPU_CLOCK:
pmu = &perf_ops_cpu_clock; pmu = &perf_ops_cpu_clock;
break; break;
case PERF_COUNT_TASK_CLOCK: case PERF_COUNT_SW_TASK_CLOCK:
/* /*
* If the user instantiates this as a per-cpu counter, * If the user instantiates this as a per-cpu counter,
* use the cpu_clock counter instead. * use the cpu_clock counter instead.
...@@ -3490,11 +3490,11 @@ static const struct pmu *sw_perf_counter_init(struct perf_counter *counter) ...@@ -3490,11 +3490,11 @@ static const struct pmu *sw_perf_counter_init(struct perf_counter *counter)
pmu = &perf_ops_cpu_clock; pmu = &perf_ops_cpu_clock;
break; break;
case PERF_COUNT_PAGE_FAULTS: case PERF_COUNT_SW_PAGE_FAULTS:
case PERF_COUNT_PAGE_FAULTS_MIN: case PERF_COUNT_SW_PAGE_FAULTS_MIN:
case PERF_COUNT_PAGE_FAULTS_MAJ: case PERF_COUNT_SW_PAGE_FAULTS_MAJ:
case PERF_COUNT_CONTEXT_SWITCHES: case PERF_COUNT_SW_CONTEXT_SWITCHES:
case PERF_COUNT_CPU_MIGRATIONS: case PERF_COUNT_SW_CPU_MIGRATIONS:
pmu = &perf_ops_generic; pmu = &perf_ops_generic;
break; break;
} }
......
...@@ -378,12 +378,12 @@ static void create_counter(int counter, int cpu, pid_t pid) ...@@ -378,12 +378,12 @@ static void create_counter(int counter, int cpu, pid_t pid)
* is always available even if no PMU support: * is always available even if no PMU support:
*/ */
if (attr->type == PERF_TYPE_HARDWARE if (attr->type == PERF_TYPE_HARDWARE
&& attr->config == PERF_COUNT_CPU_CYCLES) { && attr->config == PERF_COUNT_HW_CPU_CYCLES) {
if (verbose) if (verbose)
warning(" ... trying to fall back to cpu-clock-ticks\n"); warning(" ... trying to fall back to cpu-clock-ticks\n");
attr->type = PERF_TYPE_SOFTWARE; attr->type = PERF_TYPE_SOFTWARE;
attr->config = PERF_COUNT_CPU_CLOCK; attr->config = PERF_COUNT_SW_CPU_CLOCK;
goto try_again; goto try_again;
} }
printf("\n"); printf("\n");
......
...@@ -46,15 +46,16 @@ ...@@ -46,15 +46,16 @@
static struct perf_counter_attr default_attrs[MAX_COUNTERS] = { static struct perf_counter_attr default_attrs[MAX_COUNTERS] = {
{ .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_TASK_CLOCK }, { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_TASK_CLOCK },
{ .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_CONTEXT_SWITCHES }, { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_CONTEXT_SWITCHES},
{ .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_CPU_MIGRATIONS }, { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_CPU_MIGRATIONS },
{ .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_PAGE_FAULTS }, { .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_PAGE_FAULTS },
{ .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_CPU_CYCLES }, { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_CPU_CYCLES },
{ .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_INSTRUCTIONS }, { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_INSTRUCTIONS },
{ .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_CACHE_REFERENCES }, { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_CACHE_REFERENCES},
{ .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_CACHE_MISSES }, { .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_CACHE_MISSES },
}; };
static int system_wide = 0; static int system_wide = 0;
...@@ -120,10 +121,10 @@ static inline int nsec_counter(int counter) ...@@ -120,10 +121,10 @@ static inline int nsec_counter(int counter)
if (attrs[counter].type != PERF_TYPE_SOFTWARE) if (attrs[counter].type != PERF_TYPE_SOFTWARE)
return 0; return 0;
if (attrs[counter].config == PERF_COUNT_CPU_CLOCK) if (attrs[counter].config == PERF_COUNT_SW_CPU_CLOCK)
return 1; return 1;
if (attrs[counter].config == PERF_COUNT_TASK_CLOCK) if (attrs[counter].config == PERF_COUNT_SW_TASK_CLOCK)
return 1; return 1;
return 0; return 0;
...@@ -176,10 +177,10 @@ static void read_counter(int counter) ...@@ -176,10 +177,10 @@ static void read_counter(int counter)
* Save the full runtime - to allow normalization during printout: * Save the full runtime - to allow normalization during printout:
*/ */
if (attrs[counter].type == PERF_TYPE_SOFTWARE && if (attrs[counter].type == PERF_TYPE_SOFTWARE &&
attrs[counter].config == PERF_COUNT_TASK_CLOCK) attrs[counter].config == PERF_COUNT_SW_TASK_CLOCK)
runtime_nsecs = count[0]; runtime_nsecs = count[0];
if (attrs[counter].type == PERF_TYPE_HARDWARE && if (attrs[counter].type == PERF_TYPE_HARDWARE &&
attrs[counter].config == PERF_COUNT_CPU_CYCLES) attrs[counter].config == PERF_COUNT_HW_CPU_CYCLES)
runtime_cycles = count[0]; runtime_cycles = count[0];
} }
...@@ -206,7 +207,7 @@ static void print_counter(int counter) ...@@ -206,7 +207,7 @@ static void print_counter(int counter)
fprintf(stderr, " %14.6f %-20s", fprintf(stderr, " %14.6f %-20s",
msecs, event_name(counter)); msecs, event_name(counter));
if (attrs[counter].type == PERF_TYPE_SOFTWARE && if (attrs[counter].type == PERF_TYPE_SOFTWARE &&
attrs[counter].config == PERF_COUNT_TASK_CLOCK) { attrs[counter].config == PERF_COUNT_SW_TASK_CLOCK) {
if (walltime_nsecs) if (walltime_nsecs)
fprintf(stderr, " # %11.3f CPU utilization factor", fprintf(stderr, " # %11.3f CPU utilization factor",
...@@ -220,7 +221,7 @@ static void print_counter(int counter) ...@@ -220,7 +221,7 @@ static void print_counter(int counter)
(double)count[0]/runtime_nsecs*1000.0); (double)count[0]/runtime_nsecs*1000.0);
if (runtime_cycles && if (runtime_cycles &&
attrs[counter].type == PERF_TYPE_HARDWARE && attrs[counter].type == PERF_TYPE_HARDWARE &&
attrs[counter].config == PERF_COUNT_INSTRUCTIONS) { attrs[counter].config == PERF_COUNT_HW_INSTRUCTIONS) {
fprintf(stderr, " # %1.3f per cycle", fprintf(stderr, " # %1.3f per cycle",
(double)count[0] / (double)runtime_cycles); (double)count[0] / (double)runtime_cycles);
......
...@@ -562,13 +562,13 @@ static void start_counter(int i, int counter) ...@@ -562,13 +562,13 @@ static void start_counter(int i, int counter)
* is always available even if no PMU support: * is always available even if no PMU support:
*/ */
if (attr->type == PERF_TYPE_HARDWARE if (attr->type == PERF_TYPE_HARDWARE
&& attr->config == PERF_COUNT_CPU_CYCLES) { && attr->config == PERF_COUNT_HW_CPU_CYCLES) {
if (verbose) if (verbose)
warning(" ... trying to fall back to cpu-clock-ticks\n"); warning(" ... trying to fall back to cpu-clock-ticks\n");
attr->type = PERF_TYPE_SOFTWARE; attr->type = PERF_TYPE_SOFTWARE;
attr->config = PERF_COUNT_CPU_CLOCK; attr->config = PERF_COUNT_SW_CPU_CLOCK;
goto try_again; goto try_again;
} }
printf("\n"); printf("\n");
......
...@@ -99,13 +99,13 @@ enum hw_event_ids { ...@@ -99,13 +99,13 @@ enum hw_event_ids {
/* /*
* Common hardware events, generalized by the kernel: * Common hardware events, generalized by the kernel:
*/ */
PERF_COUNT_CPU_CYCLES = 0, PERF_COUNT_HW_CPU_CYCLES = 0,
PERF_COUNT_INSTRUCTIONS = 1, PERF_COUNT_HW_INSTRUCTIONS = 1,
PERF_COUNT_CACHE_REFERENCES = 2, PERF_COUNT_HW_CACHE_REFERENCES = 2,
PERF_COUNT_CACHE_MISSES = 3, PERF_COUNT_HW_CACHE_MISSES = 3,
PERF_COUNT_BRANCH_INSTRUCTIONS = 4, PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 4,
PERF_COUNT_BRANCH_MISSES = 5, PERF_COUNT_HW_BRANCH_MISSES = 5,
PERF_COUNT_BUS_CYCLES = 6, PERF_COUNT_HW_BUS_CYCLES = 6,
}; };
These are standardized types of events that work relatively uniformly These are standardized types of events that work relatively uniformly
...@@ -130,13 +130,13 @@ software events, selected by 'event_id': ...@@ -130,13 +130,13 @@ software events, selected by 'event_id':
* well): * well):
*/ */
enum sw_event_ids { enum sw_event_ids {
PERF_COUNT_CPU_CLOCK = 0, PERF_COUNT_SW_CPU_CLOCK = 0,
PERF_COUNT_TASK_CLOCK = 1, PERF_COUNT_SW_TASK_CLOCK = 1,
PERF_COUNT_PAGE_FAULTS = 2, PERF_COUNT_SW_PAGE_FAULTS = 2,
PERF_COUNT_CONTEXT_SWITCHES = 3, PERF_COUNT_SW_CONTEXT_SWITCHES = 3,
PERF_COUNT_CPU_MIGRATIONS = 4, PERF_COUNT_SW_CPU_MIGRATIONS = 4,
PERF_COUNT_PAGE_FAULTS_MIN = 5, PERF_COUNT_SW_PAGE_FAULTS_MIN = 5,
PERF_COUNT_PAGE_FAULTS_MAJ = 6, PERF_COUNT_SW_PAGE_FAULTS_MAJ = 6,
}; };
Counters of the type PERF_TYPE_TRACEPOINT are available when the ftrace event Counters of the type PERF_TYPE_TRACEPOINT are available when the ftrace event
......
...@@ -22,26 +22,26 @@ struct event_symbol { ...@@ -22,26 +22,26 @@ struct event_symbol {
#define CR(x, y) .type = PERF_TYPE_##x, .config = y #define CR(x, y) .type = PERF_TYPE_##x, .config = y
static struct event_symbol event_symbols[] = { static struct event_symbol event_symbols[] = {
{ C(HARDWARE, CPU_CYCLES), "cpu-cycles", }, { C(HARDWARE, HW_CPU_CYCLES), "cpu-cycles", },
{ C(HARDWARE, CPU_CYCLES), "cycles", }, { C(HARDWARE, HW_CPU_CYCLES), "cycles", },
{ C(HARDWARE, INSTRUCTIONS), "instructions", }, { C(HARDWARE, HW_INSTRUCTIONS), "instructions", },
{ C(HARDWARE, CACHE_REFERENCES), "cache-references", }, { C(HARDWARE, HW_CACHE_REFERENCES), "cache-references", },
{ C(HARDWARE, CACHE_MISSES), "cache-misses", }, { C(HARDWARE, HW_CACHE_MISSES), "cache-misses", },
{ C(HARDWARE, BRANCH_INSTRUCTIONS), "branch-instructions", }, { C(HARDWARE, HW_BRANCH_INSTRUCTIONS),"branch-instructions", },
{ C(HARDWARE, BRANCH_INSTRUCTIONS), "branches", }, { C(HARDWARE, HW_BRANCH_INSTRUCTIONS),"branches", },
{ C(HARDWARE, BRANCH_MISSES), "branch-misses", }, { C(HARDWARE, HW_BRANCH_MISSES), "branch-misses", },
{ C(HARDWARE, BUS_CYCLES), "bus-cycles", }, { C(HARDWARE, HW_BUS_CYCLES), "bus-cycles", },
{ C(SOFTWARE, CPU_CLOCK), "cpu-clock", }, { C(SOFTWARE, SW_CPU_CLOCK), "cpu-clock", },
{ C(SOFTWARE, TASK_CLOCK), "task-clock", }, { C(SOFTWARE, SW_TASK_CLOCK), "task-clock", },
{ C(SOFTWARE, PAGE_FAULTS), "page-faults", }, { C(SOFTWARE, SW_PAGE_FAULTS), "page-faults", },
{ C(SOFTWARE, PAGE_FAULTS), "faults", }, { C(SOFTWARE, SW_PAGE_FAULTS), "faults", },
{ C(SOFTWARE, PAGE_FAULTS_MIN), "minor-faults", }, { C(SOFTWARE, SW_PAGE_FAULTS_MIN), "minor-faults", },
{ C(SOFTWARE, PAGE_FAULTS_MAJ), "major-faults", }, { C(SOFTWARE, SW_PAGE_FAULTS_MAJ), "major-faults", },
{ C(SOFTWARE, CONTEXT_SWITCHES), "context-switches", }, { C(SOFTWARE, SW_CONTEXT_SWITCHES), "context-switches", },
{ C(SOFTWARE, CONTEXT_SWITCHES), "cs", }, { C(SOFTWARE, SW_CONTEXT_SWITCHES), "cs", },
{ C(SOFTWARE, CPU_MIGRATIONS), "cpu-migrations", }, { C(SOFTWARE, SW_CPU_MIGRATIONS), "cpu-migrations", },
{ C(SOFTWARE, CPU_MIGRATIONS), "migrations", }, { C(SOFTWARE, SW_CPU_MIGRATIONS), "migrations", },
}; };
#define __PERF_COUNTER_FIELD(config, name) \ #define __PERF_COUNTER_FIELD(config, name) \
...@@ -107,7 +107,7 @@ char *event_name(int counter) ...@@ -107,7 +107,7 @@ char *event_name(int counter)
switch (type) { switch (type) {
case PERF_TYPE_HARDWARE: case PERF_TYPE_HARDWARE:
if (config < PERF_HW_EVENTS_MAX) if (config < PERF_COUNT_HW_MAX)
return hw_event_names[config]; return hw_event_names[config];
return "unknown-hardware"; return "unknown-hardware";
...@@ -136,7 +136,7 @@ char *event_name(int counter) ...@@ -136,7 +136,7 @@ char *event_name(int counter)
} }
case PERF_TYPE_SOFTWARE: case PERF_TYPE_SOFTWARE:
if (config < PERF_SW_EVENTS_MAX) if (config < PERF_COUNT_SW_MAX)
return sw_event_names[config]; return sw_event_names[config];
return "unknown-software"; return "unknown-software";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment