]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ftrace: sysprof-plugin, add self-tests
authorIngo Molnar <mingo@elte.hu>
Mon, 12 May 2008 19:20:47 +0000 (21:20 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Fri, 23 May 2008 21:39:38 +0000 (23:39 +0200)
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
kernel/trace/trace.h
kernel/trace/trace_selftest.c
kernel/trace/trace_sysprof.c

index c460e85e94ed81ddb64283c9bb4ea7749a384663..b2198bc830ae06b72ad034d47eeed1cf80278f6b 100644 (file)
@@ -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);
index 3877dd9102f10bc27fdb340742e7359e13d9da0a..033a6fb2e5ff96371fd6c60d9c80dbf03a9cb734 100644 (file)
@@ -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 */
index b1137c11ef8b86b207d445221dc716c38908048e..b78f12f77fcad5675e892815486ac74e29ce42ee 100644 (file)
@@ -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
 };