Frederic Weisbecker | 3f5ec13 | 2008-11-11 23:21:31 +0100 | [diff] [blame] | 1 | #ifndef _LINUX_TRACE_BOOT_H |
| 2 | #define _LINUX_TRACE_BOOT_H |
| 3 | |
Frederic Weisbecker | da485e0 | 2008-12-11 16:14:23 +0100 | [diff] [blame] | 4 | #include <linux/module.h> |
| 5 | #include <linux/kallsyms.h> |
| 6 | #include <linux/init.h> |
| 7 | |
Frederic Weisbecker | 3f5ec13 | 2008-11-11 23:21:31 +0100 | [diff] [blame] | 8 | /* |
Frederic Weisbecker | 7423907 | 2008-11-11 23:24:42 +0100 | [diff] [blame] | 9 | * Structure which defines the trace of an initcall |
| 10 | * while it is called. |
Frederic Weisbecker | 3f5ec13 | 2008-11-11 23:21:31 +0100 | [diff] [blame] | 11 | * You don't have to fill the func field since it is |
| 12 | * only used internally by the tracer. |
| 13 | */ |
Frederic Weisbecker | 7423907 | 2008-11-11 23:24:42 +0100 | [diff] [blame] | 14 | struct boot_trace_call { |
Frederic Weisbecker | 3f5ec13 | 2008-11-11 23:21:31 +0100 | [diff] [blame] | 15 | pid_t caller; |
Stephen Rothwell | 8001530 | 2008-12-11 16:10:08 +0100 | [diff] [blame] | 16 | char func[KSYM_SYMBOL_LEN]; |
Frederic Weisbecker | 7423907 | 2008-11-11 23:24:42 +0100 | [diff] [blame] | 17 | }; |
| 18 | |
| 19 | /* |
| 20 | * Structure which defines the trace of an initcall |
| 21 | * while it returns. |
| 22 | */ |
| 23 | struct boot_trace_ret { |
Stephen Rothwell | 8001530 | 2008-12-11 16:10:08 +0100 | [diff] [blame] | 24 | char func[KSYM_SYMBOL_LEN]; |
Frederic Weisbecker | 7423907 | 2008-11-11 23:24:42 +0100 | [diff] [blame] | 25 | int result; |
| 26 | unsigned long long duration; /* nsecs */ |
Frederic Weisbecker | 3f5ec13 | 2008-11-11 23:21:31 +0100 | [diff] [blame] | 27 | }; |
| 28 | |
| 29 | #ifdef CONFIG_BOOT_TRACER |
Frederic Weisbecker | 7423907 | 2008-11-11 23:24:42 +0100 | [diff] [blame] | 30 | /* Append the traces on the ring-buffer */ |
| 31 | extern void trace_boot_call(struct boot_trace_call *bt, initcall_t fn); |
| 32 | extern void trace_boot_ret(struct boot_trace_ret *bt, initcall_t fn); |
Frederic Weisbecker | 3f5ec13 | 2008-11-11 23:21:31 +0100 | [diff] [blame] | 33 | |
| 34 | /* Tells the tracer that smp_pre_initcall is finished. |
| 35 | * So we can start the tracing |
| 36 | */ |
| 37 | extern void start_boot_trace(void); |
| 38 | |
| 39 | /* Resume the tracing of other necessary events |
| 40 | * such as sched switches |
| 41 | */ |
| 42 | extern void enable_boot_trace(void); |
| 43 | |
| 44 | /* Suspend this tracing. Actually, only sched_switches tracing have |
| 45 | * to be suspended. Initcalls doesn't need it.) |
| 46 | */ |
| 47 | extern void disable_boot_trace(void); |
| 48 | #else |
Frederic Weisbecker | 7423907 | 2008-11-11 23:24:42 +0100 | [diff] [blame] | 49 | static inline |
| 50 | void trace_boot_call(struct boot_trace_call *bt, initcall_t fn) { } |
| 51 | |
| 52 | static inline |
| 53 | void trace_boot_ret(struct boot_trace_ret *bt, initcall_t fn) { } |
| 54 | |
Frederic Weisbecker | 3f5ec13 | 2008-11-11 23:21:31 +0100 | [diff] [blame] | 55 | static inline void start_boot_trace(void) { } |
| 56 | static inline void enable_boot_trace(void) { } |
| 57 | static inline void disable_boot_trace(void) { } |
| 58 | #endif /* CONFIG_BOOT_TRACER */ |
| 59 | |
| 60 | #endif /* __LINUX_TRACE_BOOT_H */ |