Merge branch 'linux-linaro-lsk-v4.4' into linux-linaro-lsk-v4.4-android
[firefly-linux-kernel-4.4.55.git] / kernel / trace / trace_functions_graph.c
index 7fd6f5a26143cfd3a49960a5ace9ecc60e26a51b..96c75b0e983130f68b886b5400994573f5e86dc6 100644 (file)
@@ -64,6 +64,9 @@ struct fgraph_data {
 
 #define TRACE_GRAPH_INDENT     2
 
+/* Flag options */
+#define TRACE_GRAPH_PRINT_FLAT         0x80
+
 static unsigned int max_depth;
 
 static struct tracer_opt trace_opts[] = {
@@ -87,6 +90,8 @@ static struct tracer_opt trace_opts[] = {
        { TRACER_OPT(sleep-time, TRACE_GRAPH_SLEEP_TIME) },
        /* Include time within nested functions */
        { TRACER_OPT(graph-time, TRACE_GRAPH_GRAPH_TIME) },
+       /* Use standard trace formatting rather than hierarchical */
+       { TRACER_OPT(funcgraph-flat, TRACE_GRAPH_PRINT_FLAT) },
        { } /* Empty entry */
 };
 
@@ -1176,6 +1181,9 @@ print_graph_function_flags(struct trace_iterator *iter, u32 flags)
        int cpu = iter->cpu;
        int ret;
 
+       if (flags & TRACE_GRAPH_PRINT_FLAT)
+               return TRACE_TYPE_UNHANDLED;
+
        if (data && per_cpu_ptr(data->cpu_data, cpu)->ignore) {
                per_cpu_ptr(data->cpu_data, cpu)->ignore = 0;
                return TRACE_TYPE_HANDLED;
@@ -1233,13 +1241,6 @@ print_graph_function(struct trace_iterator *iter)
        return print_graph_function_flags(iter, tracer_flags.val);
 }
 
-static enum print_line_t
-print_graph_function_event(struct trace_iterator *iter, int flags,
-                          struct trace_event *event)
-{
-       return print_graph_function(iter);
-}
-
 static void print_lat_header(struct seq_file *s, u32 flags)
 {
        static const char spaces[] = "                " /* 16 spaces */
@@ -1308,6 +1309,11 @@ void print_graph_headers_flags(struct seq_file *s, u32 flags)
        struct trace_iterator *iter = s->private;
        struct trace_array *tr = iter->tr;
 
+       if (flags & TRACE_GRAPH_PRINT_FLAT) {
+               trace_default_header(s);
+               return;
+       }
+
        if (!(tr->trace_flags & TRACE_ITER_CONTEXT_INFO))
                return;
 
@@ -1389,19 +1395,6 @@ func_graph_set_flag(struct trace_array *tr, u32 old_flags, u32 bit, int set)
        return 0;
 }
 
-static struct trace_event_functions graph_functions = {
-       .trace          = print_graph_function_event,
-};
-
-static struct trace_event graph_trace_entry_event = {
-       .type           = TRACE_GRAPH_ENT,
-       .funcs          = &graph_functions,
-};
-
-static struct trace_event graph_trace_ret_event = {
-       .type           = TRACE_GRAPH_RET,
-       .funcs          = &graph_functions
-};
 
 static struct tracer graph_trace __tracer_data = {
        .name           = "function_graph",
@@ -1478,16 +1471,6 @@ static __init int init_graph_trace(void)
 {
        max_bytes_for_cpu = snprintf(NULL, 0, "%d", nr_cpu_ids - 1);
 
-       if (!register_trace_event(&graph_trace_entry_event)) {
-               pr_warning("Warning: could not register graph trace events\n");
-               return 1;
-       }
-
-       if (!register_trace_event(&graph_trace_ret_event)) {
-               pr_warning("Warning: could not register graph trace events\n");
-               return 1;
-       }
-
        return register_tracer(&graph_trace);
 }