]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ftrace: introduce tracing_reset_online_cpus() helper
authorPekka J Enberg <penberg@cs.helsinki.fi>
Fri, 19 Dec 2008 10:08:39 +0000 (12:08 +0200)
committerIngo Molnar <mingo@elte.hu>
Fri, 19 Dec 2008 15:29:34 +0000 (16:29 +0100)
Impact: cleanup

This patch factors out common code from multiple tracers into a
tracing_reset_online_cpus() function and converts the tracers to use it.

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/trace/trace.c
kernel/trace/trace.h
kernel/trace/trace_boot.c
kernel/trace/trace_functions.c
kernel/trace/trace_hw_branches.c
kernel/trace/trace_mmiotrace.c
kernel/trace/trace_sched_switch.c
kernel/trace/trace_sysprof.c

index 0eb6d48347f7671f382130bbdb1cf0633831388f..79db26e8216e48c95fbf0b8262675b38d077ecb9 100644 (file)
@@ -679,6 +679,16 @@ void tracing_reset(struct trace_array *tr, int cpu)
        ftrace_enable_cpu();
 }
 
+void tracing_reset_online_cpus(struct trace_array *tr)
+{
+       int cpu;
+
+       tr->time_start = ftrace_now(tr->cpu);
+
+       for_each_online_cpu(cpu)
+               tracing_reset(tr, cpu);
+}
+
 #define SAVED_CMDLINES 128
 static unsigned map_pid_to_cmdline[PID_MAX_DEFAULT+1];
 static unsigned map_cmdline_to_pid[SAVED_CMDLINES];
index fc75dce7a6645edfafdb612be7ff313d6ea8cf6e..cc7a4f86403695d6934f753cbc2cc7cdc6597f80 100644 (file)
@@ -374,6 +374,7 @@ struct trace_iterator {
 int tracing_is_enabled(void);
 void trace_wake_up(void);
 void tracing_reset(struct trace_array *tr, int cpu);
+void tracing_reset_online_cpus(struct trace_array *tr);
 int tracing_open_generic(struct inode *inode, struct file *filp);
 struct dentry *tracing_init_dentry(void);
 void init_tracer_sysprof_debugfs(struct dentry *d_tracer);
index a4fa2c57e34e376e0f58920e816db6c159530bcb..3ccebde284820ee7bbb41c8ef8b4aad9d251b47a 100644 (file)
@@ -37,16 +37,6 @@ void disable_boot_trace(void)
                tracing_stop_sched_switch_record();
 }
 
-static void reset_boot_trace(struct trace_array *tr)
-{
-       int cpu;
-
-       tr->time_start = ftrace_now(tr->cpu);
-
-       for_each_online_cpu(cpu)
-               tracing_reset(tr, cpu);
-}
-
 static int boot_trace_init(struct trace_array *tr)
 {
        int cpu;
@@ -130,7 +120,7 @@ struct tracer boot_tracer __read_mostly =
 {
        .name           = "initcall",
        .init           = boot_trace_init,
-       .reset          = reset_boot_trace,
+       .reset          = tracing_reset_online_cpus,
        .print_line     = initcall_print_line,
 };
 
index e74f6d0a321663b3610fb0e37d250c4fbf9696dc..9236d7e25a163b0733087d714728d5787104d08a 100644 (file)
 
 #include "trace.h"
 
-static void function_reset(struct trace_array *tr)
-{
-       int cpu;
-
-       tr->time_start = ftrace_now(tr->cpu);
-
-       for_each_online_cpu(cpu)
-               tracing_reset(tr, cpu);
-}
-
 static void start_function_trace(struct trace_array *tr)
 {
        tr->cpu = get_cpu();
-       function_reset(tr);
+       tracing_reset_online_cpus(tr);
        put_cpu();
 
        tracing_start_cmdline_record();
@@ -55,7 +45,7 @@ static void function_trace_reset(struct trace_array *tr)
 
 static void function_trace_start(struct trace_array *tr)
 {
-       function_reset(tr);
+       tracing_reset_online_cpus(tr);
 }
 
 static struct tracer function_trace __read_mostly =
index ee29e012aa975e5531bfdaa03b054314f15f9aff..b6a3e20a49a9f3ef3e4851de38017d961db548da 100644 (file)
@@ -25,16 +25,6 @@ static DEFINE_PER_CPU(unsigned char[SIZEOF_BTS], buffer);
 #define this_buffer per_cpu(buffer, smp_processor_id())
 
 
-static void bts_trace_reset(struct trace_array *tr)
-{
-       int cpu;
-
-       tr->time_start = ftrace_now(tr->cpu);
-
-       for_each_online_cpu(cpu)
-               tracing_reset(tr, cpu);
-}
-
 static void bts_trace_start_cpu(void *arg)
 {
        if (this_tracer)
@@ -54,7 +44,7 @@ static void bts_trace_start(struct trace_array *tr)
 {
        int cpu;
 
-       bts_trace_reset(tr);
+       tracing_reset_online_cpus(tr);
 
        for_each_cpu_mask(cpu, cpu_possible_map)
                smp_call_function_single(cpu, bts_trace_start_cpu, NULL, 1);
@@ -78,7 +68,7 @@ static void bts_trace_stop(struct trace_array *tr)
 
 static int bts_trace_init(struct trace_array *tr)
 {
-       bts_trace_reset(tr);
+       tracing_reset_online_cpus(tr);
        bts_trace_start(tr);
 
        return 0;
index 2fb6da6523b31131aee6d7cea6351b85b3178d54..fffcb069f1dcb48213ec0c51a4c8d1774e8235a4 100644 (file)
@@ -22,14 +22,10 @@ static unsigned long prev_overruns;
 
 static void mmio_reset_data(struct trace_array *tr)
 {
-       int cpu;
-
        overrun_detected = false;
        prev_overruns = 0;
-       tr->time_start = ftrace_now(tr->cpu);
 
-       for_each_online_cpu(cpu)
-               tracing_reset(tr, cpu);
+       tracing_reset_online_cpus(tr);
 }
 
 static int mmio_trace_init(struct trace_array *tr)
index 781d72ef873cd4861303c26514a1deea9c265866..add2c1fdae9259efffc080b8b62f0ce194663fa0 100644 (file)
@@ -72,16 +72,6 @@ probe_sched_wakeup(struct rq *__rq, struct task_struct *wakee)
        local_irq_restore(flags);
 }
 
-static void sched_switch_reset(struct trace_array *tr)
-{
-       int cpu;
-
-       tr->time_start = ftrace_now(tr->cpu);
-
-       for_each_online_cpu(cpu)
-               tracing_reset(tr, cpu);
-}
-
 static int tracing_sched_register(void)
 {
        int ret;
@@ -197,7 +187,7 @@ void tracing_sched_switch_assign_trace(struct trace_array *tr)
 
 static void start_sched_trace(struct trace_array *tr)
 {
-       sched_switch_reset(tr);
+       tracing_reset_online_cpus(tr);
        tracing_start_sched_switch_record();
 }
 
@@ -221,7 +211,7 @@ static void sched_switch_trace_reset(struct trace_array *tr)
 
 static void sched_switch_trace_start(struct trace_array *tr)
 {
-       sched_switch_reset(tr);
+       tracing_reset_online_cpus(tr);
        tracing_start_sched_switch();
 }
 
index 54960edb96d077d2c09a4356f7976ae8d0216781..01becf1f19ff78fad129aa6474ec550c428519ae 100644 (file)
@@ -234,20 +234,10 @@ static void stop_stack_timers(void)
                stop_stack_timer(cpu);
 }
 
-static void stack_reset(struct trace_array *tr)
-{
-       int cpu;
-
-       tr->time_start = ftrace_now(tr->cpu);
-
-       for_each_online_cpu(cpu)
-               tracing_reset(tr, cpu);
-}
-
 static void start_stack_trace(struct trace_array *tr)
 {
        mutex_lock(&sample_timer_lock);
-       stack_reset(tr);
+       tracing_reset_online_cpus(tr);
        start_stack_timers();
        tracer_enabled = 1;
        mutex_unlock(&sample_timer_lock);