TRACE-CMD-SET(1)
๐ trace-cmd-set โ the libtracefs manual, but make it make sense
okay so bestie, welcome to trace-cmd-set(1) โ yes that's a real manpage name and yes we're gonna get through it together ๐ซถ. This is the one where you poke the Ftrace Linux internal tracer and tell it how to behave. It's giving "settings menu but for kernel tracing" energy and honestly? iconic.
โจ NAME โจ
trace-cmd-set โ set a configuration parameter of the Ftrace Linux internal tracer. no cap, that's literally the whole job ๐
๐ธ SYNOPSIS ๐ธ
trace-cmd set [OPTIONS] [command]
๐ฆ DESCRIPTION ๐ฆ
so here's the tea, bestie: the trace-cmd(1) set command sets a configuration parameter of the Ftrace Linux kernel tracer. that's the main character move here ๐
and the fun part? the specified command gets run after the ftrace state is set. so you configure the vibe, then your command hops in and does its thing.
the configured ftrace state can be restored to default using the trace-cmd-reset(1) command โ so like, there's a "undo my whole personality" button and it's that one ๐ฅ
๐ OPTIONS ๐
-ptracer โ specify a tracer. tracers usually do more than just trace an event, they've got layers okay. the common ones are:function,function_graph,preemptirqsoff,irqsoff,preemptoffandwakeup. a tracer must be supported by the running kernel (rude but true). to see a list of available tracers, seetrace-cmd-list(1)โจ-eevent โ specify an event to trace. various static trace points have been added to the Linux kernel, grouped by subsystem, where you can enable all events of a given subsystem or specify specific events to be enabled. the event is of the format"subsystem:event-name". you can also just specify the subsystem without the:event-name, or theevent-namewithout the"subsystem:". using-e sched_switchwill enable the"sched_switch"event, whereas-e schedwill enable all events under the"sched"subsystem ๐
the event can also contain glob expressions. that is, "*stat*" will select all events (or subsystems) that have the characters "stat" in their names. and the keyword all can be used to enable all events ๐
-Tโ enable a stacktrace on each event. for example:
<idle>-0 [003] 58549.289091: sched_switch: kworker/0:1:0 [120] R ==> trace-cmd:2603 [120]
<idle>-0 [003] 58549.289092: kernel_stack: <stack trace>
=> schedule (ffffffff814b260e)
=> cpu_idle (ffffffff8100a38c)
=> start_secondary (ffffffff814ab828)
--func-stackโ enable a stack trace on all functions. heads up bestie, this is only applicable for the"function"plugin tracer, and will only take effect if the-loption is used and succeeds in limiting functions.
โ ๏ธ if the function tracer is not filtered, and the stack trace is enabled, you can live lock the machine. not a cute look. deadass, be careful ๐
-ffilter โ specify a filter for the previous event. this must come after a-e. it filters what events get recorded based on the content of the event. filtering is passed to the kernel directly so what filtering is allowed may depend on what version of the kernel you have. basically, it lets you use C notation to check if an event should be processed or not ๐ง
these are usually safe to use to compare fields:
==, >=, <=, >, <, &, |, && and ||
-Rtrigger โ specify a trigger for the previous event. this must come after a-e. it adds a given trigger to the given event. if you want to only enable the trigger and not the event itself, then place the event after the-voption ๐
see Documentation/trace/events.txt in the Linux kernel source for more information on triggers.
-vโ this will negate options specified after it on the command line. it affects:-e: causes all specified events to not be traced. this is useful for selecting a subsystem to be traced but to leave out various events. for example:"-e sched -v -e "*stat*""will enable all events in the sched subsystem except those that have"stat"in their names.-B: deletes the specified ftrace instance. there must be no configuration options related to this instance in the command line. for example:"-v -B bar -B foo"will delete instancebarand create a new instancefoo.
note: the -v option was taken from the way grep(1) inverts the following matches. iykyk ๐
-Ppid โ this will filter only the specified process IDs. using-Pwill let you trace only events that are caused by the process ๐-cโ used with-Pto trace the process' children too (if the kernel supports it).--userโ execute the specified command as given user.-Cclock โ set the trace clock to"clock".
use trace-cmd(1) list -C to see what clocks are available โญ
-lfunction-name โ this will limit thefunctionandfunction_graphtracers to only trace the given function name. more than one-lmay be specified on the command line to trace more than one function. the limited use of glob expressions is also allowed ๐:match*to only filter functions that start withmatch*matchto only filter functions that end withmatch*match\*to only filter on functions that containmatch
-gfunction-name โ this option is for thefunction_graphplugin. 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-gon the command line ๐ฆ-nfunction-name โ this has the opposite effect of-l. the function given with the-noption will not be traced. and it takes precedence โ that is, if you include the same function for both-nand-l, it will not be traced. sorry babe,-nwins ๐-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-dwill 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-Doption will disable both theftrace_enabledproc file as well as the function-trace option if it exists.
โ ๏ธ note, this disables function tracing for all users, which includes users outside of ftrace tracers (stack_tracer, perf, etc). it's giving "main character energy but it affects everyone in the group chat" ๐ญ
-Ooption โ Ftrace has various options that can be enabled or disabled. this allows you to set them. appending the textnoto an option disables it. for example:"-O nograph-time"will disable the"graph-time"Ftrace option โจ-bsize โ 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 ๐ฅ-Bbuffer-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 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. literally so organized of them ๐
-msize โ 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. bestie your disk will thank you ๐ซถ
-Mcpumask โ 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. we love a forgiving queen ๐-q|--quietโ suppresses normal output, except for errors. silence is golden ๐--max-graph-depthdepth โ set the maximum depth thefunction_graphtracer 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-sizesize โ 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 ๐--modulemodule โ filter a module's name in function tracing. it is equivalent to adding:mod:moduleafter 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. separation queen ๐--forkโ if a command is listed, then trace-cmd will wait for that command to finish, unless the--forkoption is specified. then it will fork the command and return immediately. no waiting around, we're busy ๐--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
๐ฅ EXAMPLES ๐ฅ
enable all events for tracing:
# trace-cmd set -e all
set the function tracer:
# trace-cmd set -p function
๐ SEE ALSO ๐
trace-cmd(1), trace-cmd-report(1), trace-cmd-start(1), trace-cmd-stop(1), trace-cmd-extract(1), trace-cmd-reset(1), trace-cmd-split(1), trace-cmd-list(1), trace-cmd-listen(1), trace-cmd-profile(1)
okay and that's not even the end bestie โ there's more coming, don't go anywhere ๐
๐ธ AUTHOR ๐ธ
Ok so this page was written by Tzvetomir Stoyanov (VMware)</> โ yes bestie, an actual human, and you can reach him at tz.stoyanov@gmail.com ๐ซถ
๐ฆ RESOURCES ๐ฆ
Wanna go stare at the source code like it's a celebrity? It lives right here, no cap:
https://git.kernel.org/pub/scm/utils/trace-cmd/trace-cmd.git/
Click it, clone it, obsess over it. It's giving open source main character energy โจ
๐ COPYING ๐
Copyright (C) 2010 Red Hat, Inc. โ free use of this software is granted under the terms of the GNU Public License (GPL). ๐
So yeah, it's free to use, but the GPL is the vibe check you gotta respect fr fr. Read the license, bestie โ it's not optional, it's a whole lifestyle.</> ๐
โญ NOTES โญ
tz.stoyanov@gmail.commailto:tz.stoyanov@gmail.com
That's the footnote from the AUTHOR bit โ same email, just clickable this time. iykyk ๐ง
And that's the whole page, bestie! ๐ You ate that. ๐
This gem is from libtracefs, dated 03/09/2026, and it's the TRACE-CMD-SET(1) manual page โ go forth and set your traces like the icon you are. ๐ โจ ๐</>
๐ฆ where this page comes from
- arch rolling: trace-cmd 3.4-1 ยท GPL-2.0-only AND LGPL-2.1-only
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms