summaryrefslogtreecommitdiffstats
path: root/kernel/trace
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-05-12 21:20:47 +0200
committerThomas Gleixner <tglx@linutronix.de>2008-05-23 23:39:38 +0200
commita6dd24f8d00cbccb560b19a723e6fb9bdfb20799 (patch)
tree8170d270a55b3d5856eef54a16e76b24d5a62c38 /kernel/trace
parent56a08bdcff20f0022bd9160c1093e56f763499aa (diff)
downloadop-kernel-dev-a6dd24f8d00cbccb560b19a723e6fb9bdfb20799.zip
op-kernel-dev-a6dd24f8d00cbccb560b19a723e6fb9bdfb20799.tar.gz
ftrace: sysprof-plugin, add self-tests
Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/trace')
-rw-r--r--kernel/trace/trace.h4
-rw-r--r--kernel/trace/trace_selftest.c28
-rw-r--r--kernel/trace/trace_sysprof.c6
3 files changed, 35 insertions, 3 deletions
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index c460e85..b2198bc 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -280,6 +280,10 @@ extern int trace_selftest_startup_wakeup(struct tracer *trace,
extern int trace_selftest_startup_sched_switch(struct tracer *trace,
struct trace_array *tr);
#endif
+#ifdef CONFIG_SYSPROF_TRACER
+extern int trace_selftest_startup_sysprof(struct tracer *trace,
+ struct trace_array *tr);
+#endif
#endif /* CONFIG_FTRACE_STARTUP_TEST */
extern void *head_page(struct trace_array_cpu *data);
diff --git a/kernel/trace/trace_selftest.c b/kernel/trace/trace_selftest.c
index 3877dd9..033a6fb 100644
--- a/kernel/trace/trace_selftest.c
+++ b/kernel/trace/trace_selftest.c
@@ -537,3 +537,31 @@ trace_selftest_startup_sched_switch(struct tracer *trace, struct trace_array *tr
return ret;
}
#endif /* CONFIG_CONTEXT_SWITCH_TRACER */
+
+#ifdef CONFIG_SYSPROF_TRACER
+int
+trace_selftest_startup_sysprof(struct tracer *trace, struct trace_array *tr)
+{
+ unsigned long count;
+ int ret;
+
+ /* start the tracing */
+ tr->ctrl = 1;
+ trace->init(tr);
+ /* Sleep for a 1/10 of a second */
+ msleep(100);
+ /* stop the tracing. */
+ tr->ctrl = 0;
+ trace->ctrl_update(tr);
+ /* check the trace buffer */
+ ret = trace_test_buffer(tr, &count);
+ trace->reset(tr);
+
+ if (!ret && !count) {
+ printk(KERN_CONT ".. no entries found ..");
+ ret = -1;
+ }
+
+ return ret;
+}
+#endif /* CONFIG_SYSPROF_TRACER */
diff --git a/kernel/trace/trace_sysprof.c b/kernel/trace/trace_sysprof.c
index b1137c1..b78f12f 100644
--- a/kernel/trace/trace_sysprof.c
+++ b/kernel/trace/trace_sysprof.c
@@ -126,7 +126,7 @@ static void start_stack_timers(void)
for_each_online_cpu(cpu) {
set_cpus_allowed_ptr(current, &cpumask_of_cpu(cpu));
start_stack_timer(cpu);
- printk("started timer on cpu%d\n", cpu);
+ printk(KERN_INFO "started sysprof timer on cpu%d\n", cpu);
}
set_cpus_allowed_ptr(current, &saved_mask);
}
@@ -136,7 +136,7 @@ static void stop_stack_timer(int cpu)
struct hrtimer *hrtimer = &per_cpu(stack_trace_hrtimer, cpu);
hrtimer_cancel(hrtimer);
- printk("cancelled timer on cpu%d\n", cpu);
+ printk(KERN_INFO "cancelled sysprof timer on cpu%d\n", cpu);
}
static void stop_stack_timers(void)
@@ -200,7 +200,7 @@ static struct tracer stack_trace __read_mostly =
.reset = stack_trace_reset,
.ctrl_update = stack_trace_ctrl_update,
#ifdef CONFIG_FTRACE_SELFTEST
- .selftest = trace_selftest_startup_stack,
+ .selftest = trace_selftest_startup_sysprof,
#endif
};
OpenPOWER on IntegriCloud