pmu: move cpu cycle event type comparison to arch dependent code.
Change-Id: If069f8893fe59e3517569b74b3a27b5267ebac03
This commit is contained in:
@@ -184,25 +184,13 @@ int ihk_mc_perfctr_read_mask(unsigned long counter_mask, unsigned long *value)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ihk_mc_perfctr_alloc(struct thread *thread, int cpu_cycles)
|
int ihk_mc_perfctr_alloc(struct thread *thread, struct mc_perf_event *event)
|
||||||
{
|
{
|
||||||
int ret = -EINVAL;
|
|
||||||
int i = 1;
|
|
||||||
const int counters = ihk_mc_perf_get_num_counters();
|
const int counters = ihk_mc_perf_get_num_counters();
|
||||||
|
|
||||||
// Counter 0 is only used for CPU cycles on ARM
|
return cpu_pmu.get_event_idx(counters,
|
||||||
if (cpu_cycles) {
|
thread->pmc_alloc_map,
|
||||||
i = 0;
|
event->hw_config);
|
||||||
}
|
|
||||||
|
|
||||||
for (; i < counters; i++) {
|
|
||||||
if (!(thread->pmc_alloc_map & (1 << i))) {
|
|
||||||
ret = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long ihk_mc_perfctr_read(int counter)
|
unsigned long ihk_mc_perfctr_read(int counter)
|
||||||
|
|||||||
@@ -377,7 +377,7 @@ int ihk_mc_perfctr_read_mask(unsigned long counter_mask, unsigned long *value)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ihk_mc_perfctr_alloc(struct thread *thread, int cpu_cycles)
|
int ihk_mc_perfctr_alloc(struct thread *thread, struct mc_perf_event *event)
|
||||||
{
|
{
|
||||||
int ret = -EINVAL;
|
int ret = -EINVAL;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|||||||
@@ -4187,9 +4187,7 @@ SYSCALL_DECLARE(perf_event_open)
|
|||||||
|
|
||||||
event->pid = pid;
|
event->pid = pid;
|
||||||
|
|
||||||
counter_idx = ihk_mc_perfctr_alloc(thread,
|
counter_idx = ihk_mc_perfctr_alloc(thread, event);
|
||||||
(attr->type == PERF_TYPE_HARDWARE &&
|
|
||||||
attr->config == PERF_COUNT_HW_CPU_CYCLES));
|
|
||||||
if (counter_idx < 0) {
|
if (counter_idx < 0) {
|
||||||
return counter_idx;
|
return counter_idx;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ int ihk_mc_perfctr_read_mask(unsigned long counter_mask, unsigned long *value);
|
|||||||
unsigned long ihk_mc_perfctr_read(int counter);
|
unsigned long ihk_mc_perfctr_read(int counter);
|
||||||
unsigned long ihk_mc_perfctr_read_msr(int counter);
|
unsigned long ihk_mc_perfctr_read_msr(int counter);
|
||||||
int ihk_mc_perfctr_alloc_counter(unsigned int *type, unsigned long *config, unsigned long pmc_status);
|
int ihk_mc_perfctr_alloc_counter(unsigned int *type, unsigned long *config, unsigned long pmc_status);
|
||||||
int ihk_mc_perfctr_alloc(struct thread *thread, int cpu_cycles);
|
int ihk_mc_perfctr_alloc(struct thread *thread, struct mc_perf_event *event);
|
||||||
int ihk_mc_perf_counter_mask_check(unsigned long counter_mask);
|
int ihk_mc_perf_counter_mask_check(unsigned long counter_mask);
|
||||||
int ihk_mc_perf_get_num_counters(void);
|
int ihk_mc_perf_get_num_counters(void);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user