Skip to content

Commit

Permalink
ARM: 6071/1: perf-events: allow modules to query the number of hardwa…
Browse files Browse the repository at this point in the history
…re 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>
  • Loading branch information
Will Deacon authored and Russell King committed May 17, 2010
1 parent 49e6a32 commit 929f519
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions arch/arm/include/asm/perf_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,7 @@ enum arm_perf_pmu_ids {
extern enum arm_perf_pmu_ids
armpmu_get_pmu_id(void);

extern int
armpmu_get_max_events(void);

#endif /* __ARM_PERF_EVENT_H__ */
12 changes: 12 additions & 0 deletions arch/arm/kernel/perf_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,18 @@ armpmu_get_pmu_id(void)
}
EXPORT_SYMBOL_GPL(armpmu_get_pmu_id);

int
armpmu_get_max_events(void)
{
int max_events = 0;

if (armpmu != NULL)
max_events = armpmu->num_events;

return max_events;
}
EXPORT_SYMBOL_GPL(armpmu_get_max_events);

#define HW_OP_UNSUPPORTED 0xFFFF

#define C(_x) \
Expand Down

0 comments on commit 929f519

Please sign in to comment.