summaryrefslogtreecommitdiff
path: root/kernel/trace/trace_functions_graph.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/trace/trace_functions_graph.c')
-rw-r--r--kernel/trace/trace_functions_graph.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
index a569daaac4c4..bbd898f5a73c 100644
--- a/kernel/trace/trace_functions_graph.c
+++ b/kernel/trace/trace_functions_graph.c
@@ -133,6 +133,7 @@ int trace_graph_entry(struct ftrace_graph_ent *trace,
unsigned long *task_var = fgraph_get_task_var(gops);
struct trace_array *tr = gops->private;
struct trace_array_cpu *data;
+ unsigned long *sleeptime;
unsigned long flags;
unsigned int trace_ctx;
long disabled;
@@ -167,6 +168,13 @@ int trace_graph_entry(struct ftrace_graph_ent *trace,
if (ftrace_graph_ignore_irqs())
return 0;
+ /* save the current sleep time if we are to ignore it */
+ if (!fgraph_sleep_time) {
+ sleeptime = fgraph_reserve_data(gops->idx, sizeof(*sleeptime));
+ if (sleeptime)
+ *sleeptime = current->ftrace_sleeptime;
+ }
+
/*
* Stop here if tracing_threshold is set. We only write function return
* events to the ring buffer.
@@ -238,6 +246,22 @@ void __trace_graph_return(struct trace_array *tr,
trace_buffer_unlock_commit_nostack(buffer, event);
}
+static void handle_nosleeptime(struct ftrace_graph_ret *trace,
+ struct fgraph_ops *gops)
+{
+ unsigned long long *sleeptime;
+ int size;
+
+ if (fgraph_sleep_time)
+ return;
+
+ sleeptime = fgraph_retrieve_data(gops->idx, &size);
+ if (!sleeptime)
+ return;
+
+ trace->calltime += current->ftrace_sleeptime - *sleeptime;
+}
+
void trace_graph_return(struct ftrace_graph_ret *trace,
struct fgraph_ops *gops)
{
@@ -256,6 +280,8 @@ void trace_graph_return(struct ftrace_graph_ret *trace,
return;
}
+ handle_nosleeptime(trace, gops);
+
local_irq_save(flags);
cpu = raw_smp_processor_id();
data = per_cpu_ptr(tr->array_buffer.data, cpu);
@@ -278,6 +304,8 @@ static void trace_graph_thresh_return(struct ftrace_graph_ret *trace,
return;
}
+ handle_nosleeptime(trace, gops);
+
if (tracing_thresh &&
(trace->rettime - trace->calltime < tracing_thresh))
return;