aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/ftrace.h77
-rw-r--r--include/linux/ftrace_irq.h2
-rw-r--r--include/linux/sched.h2
3 files changed, 64 insertions, 17 deletions
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 7854d87b97b2..afba918c623c 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -115,8 +115,13 @@ extern int ftrace_update_ftrace_func(ftrace_func_t func);
115extern void ftrace_caller(void); 115extern void ftrace_caller(void);
116extern void ftrace_call(void); 116extern void ftrace_call(void);
117extern void mcount_call(void); 117extern void mcount_call(void);
118#ifdef CONFIG_FUNCTION_RET_TRACER 118#ifdef CONFIG_FUNCTION_GRAPH_TRACER
119extern void ftrace_return_caller(void); 119extern void ftrace_graph_caller(void);
120extern int ftrace_enable_ftrace_graph_caller(void);
121extern int ftrace_disable_ftrace_graph_caller(void);
122#else
123static inline int ftrace_enable_ftrace_graph_caller(void) { return 0; }
124static inline int ftrace_disable_ftrace_graph_caller(void) { return 0; }
120#endif 125#endif
121 126
122/** 127/**
@@ -311,35 +316,77 @@ ftrace_init_module(struct module *mod,
311 unsigned long *start, unsigned long *end) { } 316 unsigned long *start, unsigned long *end) { }
312#endif 317#endif
313 318
319enum {
320 POWER_NONE = 0,
321 POWER_CSTATE = 1,
322 POWER_PSTATE = 2,
323};
324
325struct power_trace {
326#ifdef CONFIG_POWER_TRACER
327 ktime_t stamp;
328 ktime_t end;
329 int type;
330 int state;
331#endif
332};
333
334#ifdef CONFIG_POWER_TRACER
335extern void trace_power_start(struct power_trace *it, unsigned int type,
336 unsigned int state);
337extern void trace_power_mark(struct power_trace *it, unsigned int type,
338 unsigned int state);
339extern void trace_power_end(struct power_trace *it);
340#else
341static inline void trace_power_start(struct power_trace *it, unsigned int type,
342 unsigned int state) { }
343static inline void trace_power_mark(struct power_trace *it, unsigned int type,
344 unsigned int state) { }
345static inline void trace_power_end(struct power_trace *it) { }
346#endif
347
348
349/*
350 * Structure that defines an entry function trace.
351 */
352struct ftrace_graph_ent {
353 unsigned long func; /* Current function */
354 int depth;
355};
314 356
315/* 357/*
316 * Structure that defines a return function trace. 358 * Structure that defines a return function trace.
317 */ 359 */
318struct ftrace_retfunc { 360struct ftrace_graph_ret {
319 unsigned long ret; /* Return address */
320 unsigned long func; /* Current function */ 361 unsigned long func; /* Current function */
321 unsigned long long calltime; 362 unsigned long long calltime;
322 unsigned long long rettime; 363 unsigned long long rettime;
323 /* Number of functions that overran the depth limit for current task */ 364 /* Number of functions that overran the depth limit for current task */
324 unsigned long overrun; 365 unsigned long overrun;
366 int depth;
325}; 367};
326 368
327#ifdef CONFIG_FUNCTION_RET_TRACER 369#ifdef CONFIG_FUNCTION_GRAPH_TRACER
328#define FTRACE_RETFUNC_DEPTH 50 370#define FTRACE_RETFUNC_DEPTH 50
329#define FTRACE_RETSTACK_ALLOC_SIZE 32 371#define FTRACE_RETSTACK_ALLOC_SIZE 32
330/* Type of a callback handler of tracing return function */ 372/* Type of the callback handlers for tracing function graph*/
331typedef void (*trace_function_return_t)(struct ftrace_retfunc *); 373typedef void (*trace_func_graph_ret_t)(struct ftrace_graph_ret *); /* return */
374typedef void (*trace_func_graph_ent_t)(struct ftrace_graph_ent *); /* entry */
375
376extern int register_ftrace_graph(trace_func_graph_ret_t retfunc,
377 trace_func_graph_ent_t entryfunc);
378
379/* The current handlers in use */
380extern trace_func_graph_ret_t ftrace_graph_return;
381extern trace_func_graph_ent_t ftrace_graph_entry;
332 382
333extern int register_ftrace_return(trace_function_return_t func); 383extern void unregister_ftrace_graph(void);
334/* The current handler in use */
335extern trace_function_return_t ftrace_function_return;
336extern void unregister_ftrace_return(void);
337 384
338extern void ftrace_retfunc_init_task(struct task_struct *t); 385extern void ftrace_graph_init_task(struct task_struct *t);
339extern void ftrace_retfunc_exit_task(struct task_struct *t); 386extern void ftrace_graph_exit_task(struct task_struct *t);
340#else 387#else
341static inline void ftrace_retfunc_init_task(struct task_struct *t) { } 388static inline void ftrace_graph_init_task(struct task_struct *t) { }
342static inline void ftrace_retfunc_exit_task(struct task_struct *t) { } 389static inline void ftrace_graph_exit_task(struct task_struct *t) { }
343#endif 390#endif
344 391
345#endif /* _LINUX_FTRACE_H */ 392#endif /* _LINUX_FTRACE_H */
diff --git a/include/linux/ftrace_irq.h b/include/linux/ftrace_irq.h
index 0b4df55d7a74..366a054d0b05 100644
--- a/include/linux/ftrace_irq.h
+++ b/include/linux/ftrace_irq.h
@@ -2,7 +2,7 @@
2#define _LINUX_FTRACE_IRQ_H 2#define _LINUX_FTRACE_IRQ_H
3 3
4 4
5#if defined(CONFIG_DYNAMIC_FTRACE) || defined(CONFIG_FUNCTION_RET_TRACER) 5#if defined(CONFIG_DYNAMIC_FTRACE) || defined(CONFIG_FUNCTION_GRAPH_TRACER)
6extern void ftrace_nmi_enter(void); 6extern void ftrace_nmi_enter(void);
7extern void ftrace_nmi_exit(void); 7extern void ftrace_nmi_exit(void);
8#else 8#else
diff --git a/include/linux/sched.h b/include/linux/sched.h
index d02a0ca70ee9..7ad48f2a2758 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1365,7 +1365,7 @@ struct task_struct {
1365 unsigned long default_timer_slack_ns; 1365 unsigned long default_timer_slack_ns;
1366 1366
1367 struct list_head *scm_work_list; 1367 struct list_head *scm_work_list;
1368#ifdef CONFIG_FUNCTION_RET_TRACER 1368#ifdef CONFIG_FUNCTION_GRAPH_TRACER
1369 /* Index of current stored adress in ret_stack */ 1369 /* Index of current stored adress in ret_stack */
1370 int curr_ret_stack; 1370 int curr_ret_stack;
1371 /* Stack of return addresses for return function tracing */ 1371 /* Stack of return addresses for return function tracing */