aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Fleming <matt@console-pimps.org>2010-10-03 16:41:13 -0400
committerRobert Richter <robert.richter@amd.com>2010-10-11 11:45:49 -0400
commit84c7991059c9c4530cc911137c5bf508a41ed129 (patch)
tree1fc9f7c8139f680f3d899328128a38e5087c30c7
parent3bf101ba42a1c89b5afbc7492e7647dae5e18735 (diff)
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: 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>
-rw-r--r--arch/sh/kernel/perf_event.c9
-rw-r--r--include/linux/perf_event.h1
-rw-r--r--kernel/perf_event.c5
3 files changed, 15 insertions, 0 deletions
diff --git a/arch/sh/kernel/perf_event.c b/arch/sh/kernel/perf_event.c
index 2cb9ad59d4b1..55fe89bbdfe0 100644
--- a/arch/sh/kernel/perf_event.c
+++ b/arch/sh/kernel/perf_event.c
@@ -59,6 +59,15 @@ static inline int sh_pmu_initialized(void)
59 return !!sh_pmu; 59 return !!sh_pmu;
60} 60}
61 61
62const char *perf_pmu_name(void)
63{
64 if (!sh_pmu)
65 return NULL;
66
67 return sh_pmu->name;
68}
69EXPORT_SYMBOL_GPL(perf_pmu_name);
70
62int perf_num_counters(void) 71int perf_num_counters(void)
63{ 72{
64 if (!sh_pmu) 73 if (!sh_pmu)
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 1a0219247183..33f08dafda2f 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -850,6 +850,7 @@ extern int perf_max_events;
850extern const struct pmu *hw_perf_event_init(struct perf_event *event); 850extern const struct pmu *hw_perf_event_init(struct perf_event *event);
851 851
852extern int perf_num_counters(void); 852extern int perf_num_counters(void);
853extern const char *perf_pmu_name(void);
853extern void perf_event_task_sched_in(struct task_struct *task); 854extern void perf_event_task_sched_in(struct task_struct *task);
854extern void perf_event_task_sched_out(struct task_struct *task, struct task_struct *next); 855extern void perf_event_task_sched_out(struct task_struct *task, struct task_struct *next);
855extern void perf_event_task_tick(struct task_struct *task); 856extern void perf_event_task_tick(struct task_struct *task);
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 403d1804b198..e2534691db0d 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -85,6 +85,11 @@ void __weak hw_perf_enable(void) { barrier(); }
85 85
86void __weak perf_event_print_debug(void) { } 86void __weak perf_event_print_debug(void) { }
87 87
88extern __weak const char *perf_pmu_name(void)
89{
90 return "pmu";
91}
92
88static DEFINE_PER_CPU(int, perf_disable_count); 93static DEFINE_PER_CPU(int, perf_disable_count);
89 94
90void perf_disable(void) 95void perf_disable(void)