perf: add arch-dependent get_num_counters function
Change-Id: I2230af87e0c764d97115e833dccb1842946c1b94 Fujitsu: POSTK_DEBUG_ARCH_DEP_109
This commit is contained in:
@ -183,3 +183,8 @@ int ihk_mc_perfctr_fixed_init(int counter, int mode)
|
|||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ihk_mc_perf_get_num_counters(void)
|
||||||
|
{
|
||||||
|
return cpu_pmu.per_cpu[ihk_mc_get_processor_id()].num_events;
|
||||||
|
}
|
||||||
|
|||||||
@ -498,3 +498,8 @@ int ihk_mc_perfctr_alloc_counter(unsigned int *type, unsigned long *config, unsi
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ihk_mc_perf_get_num_counters(void)
|
||||||
|
{
|
||||||
|
return NUM_PERF_COUNTERS;
|
||||||
|
}
|
||||||
|
|||||||
@ -3768,9 +3768,10 @@ perf_counter_alloc(struct thread *thread)
|
|||||||
{
|
{
|
||||||
int ret = -EINVAL;
|
int ret = -EINVAL;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
const int counters = ihk_mc_perf_get_num_counters();
|
||||||
|
|
||||||
// find avail generic counter
|
// find avail generic counter
|
||||||
for (i = 0; i < NUM_PERF_COUNTERS; i++) {
|
for (i = 0; i < counters; i++) {
|
||||||
if(!(thread->pmc_alloc_map & (1 << i))) {
|
if(!(thread->pmc_alloc_map & (1 << i))) {
|
||||||
ret = i;
|
ret = i;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -72,6 +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_perf_get_num_counters(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user