Commit 84c79910 authored by Matt Fleming's avatar Matt Fleming Committed by Robert Richter

perf: New helper function for pmu name

Introduce perf_pmu_name() helper function that returns the name of the
pmu. This gives us a generic way to get the name of a pmu regardless of
how an architecture identifies it internally.
Signed-off-by: default avatarMatt Fleming <matt@console-pimps.org>
Acked-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: default avatarPaul Mundt <lethal@linux-sh.org>
Signed-off-by: default avatarRobert Richter <robert.richter@amd.com>
parent 3bf101ba
...@@ -59,6 +59,15 @@ static inline int sh_pmu_initialized(void) ...@@ -59,6 +59,15 @@ static inline int sh_pmu_initialized(void)
return !!sh_pmu; return !!sh_pmu;
} }
const char *perf_pmu_name(void)
{
if (!sh_pmu)
return NULL;
return sh_pmu->name;
}
EXPORT_SYMBOL_GPL(perf_pmu_name);
int perf_num_counters(void) int perf_num_counters(void)
{ {
if (!sh_pmu) if (!sh_pmu)
......
...@@ -850,6 +850,7 @@ extern int perf_max_events; ...@@ -850,6 +850,7 @@ extern int perf_max_events;
extern const struct pmu *hw_perf_event_init(struct perf_event *event); extern const struct pmu *hw_perf_event_init(struct perf_event *event);
extern int perf_num_counters(void); extern int perf_num_counters(void);
extern const char *perf_pmu_name(void);
extern void perf_event_task_sched_in(struct task_struct *task); extern void perf_event_task_sched_in(struct task_struct *task);
extern void perf_event_task_sched_out(struct task_struct *task, struct task_struct *next); extern void perf_event_task_sched_out(struct task_struct *task, struct task_struct *next);
extern void perf_event_task_tick(struct task_struct *task); extern void perf_event_task_tick(struct task_struct *task);
......
...@@ -85,6 +85,11 @@ void __weak hw_perf_enable(void) { barrier(); } ...@@ -85,6 +85,11 @@ void __weak hw_perf_enable(void) { barrier(); }
void __weak perf_event_print_debug(void) { } void __weak perf_event_print_debug(void) { }
extern __weak const char *perf_pmu_name(void)
{
return "pmu";
}
static DEFINE_PER_CPU(int, perf_disable_count); static DEFINE_PER_CPU(int, perf_disable_count);
void perf_disable(void) void perf_disable(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment