centos man page for trace_printk

Query: trace_printk

OS: centos

Section: 9

Links: centos man pages   all man pages

Forums: unix linux community   forum categories

Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar

TRACE_PRINTK(9) 						   Driver Basics						   TRACE_PRINTK(9)

NAME
trace_printk - printf formatting in the ftrace buffer
SYNOPSIS
trace_printk(fmt, ...);
ARGUMENTS
fmt the printf format for printing ... variable arguments
NOTE
__trace_printk is an internal function for trace_printk and the ip is passed in via the trace_printk macro. This function allows a kernel developer to debug fast path sections that printk is not appropriate for. By scattering in various printk like tracing in the code, a developer can quickly see where problems are occurring. This is intended as a debugging tool for the developer only. Please refrain from leaving trace_printks scattered around in your code. (Extra memory is used for special buffers that are allocated when trace_printk is used) A little optization trick is done here. If there's only one argument, there's no need to scan the string for printf formats. The trace_puts will suffice. But how can we take advantage of using trace_puts when trace_printk has only one argument? By stringifying the args and checking the size we can tell whether or not there are args. __stringify((__VA_ARGS__)) will turn into "()" with a size of 3 when there are no args, anything else will be bigger. All we need to do is define a string to this, and then take its size and compare to 3. If it's bigger, use do_trace_printk otherwise, optimize it to trace_puts. Then just let gcc optimize the rest.
COPYRIGHT
Kernel Hackers Manual 3.10 June 2014 TRACE_PRINTK(9)
Related Man Pages
trace_printk(9) - centos
vsnprintf(9) - centos
verrx(3) - redhat
vprintf(3int) - ultrix
vfprintf(3s) - hpux
Similar Topics in the Unix Linux Community
Drupal developer Barry Jaspan discusses Acquia (video)
The LimitRequestBody filed in openSUSE 10.2
printf formatting
How can I get data in the sk_buff?
kernel hacking