On 05/27/2010 06:03 AM, Deng-Cheng Zhu wrote:
Oprofile module needs a function to get the number of pmu counters in its
high level interfaces.
Signed-off-by: Deng-Cheng Zhu<dengcheng.zhu@xxxxxxxxx>
---
arch/mips/include/asm/pmu.h | 1 +
arch/mips/kernel/perf_event.c | 6 ++++++
2 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/arch/mips/include/asm/pmu.h b/arch/mips/include/asm/pmu.h
index 16d4fcd..023a915 100644
--- a/arch/mips/include/asm/pmu.h
+++ b/arch/mips/include/asm/pmu.h
@@ -114,5 +114,6 @@ enum mips_pmu_id {
extern const char *mips_pmu_names[];
extern enum mips_pmu_id mipspmu_get_pmu_id(void);
+extern int mipspmu_get_max_events(void);
#endif /* __MIPS_PMU_H__ */
diff --git a/arch/mips/kernel/perf_event.c b/arch/mips/kernel/perf_event.c
index f05e2b1..dc3a553 100644
--- a/arch/mips/kernel/perf_event.c
+++ b/arch/mips/kernel/perf_event.c
@@ -140,6 +140,12 @@ enum mips_pmu_id mipspmu_get_pmu_id(void)
}
EXPORT_SYMBOL_GPL(mipspmu_get_pmu_id);
+int mipspmu_get_max_events(void)
+{
+ return mipspmu ? mipspmu->num_counters : 0;
+}
+EXPORT_SYMBOL_GPL(mipspmu_get_max_events);
+
Why is it called 'max_events' when it is returning the number of
counters? How about mipspmu_get_max_counters?
Do we even need this accessor?
Why not just query it from the struct mips_pmu? Don't you need the
mipspmu structure anyhow to be able to use the counters?
David Daney