Skip to contentSkip to conversation

perf: export perf helper functions

RFC PATCH In review Zhang Rui 1 participant 2 messages Aug 18, 2010 perf events

lore
Share & tools
lore

Zhang Rui

author
#0 lore raw

RFC PATCH 1/3 perf: export perf helper functions

Make more perf helper functions global, so that we can write a new pmu more easily.

---
 include/linux/perf_event.h |    2 ++
 kernel/perf_event.c        |   12 ++++++++++--
 2 files changed, 12 insertions(+), 2 deletions(-)
kernel/perf_event.c +10 -2
Index: linux-2.6/kernel/perf_event.c
===================================================================
@@ -4572,7 +4572,7 @@ static enum hrtimer_restart perf_swevent
 	return ret;
 }
 
-static void perf_swevent_start_hrtimer(struct perf_event *event)
+void perf_swevent_start_hrtimer(struct perf_event *event)
 {
 	struct hw_perf_event *hwc = &event->hw;
 
@@ -4595,7 +4595,9 @@ static void perf_swevent_start_hrtimer(s
 	}
 }
 
-static void perf_swevent_cancel_hrtimer(struct perf_event *event)
+EXPORT_SYMBOL(perf_swevent_start_hrtimer);
+
+void perf_swevent_cancel_hrtimer(struct perf_event *event)
 {
 	struct hw_perf_event *hwc = &event->hw;
 
@@ -4607,6 +4609,8 @@ static void perf_swevent_cancel_hrtimer(
 	}
 }
 
+EXPORT_SYMBOL(perf_swevent_cancel_hrtimer);
+
 /*
  * Software event: cpu wall time clock
  */
@@ -4815,6 +4819,8 @@ unlock:
 	return ret;
 }
 
+EXPORT_SYMBOL(perf_pmu_register);
+
 void perf_pmu_unregister(struct pmu *pmu)
 {
 	mutex_lock(&pmus_lock);
@@ -4825,6 +4831,8 @@ void perf_pmu_unregister(struct pmu *pmu
 	synchronize_srcu(&pmus_srcu);
 }
 
+EXPORT_SYMBOL(perf_pmu_unregister);
+
 struct pmu *perf_init_event(struct perf_event *event)
 {
 	struct pmu *pmu = NULL;
include/linux/perf_event.h +2 -0
Index: linux-2.6/include/linux/perf_event.h
===================================================================
@@ -888,6 +888,8 @@ extern int perf_max_events;
 
 extern int perf_pmu_register(struct pmu *pmu);
 extern void perf_pmu_unregister(struct pmu *pmu);
+extern void perf_swevent_start_hrtimer(struct perf_event *event);
+extern void perf_swevent_cancel_hrtimer(struct perf_event *event);
 
 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);
author
#1 lore raw

resend with the correct email address. :p

Export some perf helper functions.

---
 include/linux/perf_event.h |    2 ++
 kernel/perf_event.c        |   12 ++++++++++--
 2 files changed, 12 insertions(+), 2 deletions(-)
kernel/perf_event.c +10 -2
Index: linux-2.6/kernel/perf_event.c
===================================================================
@@ -4572,7 +4572,7 @@ static enum hrtimer_restart perf_swevent
 	return ret;
 }
 
-static void perf_swevent_start_hrtimer(struct perf_event *event)
+void perf_swevent_start_hrtimer(struct perf_event *event)
 {
 	struct hw_perf_event *hwc = &event->hw;
 
@@ -4595,7 +4595,9 @@ static void perf_swevent_start_hrtimer(s
 	}
 }
 
-static void perf_swevent_cancel_hrtimer(struct perf_event *event)
+EXPORT_SYMBOL(perf_swevent_start_hrtimer);
+
+void perf_swevent_cancel_hrtimer(struct perf_event *event)
 {
 	struct hw_perf_event *hwc = &event->hw;
 
@@ -4607,6 +4609,8 @@ static void perf_swevent_cancel_hrtimer(
 	}
 }
 
+EXPORT_SYMBOL(perf_swevent_cancel_hrtimer);
+
 /*
  * Software event: cpu wall time clock
  */
@@ -4815,6 +4819,8 @@ unlock:
 	return ret;
 }
 
+EXPORT_SYMBOL(perf_pmu_register);
+
 void perf_pmu_unregister(struct pmu *pmu)
 {
 	mutex_lock(&pmus_lock);
@@ -4825,6 +4831,8 @@ void perf_pmu_unregister(struct pmu *pmu
 	synchronize_srcu(&pmus_srcu);
 }
 
+EXPORT_SYMBOL(perf_pmu_unregister);
+
 struct pmu *perf_init_event(struct perf_event *event)
 {
 	struct pmu *pmu = NULL;
include/linux/perf_event.h +2 -0
Index: linux-2.6/include/linux/perf_event.h
===================================================================
@@ -888,6 +888,8 @@ extern int perf_max_events;
 
 extern int perf_pmu_register(struct pmu *pmu);
 extern void perf_pmu_unregister(struct pmu *pmu);
+extern void perf_swevent_start_hrtimer(struct perf_event *event);
+extern void perf_swevent_cancel_hrtimer(struct perf_event *event);
 
 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);