-
-P pid
-
This will filter only the specified process IDs. Using -P will let you
trace only events that are caused by the process.
-
-c
-
Used -P to trace the process' children too (if kernel supports it).
-
--user
-
Execute the specified command as given user.
-
-C clock
-
Set the trace clock to "clock".
Use trace-cmd(1) list -C to see what clocks are available.
-
-l function-name
-
This will limit the function and function_graph tracers to only trace
the given function name. More than one -l may be specified on the
command line to trace more than one function. The limited use of glob
expressions are also allowed. These are match* to only filter functions
that start with match. *match to only filter functions that end with
match. *match\* to only filter on functions that contain match.
-
-g function-name
-
This option is for the function_graph plugin. It will graph the given
function. That is, it will only trace the function and all functions that
it calls. You can have more than one -g on the command line.
-
-n function-name
-
This has the opposite effect of -l. The function given with the -n
option will not be traced. This takes precedence, that is, if you include
the same function for both -n and -l, it will not be traced.
-
-d
-
Some tracer plugins enable the function tracer by default. Like the
latency tracers. This option prevents the function tracer from being
enabled at start up.
-
-D
-
The option -d will try to use the function-trace option to disable the
function tracer (if available), otherwise it defaults to the proc file:
/proc/sys/kernel/ftrace_enabled, but will not touch it if the function-trace
option is available. The -D option will disable both the ftrace_enabled
proc file as well as the function-trace option if it exists.
Note, this disable function tracing for all users, which includes users
outside of ftrace tracers (stack_tracer, perf, etc).
-
-O option
-
Ftrace has various options that can be enabled or disabled. This allows
you to set them. Appending the text no to an option disables it.
For example: "-O nograph-time" will disable the "graph-time" Ftrace
option.
-
-b size
-
This sets the ring buffer size to size kilobytes. Because the Ftrace
ring buffer is per CPU, this size is the size of each per CPU ring buffer
inside the kernel. Using "-b 10000" on a machine with 4 CPUs will make
Ftrace have a total buffer size of 40 Megs.
-
-B buffer-name
-
If the kernel supports multiple buffers, this will add a buffer with
the given name. If the buffer name already exists, that buffer is just
reset.
After a buffer name is stated, all events added after that will be
associated with that buffer. If no buffer is specified, or an event
is specified before a buffer name, it will be associated with the
main (toplevel) buffer.
trace-cmd set -e sched -B block -e block -B time -e timer sleep 1
The above is will enable all sched events in the main buffer. It will
then create a 'block' buffer instance and enable all block events within
that buffer. A 'time' buffer instance is created and all timer events
will be enabled for that event.
-
-m size
-
The max size in kilobytes that a per cpu buffer should be. Note, due
to rounding to page size, the number may not be totally correct.
Also, this is performed by switching between two buffers that are half
the given size thus the output may not be of the given size even if
much more was written.
Use this to prevent running out of diskspace for long runs.
-
-M cpumask
-
Set the cpumask for to trace. It only affects the last buffer instance
given. If supplied before any buffer instance, then it affects the
main buffer. The value supplied must be a hex number.
trace-cmd set -p function -M c -B events13 -e all -M 5
If the -M is left out, then the mask stays the same. To enable all
CPUs, pass in a value of '-1'.
-
-i
-
By default, if an event is listed that trace-cmd does not find, it
will exit with an error. This option will just ignore events that are
listed on the command line but are not found on the system.
-
-q | --quiet
-
Suppresses normal output, except for errors.
-
--max-graph-depth depth
-
Set the maximum depth the function_graph tracer will trace into a function.
A value of one will only show where userspace enters the kernel but not any
functions called in the kernel. The default is zero, which means no limit.
-
--cmdlines-size size
-
Set the number of entries the kernel tracing file "saved_cmdlines" can
contain. This file is a circular buffer which stores the mapping between
cmdlines and PIDs. If full, it leads to unresolved cmdlines ("<…>") within
the trace. The kernel default value is 128.
-
--module module
-
Filter a module’s name in function tracing. It is equivalent to adding
:mod:module after all other functions being filtered. If no other function
filter is listed, then all modules functions will be filtered in the filter.
'--module snd' is equivalent to '-l :mod:snd'
'--module snd -l "*jack*"' is equivalent to '-l "*jack*:mod:snd"'
'--module snd -n "*"' is equivalent to '-n :mod:snd'
-
--stderr
-
Have output go to stderr instead of stdout, but the output of the command
executed will not be changed. This is useful if you want to monitor the
output of the command being executed, but not see the output from trace-cmd.
-
--fork
-
If a command is listed, then trace-cmd will wait for that command to finish,
unless the --fork option is specified. Then it will fork the command and
return immediately.
-
--verbose[=level]
-
Set the log level. Supported log levels are "none", "critical", "error", "warning",
"info", "debug", "all" or their identifiers "0", "1", "2", "3", "4", "5", "6". Setting the log
level to specific value enables all logs from that and all previous levels.
The level will default to "info" if one is not specified.
Example: enable all critical, error and warning logs
trace-cmd set --verbose=warning