diff options
author | Will Deacon <will.deacon@arm.com> | 2010-04-30 06:34:26 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-05-17 06:53:58 -0400 |
commit | 929f5199448a67d41bb249d58815ef77bcd53622 (patch) | |
tree | edb796c49205561ef98abb73f340e900225146dc /arch | |
parent | 49e6a32f2f0876b6267584d9c7e0e213bca6e2b8 (diff) |
ARM: 6071/1: perf-events: allow modules to query the number of hardware counters
For OProfile to initialise oprofilefs correctly, it needs to know
the number of counters it can represent.
This patch adds a function to the ARM perf-events backend to return
the number of hardware counters available for the current PMU.
Cc: Jamie Iles <jamie.iles@picochip.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/include/asm/perf_event.h | 3 | ||||
-rw-r--r-- | arch/arm/kernel/perf_event.c | 12 |
2 files changed, 15 insertions, 0 deletions
diff --git a/arch/arm/include/asm/perf_event.h b/arch/arm/include/asm/perf_event.h index fa4b32625d37..48837e6d8887 100644 --- a/arch/arm/include/asm/perf_event.h +++ b/arch/arm/include/asm/perf_event.h | |||
@@ -42,4 +42,7 @@ enum arm_perf_pmu_ids { | |||
42 | extern enum arm_perf_pmu_ids | 42 | extern enum arm_perf_pmu_ids |
43 | armpmu_get_pmu_id(void); | 43 | armpmu_get_pmu_id(void); |
44 | 44 | ||
45 | extern int | ||
46 | armpmu_get_max_events(void); | ||
47 | |||
45 | #endif /* __ARM_PERF_EVENT_H__ */ | 48 | #endif /* __ARM_PERF_EVENT_H__ */ |
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c index 381f1211233e..c45768614c8a 100644 --- a/arch/arm/kernel/perf_event.c +++ b/arch/arm/kernel/perf_event.c | |||
@@ -111,6 +111,18 @@ armpmu_get_pmu_id(void) | |||
111 | } | 111 | } |
112 | EXPORT_SYMBOL_GPL(armpmu_get_pmu_id); | 112 | EXPORT_SYMBOL_GPL(armpmu_get_pmu_id); |
113 | 113 | ||
114 | int | ||
115 | armpmu_get_max_events(void) | ||
116 | { | ||
117 | int max_events = 0; | ||
118 | |||
119 | if (armpmu != NULL) | ||
120 | max_events = armpmu->num_events; | ||
121 | |||
122 | return max_events; | ||
123 | } | ||
124 | EXPORT_SYMBOL_GPL(armpmu_get_max_events); | ||
125 | |||
114 | #define HW_OP_UNSUPPORTED 0xFFFF | 126 | #define HW_OP_UNSUPPORTED 0xFFFF |
115 | 127 | ||
116 | #define C(_x) \ | 128 | #define C(_x) \ |