perf: Add helper function to return number of counters

The number of counters for the registered pmu is needed in a few places
so provide a helper function that returns this number.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Tested-by: Will Deacon <will.deacon@arm.com>
Acked-by: Paul Mundt <lethal@linux-sh.org>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Robert Richter <robert.richter@amd.com>
This commit is contained in:
Matt Fleming
2010-09-27 20:22:24 +01:00
committed by Robert Richter
parent 4cbe75be5c
commit 3bf101ba42
4 changed files with 34 additions and 13 deletions

View File

@@ -59,6 +59,15 @@ static inline int sh_pmu_initialized(void)
return !!sh_pmu;
}
int perf_num_counters(void)
{
if (!sh_pmu)
return 0;
return sh_pmu->num_events;
}
EXPORT_SYMBOL_GPL(perf_num_counters);
/*
* Release the PMU if this is the last perf_event.
*/