diff options
Diffstat (limited to 'include/linux/ftrace.h')
| -rw-r--r-- | include/linux/ftrace.h | 77 |
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); | |||
| 115 | extern void ftrace_caller(void); | 115 | extern void ftrace_caller(void); |
| 116 | extern void ftrace_call(void); | 116 | extern void ftrace_call(void); |
| 117 | extern void mcount_call(void); | 117 | extern void mcount_call(void); |
| 118 | #ifdef CONFIG_FUNCTION_RET_TRACER | 118 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
| 119 | extern void ftrace_return_caller(void); | 119 | extern void ftrace_graph_caller(void); |
| 120 | extern int ftrace_enable_ftrace_graph_caller(void); | ||
| 121 | extern int ftrace_disable_ftrace_graph_caller(void); | ||
| 122 | #else | ||
| 123 | static inline int ftrace_enable_ftrace_graph_caller(void) { return 0; } | ||
| 124 | static 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 | ||
| 319 | enum { | ||
| 320 | POWER_NONE = 0, | ||
| 321 | POWER_CSTATE = 1, | ||
| 322 | POWER_PSTATE = 2, | ||
| 323 | }; | ||
| 324 | |||
| 325 | struct 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 | ||
| 335 | extern void trace_power_start(struct power_trace *it, unsigned int type, | ||
| 336 | unsigned int state); | ||
| 337 | extern void trace_power_mark(struct power_trace *it, unsigned int type, | ||
| 338 | unsigned int state); | ||
| 339 | extern void trace_power_end(struct power_trace *it); | ||
| 340 | #else | ||
| 341 | static inline void trace_power_start(struct power_trace *it, unsigned int type, | ||
| 342 | unsigned int state) { } | ||
| 343 | static inline void trace_power_mark(struct power_trace *it, unsigned int type, | ||
| 344 | unsigned int state) { } | ||
| 345 | static inline void trace_power_end(struct power_trace *it) { } | ||
| 346 | #endif | ||
| 347 | |||
| 348 | |||
| 349 | /* | ||
| 350 | * Structure that defines an entry function trace. | ||
| 351 | */ | ||
| 352 | struct 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 | */ |
| 318 | struct ftrace_retfunc { | 360 | struct 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*/ |
| 331 | typedef void (*trace_function_return_t)(struct ftrace_retfunc *); | 373 | typedef void (*trace_func_graph_ret_t)(struct ftrace_graph_ret *); /* return */ |
| 374 | typedef void (*trace_func_graph_ent_t)(struct ftrace_graph_ent *); /* entry */ | ||
| 375 | |||
| 376 | extern int register_ftrace_graph(trace_func_graph_ret_t retfunc, | ||
| 377 | trace_func_graph_ent_t entryfunc); | ||
| 378 | |||
| 379 | /* The current handlers in use */ | ||
| 380 | extern trace_func_graph_ret_t ftrace_graph_return; | ||
| 381 | extern trace_func_graph_ent_t ftrace_graph_entry; | ||
| 332 | 382 | ||
| 333 | extern int register_ftrace_return(trace_function_return_t func); | 383 | extern void unregister_ftrace_graph(void); |
| 334 | /* The current handler in use */ | ||
| 335 | extern trace_function_return_t ftrace_function_return; | ||
| 336 | extern void unregister_ftrace_return(void); | ||
| 337 | 384 | ||
| 338 | extern void ftrace_retfunc_init_task(struct task_struct *t); | 385 | extern void ftrace_graph_init_task(struct task_struct *t); |
| 339 | extern void ftrace_retfunc_exit_task(struct task_struct *t); | 386 | extern void ftrace_graph_exit_task(struct task_struct *t); |
| 340 | #else | 387 | #else |
| 341 | static inline void ftrace_retfunc_init_task(struct task_struct *t) { } | 388 | static inline void ftrace_graph_init_task(struct task_struct *t) { } |
| 342 | static inline void ftrace_retfunc_exit_task(struct task_struct *t) { } | 389 | static 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 */ |
