perf: add arch-dependent get_num_counters function

Change-Id: I2230af87e0c764d97115e833dccb1842946c1b94
Fujitsu: POSTK_DEBUG_ARCH_DEP_109
This commit is contained in:
Dominique Martinet
2019-01-29 11:33:41 +09:00
parent 2b254f02f8
commit 03cadbcba2
4 changed files with 13 additions and 1 deletions

View File

@ -183,3 +183,8 @@ int ihk_mc_perfctr_fixed_init(int counter, int mode)
{
return -1;
}
int ihk_mc_perf_get_num_counters(void)
{
return cpu_pmu.per_cpu[ihk_mc_get_processor_id()].num_events;
}

View File

@ -498,3 +498,8 @@ int ihk_mc_perfctr_alloc_counter(unsigned int *type, unsigned long *config, unsi
return ret;
}
int ihk_mc_perf_get_num_counters(void)
{
return NUM_PERF_COUNTERS;
}

View File

@ -3768,9 +3768,10 @@ perf_counter_alloc(struct thread *thread)
{
int ret = -EINVAL;
int i = 0;
const int counters = ihk_mc_perf_get_num_counters();
// 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))) {
ret = i;
break;

View File

@ -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_msr(int counter);
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