浏览代码

function-graph: moved the timestamp from arch to generic code

This patch move the timestamp from happening in the arch specific
code into the general code. This allows for better control by the tracer
to time manipulation.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Steven Rostedt 16 年之前
父节点
当前提交
5d1a03dc54
共有 3 个文件被更改,包括 7 次插入10 次删除
  1. 1 5
      arch/x86/kernel/ftrace.c
  2. 1 2
      include/linux/ftrace.h
  3. 5 3
      kernel/trace/trace_functions_graph.c

+ 1 - 5
arch/x86/kernel/ftrace.c

@@ -410,7 +410,6 @@ int ftrace_disable_ftrace_graph_caller(void)
 void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr)
 void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr)
 {
 {
 	unsigned long old;
 	unsigned long old;
-	unsigned long long calltime;
 	int faulted;
 	int faulted;
 	struct ftrace_graph_ent trace;
 	struct ftrace_graph_ent trace;
 	unsigned long return_hooker = (unsigned long)
 	unsigned long return_hooker = (unsigned long)
@@ -453,10 +452,7 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr)
 		return;
 		return;
 	}
 	}
 
 
-	calltime = trace_clock_local();
-
-	if (ftrace_push_return_trace(old, calltime,
-				self_addr, &trace.depth) == -EBUSY) {
+	if (ftrace_push_return_trace(old, self_addr, &trace.depth) == -EBUSY) {
 		*parent = old;
 		*parent = old;
 		return;
 		return;
 	}
 	}

+ 1 - 2
include/linux/ftrace.h

@@ -369,8 +369,7 @@ struct ftrace_ret_stack {
 extern void return_to_handler(void);
 extern void return_to_handler(void);
 
 
 extern int
 extern int
-ftrace_push_return_trace(unsigned long ret, unsigned long long time,
-			 unsigned long func, int *depth);
+ftrace_push_return_trace(unsigned long ret, unsigned long func, int *depth);
 extern void
 extern void
 ftrace_pop_return_trace(struct ftrace_graph_ret *trace, unsigned long *ret);
 ftrace_pop_return_trace(struct ftrace_graph_ret *trace, unsigned long *ret);
 
 

+ 5 - 3
kernel/trace/trace_functions_graph.c

@@ -57,9 +57,9 @@ static struct tracer_flags tracer_flags = {
 
 
 /* Add a function return address to the trace stack on thread info.*/
 /* Add a function return address to the trace stack on thread info.*/
 int
 int
-ftrace_push_return_trace(unsigned long ret, unsigned long long time,
-			 unsigned long func, int *depth)
+ftrace_push_return_trace(unsigned long ret, unsigned long func, int *depth)
 {
 {
+	unsigned long long calltime;
 	int index;
 	int index;
 
 
 	if (!current->ret_stack)
 	if (!current->ret_stack)
@@ -71,11 +71,13 @@ ftrace_push_return_trace(unsigned long ret, unsigned long long time,
 		return -EBUSY;
 		return -EBUSY;
 	}
 	}
 
 
+	calltime = trace_clock_local();
+
 	index = ++current->curr_ret_stack;
 	index = ++current->curr_ret_stack;
 	barrier();
 	barrier();
 	current->ret_stack[index].ret = ret;
 	current->ret_stack[index].ret = ret;
 	current->ret_stack[index].func = func;
 	current->ret_stack[index].func = func;
-	current->ret_stack[index].calltime = time;
+	current->ret_stack[index].calltime = calltime;
 	*depth = index;
 	*depth = index;
 
 
 	return 0;
 	return 0;