aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/kernel.h
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-03-05 04:28:45 -0500
committerIngo Molnar <mingo@elte.hu>2009-03-05 04:28:45 -0500
commit526211bc58c4b3265352801c5a7f469af5c34711 (patch)
tree5bed7d4752ecec0ae349821d3600c2529c5219c1 /include/linux/kernel.h
parent5e1607a00bd082972629d3d68c95c8bcf902b55a (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>
Diffstat (limited to 'include/linux/kernel.h')
-rw-r--r--include/linux/kernel.h58
1 files changed, 58 insertions, 0 deletions
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
375extern void tracing_start(void);
376extern void tracing_stop(void);
377extern void ftrace_off_permanent(void);
378
379extern void
380ftrace_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)
399extern 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)
403extern int
404__ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap);
405extern void ftrace_dump(void);
406#else
407static inline void
408ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3) { }
409static inline int
410trace_printk(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
411
412static inline void tracing_start(void) { }
413static inline void tracing_stop(void) { }
414static inline void ftrace_off_permanent(void) { }
415static inline int
416trace_printk(const char *fmt, ...)
417{
418 return 0;
419}
420static inline int
421ftrace_vprintk(const char *fmt, va_list ap)
422{
423 return 0;
424}
425static 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