perf: New helper function for pmu name
authorMatt Fleming <matt@console-pimps.org>
Sun, 3 Oct 2010 20:41:13 +0000 (21:41 +0100)
committerRobert Richter <robert.richter@amd.com>
Mon, 11 Oct 2010 15:45:49 +0000 (17:45 +0200)
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: Matt Fleming <matt@console-pimps.org>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Robert Richter <robert.richter@amd.com>
arch/sh/kernel/perf_event.c
include/linux/perf_event.h
kernel/perf_event.c

index 2cb9ad59d4b1bf3b8b8e74fe8303f25accdee753..55fe89bbdfe03503d3fde88269c790c7025af7b2 100644 (file)
@@ -59,6 +59,15 @@ static inline int sh_pmu_initialized(void)
        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)
 {
        if (!sh_pmu)
index 1a0219247183c4e97f559965fdfedd86f77dc1e0..33f08dafda2fc231f13aa60f59574ba1b01eb250 100644 (file)
@@ -850,6 +850,7 @@ extern int perf_max_events;
 extern const struct pmu *hw_perf_event_init(struct perf_event *event);
 
 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_out(struct task_struct *task, struct task_struct *next);
 extern void perf_event_task_tick(struct task_struct *task);
index 403d1804b198140e4f1355c70c0b25e6efa9e5d8..e2534691db0d7608f241835f4377363fd4cec8d7 100644 (file)
@@ -85,6 +85,11 @@ void __weak hw_perf_enable(void)             { barrier(); }
 
 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);
 
 void perf_disable(void)