ftrace: add tracing_thresh to function profile
authorUmesh Tiwari <umesh.t@samsung.com>
Mon, 22 Jun 2015 11:28:08 +0000 (16:58 +0530)
committerSteven Rostedt <rostedt@goodmis.org>
Tue, 21 Jul 2015 02:30:51 +0000 (22:30 -0400)
This patch extends tracing_thresh functionality to function profile tracer.
If tracing_thresh is set, print those entries only,
whose average is > tracing thresh.

Link: http://lkml.kernel.org/r/1434972488-8571-1-git-send-email-umesh.t@samsung.com
Signed-off-by: Umesh Tiwari <umesh.t@samsung.com>
[ Removed unnecessary 'moved' comment ]
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
kernel/trace/ftrace.c

index 02bece4a99ea36bb835fc45a9aa55c1aedd69f9f..f46dbb5cdf762b8d8162551a7e9c9671aad9e1ef 100644 (file)
@@ -613,13 +613,18 @@ static int function_stat_show(struct seq_file *m, void *v)
                goto out;
        }
 
+#ifdef CONFIG_FUNCTION_GRAPH_TRACER
+       avg = rec->time;
+       do_div(avg, rec->counter);
+       if (tracing_thresh && (avg < tracing_thresh))
+               goto out;
+#endif
+
        kallsyms_lookup(rec->ip, NULL, NULL, NULL, str);
        seq_printf(m, "  %-30.30s  %10lu", str, rec->counter);
 
 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
        seq_puts(m, "    ");
-       avg = rec->time;
-       do_div(avg, rec->counter);
 
        /* Sample standard deviation (s^2) */
        if (rec->counter <= 1)