pmu: add ihk_mc_perfctr_value function
Change-Id: I88d25586dd470737a3eac4c3a4f1955ae6e41d64
This commit is contained in:
@ -198,6 +198,14 @@ unsigned long ihk_mc_perfctr_read(int counter)
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned long ihk_mc_perfctr_value(int counter, unsigned long correction)
|
||||||
|
{
|
||||||
|
unsigned long count = ihk_mc_perfctr_read(counter) + correction;
|
||||||
|
|
||||||
|
count &= ((1UL << 32) - 1);
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
int ihk_mc_perfctr_alloc_counter(unsigned int *type, unsigned long *config,
|
int ihk_mc_perfctr_alloc_counter(unsigned int *type, unsigned long *config,
|
||||||
unsigned long pmc_status)
|
unsigned long pmc_status)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -421,6 +421,14 @@ unsigned long ihk_mc_perfctr_read(int counter)
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned long ihk_mc_perfctr_value(int counter, unsigned long correction)
|
||||||
|
{
|
||||||
|
unsigned long count = ihk_mc_perfctr_read(counter) + correction;
|
||||||
|
|
||||||
|
count &= 0x000000ffffffffffL;
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
// read by rdmsr
|
// read by rdmsr
|
||||||
unsigned long ihk_mc_perfctr_read_msr(int counter)
|
unsigned long ihk_mc_perfctr_read_msr(int counter)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -3723,8 +3723,8 @@ unsigned long perf_event_read_value(struct mc_perf_event *event)
|
|||||||
int counter_id = event->counter_id;
|
int counter_id = event->counter_id;
|
||||||
|
|
||||||
if(event->pid == 0) {
|
if(event->pid == 0) {
|
||||||
pmc_count = ihk_mc_perfctr_read(counter_id) + event->attr.sample_freq;
|
pmc_count = ihk_mc_perfctr_value(counter_id,
|
||||||
pmc_count &= 0x000000ffffffffffL; // 40bit MASK
|
event->attr.sample_freq);
|
||||||
}
|
}
|
||||||
|
|
||||||
rtn_count += event->count + pmc_count;
|
rtn_count += event->count + pmc_count;
|
||||||
|
|||||||
@ -70,6 +70,7 @@ int ihk_mc_perfctr_reset(int counter);
|
|||||||
int ihk_mc_perfctr_set(int counter, long value);
|
int ihk_mc_perfctr_set(int counter, long value);
|
||||||
int ihk_mc_perfctr_read_mask(unsigned long counter_mask, unsigned long *value);
|
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_value(int counter, unsigned long correction);
|
||||||
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, struct mc_perf_event *event);
|
int ihk_mc_perfctr_alloc(struct thread *thread, struct mc_perf_event *event);
|
||||||
|
|||||||
Reference in New Issue
Block a user