aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-05-12 15:20:47 -0400
committerThomas Gleixner <tglx@linutronix.de>2008-05-23 17:39:38 -0400
commita6dd24f8d00cbccb560b19a723e6fb9bdfb20799 (patch)
tree8170d270a55b3d5856eef54a16e76b24d5a62c38 /kernel/trace
parent56a08bdcff20f0022bd9160c1093e56f763499aa (diff)
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 c460e85e94ed..b2198bc830ae 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -280,6 +280,10 @@ extern int trace_selftest_startup_wakeup(struct tracer *trace,
280extern int trace_selftest_startup_sched_switch(struct tracer *trace, 280extern int trace_selftest_startup_sched_switch(struct tracer *trace,
281 struct trace_array *tr); 281 struct trace_array *tr);
282#endif 282#endif
283#ifdef CONFIG_SYSPROF_TRACER
284extern int trace_selftest_startup_sysprof(struct tracer *trace,
285 struct trace_array *tr);
286#endif
283#endif /* CONFIG_FTRACE_STARTUP_TEST */ 287#endif /* CONFIG_FTRACE_STARTUP_TEST */
284 288
285extern void *head_page(struct trace_array_cpu *data); 289extern void *head_page(struct trace_array_cpu *data);
diff --git a/kernel/trace/trace_selftest.c b/kernel/trace/trace_selftest.c
index 3877dd9102f1..033a6fb2e5ff 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
537 return ret; 537 return ret;
538} 538}
539#endif /* CONFIG_CONTEXT_SWITCH_TRACER */ 539#endif /* CONFIG_CONTEXT_SWITCH_TRACER */
540
541#ifdef CONFIG_SYSPROF_TRACER
542int
543trace_selftest_startup_sysprof(struct tracer *trace, struct trace_array *tr)
544{
545 unsigned long count;
546 int ret;
547
548 /* start the tracing */
549 tr->ctrl = 1;
550 trace->init(tr);
551 /* Sleep for a 1/10 of a second */
552 msleep(100);
553 /* stop the tracing. */
554 tr->ctrl = 0;
555 trace->ctrl_update(tr);
556 /* check the trace buffer */
557 ret = trace_test_buffer(tr, &count);
558 trace->reset(tr);
559
560 if (!ret && !count) {
561 printk(KERN_CONT ".. no entries found ..");
562 ret = -1;
563 }
564
565 return ret;
566}
567#endif /* CONFIG_SYSPROF_TRACER */
diff --git a/kernel/trace/trace_sysprof.c b/kernel/trace/trace_sysprof.c
index b1137c11ef8b..b78f12f77fca 100644
--- a/kernel/trace/trace_sysprof.c
+++ b/kernel/trace/trace_sysprof.c
@@ -126,7 +126,7 @@ static void start_stack_timers(void)
126 for_each_online_cpu(cpu) { 126 for_each_online_cpu(cpu) {
127 set_cpus_allowed_ptr(current, &cpumask_of_cpu(cpu)); 127 set_cpus_allowed_ptr(current, &cpumask_of_cpu(cpu));
128 start_stack_timer(cpu); 128 start_stack_timer(cpu);
129 printk("started timer on cpu%d\n", cpu); 129 printk(KERN_INFO "started sysprof timer on cpu%d\n", cpu);
130 } 130 }
131 set_cpus_allowed_ptr(current, &saved_mask); 131 set_cpus_allowed_ptr(current, &saved_mask);
132} 132}
@@ -136,7 +136,7 @@ static void stop_stack_timer(int cpu)
136 struct hrtimer *hrtimer = &per_cpu(stack_trace_hrtimer, cpu); 136 struct hrtimer *hrtimer = &per_cpu(stack_trace_hrtimer, cpu);
137 137
138 hrtimer_cancel(hrtimer); 138 hrtimer_cancel(hrtimer);
139 printk("cancelled timer on cpu%d\n", cpu); 139 printk(KERN_INFO "cancelled sysprof timer on cpu%d\n", cpu);
140} 140}
141 141
142static void stop_stack_timers(void) 142static void stop_stack_timers(void)
@@ -200,7 +200,7 @@ static struct tracer stack_trace __read_mostly =
200 .reset = stack_trace_reset, 200 .reset = stack_trace_reset,
201 .ctrl_update = stack_trace_ctrl_update, 201 .ctrl_update = stack_trace_ctrl_update,
202#ifdef CONFIG_FTRACE_SELFTEST 202#ifdef CONFIG_FTRACE_SELFTEST
203 .selftest = trace_selftest_startup_stack, 203 .selftest = trace_selftest_startup_sysprof,
204#endif 204#endif
205}; 205};
206 206