diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-03-05 04:28:45 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-03-05 04:28:45 -0500 |
commit | 526211bc58c4b3265352801c5a7f469af5c34711 (patch) | |
tree | 5bed7d4752ecec0ae349821d3600c2529c5219c1 | |
parent | 5e1607a00bd082972629d3d68c95c8bcf902b55a (diff) |
tracing: move utility functions from ftrace.h to kernel.h
Make common utility functions such as trace_printk() and
tracing_start()/tracing_stop() generally available to kernel
code.
Cc: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | include/linux/ftrace.h | 58 | ||||
-rw-r--r-- | include/linux/kernel.h | 58 |
2 files changed, 60 insertions, 56 deletions
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index fbb9c364e166..5b64303ec9f2 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h | |||
@@ -318,62 +318,6 @@ static inline void __ftrace_enabled_restore(int enabled) | |||
318 | # define trace_preempt_off(a0, a1) do { } while (0) | 318 | # define trace_preempt_off(a0, a1) do { } while (0) |
319 | #endif | 319 | #endif |
320 | 320 | ||
321 | #ifdef CONFIG_TRACING | ||
322 | extern int ftrace_dump_on_oops; | ||
323 | |||
324 | extern void tracing_start(void); | ||
325 | extern void tracing_stop(void); | ||
326 | extern void ftrace_off_permanent(void); | ||
327 | |||
328 | extern void | ||
329 | ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3); | ||
330 | |||
331 | /** | ||
332 | * trace_printk - printf formatting in the ftrace buffer | ||
333 | * @fmt: the printf format for printing | ||
334 | * | ||
335 | * Note: __trace_printk is an internal function for trace_printk and | ||
336 | * the @ip is passed in via the trace_printk macro. | ||
337 | * | ||
338 | * This function allows a kernel developer to debug fast path sections | ||
339 | * that printk is not appropriate for. By scattering in various | ||
340 | * printk like tracing in the code, a developer can quickly see | ||
341 | * where problems are occurring. | ||
342 | * | ||
343 | * This is intended as a debugging tool for the developer only. | ||
344 | * Please refrain from leaving trace_printks scattered around in | ||
345 | * your code. | ||
346 | */ | ||
347 | # define trace_printk(fmt...) __trace_printk(_THIS_IP_, fmt) | ||
348 | extern int | ||
349 | __trace_printk(unsigned long ip, const char *fmt, ...) | ||
350 | __attribute__ ((format (printf, 2, 3))); | ||
351 | # define ftrace_vprintk(fmt, ap) __trace_printk(_THIS_IP_, fmt, ap) | ||
352 | extern int | ||
353 | __ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap); | ||
354 | extern void ftrace_dump(void); | ||
355 | #else | ||
356 | static inline void | ||
357 | ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3) { } | ||
358 | static inline int | ||
359 | trace_printk(const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); | ||
360 | |||
361 | static inline void tracing_start(void) { } | ||
362 | static inline void tracing_stop(void) { } | ||
363 | static inline void ftrace_off_permanent(void) { } | ||
364 | static inline int | ||
365 | trace_printk(const char *fmt, ...) | ||
366 | { | ||
367 | return 0; | ||
368 | } | ||
369 | static inline int | ||
370 | ftrace_vprintk(const char *fmt, va_list ap) | ||
371 | { | ||
372 | return 0; | ||
373 | } | ||
374 | static inline void ftrace_dump(void) { } | ||
375 | #endif | ||
376 | |||
377 | #ifdef CONFIG_FTRACE_MCOUNT_RECORD | 321 | #ifdef CONFIG_FTRACE_MCOUNT_RECORD |
378 | extern void ftrace_init(void); | 322 | extern void ftrace_init(void); |
379 | extern void ftrace_init_module(struct module *mod, | 323 | extern void ftrace_init_module(struct module *mod, |
@@ -542,6 +486,8 @@ static inline int test_tsk_trace_graph(struct task_struct *tsk) | |||
542 | return tsk->trace & TSK_TRACE_FL_GRAPH; | 486 | return tsk->trace & TSK_TRACE_FL_GRAPH; |
543 | } | 487 | } |
544 | 488 | ||
489 | extern int ftrace_dump_on_oops; | ||
490 | |||
545 | #endif /* CONFIG_TRACING */ | 491 | #endif /* CONFIG_TRACING */ |
546 | 492 | ||
547 | 493 | ||
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 7fa371898e3e..08bf5da86676 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
@@ -368,6 +368,64 @@ static inline char *pack_hex_byte(char *buf, u8 byte) | |||
368 | #endif | 368 | #endif |
369 | 369 | ||
370 | /* | 370 | /* |
371 | * General tracing related utility functions - trace_printk(), | ||
372 | * tracing_start()/tracing_stop: | ||
373 | */ | ||
374 | #ifdef CONFIG_TRACING | ||
375 | extern void tracing_start(void); | ||
376 | extern void tracing_stop(void); | ||
377 | extern void ftrace_off_permanent(void); | ||
378 | |||
379 | extern void | ||
380 | ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3); | ||
381 | |||
382 | /** | ||
383 | * trace_printk - printf formatting in the ftrace buffer | ||
384 | * @fmt: the printf format for printing | ||
385 | * | ||
386 | * Note: __trace_printk is an internal function for trace_printk and | ||
387 | * the @ip is passed in via the trace_printk macro. | ||
388 | * | ||
389 | * This function allows a kernel developer to debug fast path sections | ||
390 | * that printk is not appropriate for. By scattering in various | ||
391 | * printk like tracing in the code, a developer can quickly see | ||
392 | * where problems are occurring. | ||
393 | * | ||
394 | * This is intended as a debugging tool for the developer only. | ||
395 | * Please refrain from leaving trace_printks scattered around in | ||
396 | * your code. | ||
397 | */ | ||
398 | # define trace_printk(fmt...) __trace_printk(_THIS_IP_, fmt) | ||
399 | extern int | ||
400 | __trace_printk(unsigned long ip, const char *fmt, ...) | ||
401 | __attribute__ ((format (printf, 2, 3))); | ||
402 | # define ftrace_vprintk(fmt, ap) __trace_printk(_THIS_IP_, fmt, ap) | ||
403 | extern int | ||
404 | __ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap); | ||
405 | extern void ftrace_dump(void); | ||
406 | #else | ||
407 | static inline void | ||
408 | ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3) { } | ||
409 | static inline int | ||
410 | trace_printk(const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); | ||
411 | |||
412 | static inline void tracing_start(void) { } | ||
413 | static inline void tracing_stop(void) { } | ||
414 | static inline void ftrace_off_permanent(void) { } | ||
415 | static inline int | ||
416 | trace_printk(const char *fmt, ...) | ||
417 | { | ||
418 | return 0; | ||
419 | } | ||
420 | static inline int | ||
421 | ftrace_vprintk(const char *fmt, va_list ap) | ||
422 | { | ||
423 | return 0; | ||
424 | } | ||
425 | static inline void ftrace_dump(void) { } | ||
426 | #endif | ||
427 | |||
428 | /* | ||
371 | * Display an IP address in readable format. | 429 | * Display an IP address in readable format. |
372 | */ | 430 | */ |
373 | 431 | ||