Friday, April 8, 2011

Kernel Tracing (Notes from LWN)

Tracepoints
http://lwn.net/Articles/291091/
http://lwn.net/Articles/330402/
http://lwn.net/Articles/379903/
http://lwn.net/Articles/381064/
http://lwn.net/Articles/383362/
http://lwn.net/Articles/346470/
also look at the samples in source

Config options

CONFIG_FUNCTION_TRACER
CONFIG_FUNCTION_GRAPH_TRACER
CONFIG_STACK_TRACER
CONFIG_DYNAMIC_FTRACE
CONFIG_KALLSYMS

One
of the most powerful tracers of Ftrace is the function tracer. It uses
the -pg option of gcc to have every function in the kernel call a
special function "mcount()". When CONFIG_DYNAMIC_FTRACE is configured,
the call is converted to a NOP at boot time to keep the system running
at 100% performance. During compilation the mcount() call-sites are
recorded. That list is used at boot time to convert those sites to NOPs.
Since NOPs are pretty useless for tracing, the list is saved to convert
the call-sites back into trace calls when the function (or function
graph) tracer is enabled.


- task -
make your own tracepoint/event
trace it with the perf command... should be really easy to accomplish.
- end -

- available filers -
[tracing]# cat available_filter_functions | head -8
[tracing]# wc -l available_filter_functions
[tracing]# grep sched available_filter_functions > set_ftrace_filter
[tracing]# echo 'set*' > set_ftrace_filter
[tracing]# echo ':mod:tg3' > set_ftrace_filter
[tracing]# echo '!*lock*' >> set_ftrace_filter -- The '!' symbol will remove functions listed in the filter file.


No comments:

Post a Comment