aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ftrace.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/ftrace.h')
-rw-r--r--include/linux/ftrace.h77
1 files changed, 62 insertions, 15 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 */