uftrace1
Function graph tracer for userspace
Usage
uftrace [{record | replay | live | report | info | dump | recv | graph | script | tui}]
[options]
COMMAND
[command-options]
Overview
The uftrace tool is a function tracer that traces the execution of given COMMAND at the function level. COMMAND should be a C or C++ executable built with compiler instrumentation (-pg or -finstrument-functions). COMMAND needs to have an ELF symbol table (i.e. not be strip(1)-ed) in order for the names of traced functions to be available.
The uftrace command consists of a number of sub-commands, in the manner of git(1) or perf(1). Below is a short description of each sub-command. For more detailed information, see the respective manual pages. The options in this page can be given to any sub-command also.
For convenience, if no sub-command is given, uftrace acts as though the live sub-command was specified, which runs the record and replay sub-commands in turn. See uftrace-live(1) for options belonging to the live sub-command. For more detailed analysis, it is better to use uftrace-record(1) to save trace data, and then analyze it with other uftrace commands like uftrace-replay(1), uftrace-report(1), uftrace-info(1), uftrace-dump(1), uftrace-script(1) or uftrace-tui(1).
Sub-commands
record
|
Run a given command and save trace data in a data file or directory. |
|---|---|
replay
|
Print recorded function trace data with time durations. |
live
|
Do live tracing. Print function trace of the given command. |
report
|
Print various statistics and summary of the recorded trace data. |
info
|
Print side-band information like OS version, CPU info, command line and so on. |
dump
|
Print raw tracing data in the data files. |
recv
|
Save tracing data sent to network |
graph
|
Print function call graph |
script
|
Run a script for recorded function trace |
tui
|
Show text user interface for graph and report |
Options
These are the common options supported by all uftrace subcommands:
-
-h, --help -
Print help message and list of options with description
-
--usage -
Print usage string
-
-V, --version -
Print program version
-
-v, --verbose -
Print verbose messages. This option increases a debug level and can be used at most 3 times.
-
--debug -
Print debug messages. This option is same as
-v/--verboseand is provided only for backward compatibility.
- --debug-domain=DOMAIN[,DOMAIN, ...]
-
Limit the printing of debug messages to those belonging to one of the DOMAINs specified. Available domains are: uftrace, symbol, demangle, filter, fstack, session, kernel, mcount, dynamic, event, script and dwarf. The domains can have an their own debug level optionally (preceded by a colon). For example,
-v --debug-domain=filter:2will apply debug level of 2 to the “filter” domain and apply debug level of 1 to others.
-
-d DATA, --data=DATA -
Specify name of trace data (directory). Default is
uftrace.data.
-
--logfile=FILE -
Save warning and debug messages into this file instead of stderr.
-
--color=VAL -
Enable or disable color on the output. Possible values are “yes”(= “true” | “1” | “on” ), “no”(= “false” | “0” | “off” ) and “auto”. The “auto” value is default and turns on coloring if stdout is a terminal.
-
--no-pager -
Do not use a pager.
-
--opt-file=FILE -
Read command-line options from the FILE.
Options
These options are listed here for completeness, but are only effective with specific subcommands.
Please see the uftrace-<subcommand> manual pages for more information: The manual for uftrace-live(1) is special: The subcommand live does record and replay internally. Thus, it describes most regular option in detail.
-
--avg-self -
Show average/min/max of self function time
-
--avg-total -
Show average/min/max of total function time
-
-a, --auto-args -
Show arguments and return value of known functions
-
-A, --argument=FUNC@arg[,arg,...] -
Show function arguments
-
-b, --buffer=SIZE -
Size of tracing buffer (default: 128K)
-
--chrome -
Dump recorded data in chrome trace format
-
--clock -
Set clock source for timestamp (default: mono)
-
--column-offset=DEPTH -
Offset of each column (default: 8)
-
--column-view -
Print tasks in separate columns
-
-C, --caller-filter=FUNC -
Only trace callers of those FUNCs
-
--demangle=TYPE -
C++ symbol demangling: full, simple, no (default: simple)
-
--diff=DATA -
Report differences
-
--diff-policy=POLICY -
Control diff report policy (default: `abs,compact,no-percent')
-
--disable -
Start with tracing disabled
-
-D, --depth=DEPTH -
Trace functions within DEPTH
-
-e, --estimate-return -
Use only entry record type for safety
-
--event-full -
Show all events outside of function
-
-E, --Event=EVENT -
Enable EVENT to save more information
-
--flame-graph -
Dump recorded data in FlameGraph format
-
--flat -
Use flat output format
-
--force -
Trace even if executable is not instrumented
-
--format=FORMAT -
Use FORMAT for output: normal, html (default: normal)
-
-f, --output-fields=FIELD -
Show FIELDs in the replay or graph output
-
-F, --filter=FUNC -
Only trace those FUNCs
-
-g, --agent -
Start an agent in mcount to listen to commands
-
--graphviz -
Dump recorded data in DOT format
-
-H, --hide=FUNC -
Hide FUNCs from trace
-
--host=HOST -
Send trace data to HOST instead of write to file
-
-k, --kernel -
Trace kernel functions also (if supported)
-
--keep-pid -
Keep same pid during execution of traced program
-
--kernel-buffer=SIZE -
Size of kernel tracing buffer (default: 1408K)
-
--kernel-full -
Show kernel functions outside of user
-
--kernel-only -
Dump kernel data only
-
--kernel-skip-out -
Skip kernel functions outside of user (deprecated)
-
-K, --kernel-depth=DEPTH -
Trace kernel functions within DEPTH
-
--libmcount-single -
Use single thread version of libmcount
-
--list-event -
List available events
-
--logfile=FILE -
Save warning and debug messages into this file instead of stderr.
-
-l, --nest-libcall -
Show nested library calls
-
--libname -
Show libname name with symbol name
-
--libmcount-path=PATH -
Load libmcount libraries from this PATH
-
--match=TYPE -
Support pattern match: regex, glob (default: regex)
-
--max-stack=DEPTH -
Set max stack depth to DEPTH (default: 65535)
-
--no-args -
Do not show arguments and return value
-
--no-comment -
Don’t show comments of returned functions
-
--no-event -
Disable (default) events
-
--no-sched -
Disable schedule events
-
--no-sched-preempt -
Hide pre-emptive schedule event but show regular(sleeping) schedule event
-
--no-libcall -
Don’t trace library function calls
-
--no-merge -
Don’t merge leaf functions
-
--no-pltbind -
Do not bind dynamic symbols (LD_BIND_NOT)
-
--no-randomize-addr -
Disable ASLR (Address Space Layout Randomization)
-
--nop -
No operation (for performance test)
-
--num-thread=NUM -
Create NUM recorder threads
-
-N, --notrace=FUNC -
Don’t trace those FUNCs
-
-p, --pid=PID -
Connect to the PID of an interactive mcount instance
-
--port=PORT -
Use PORT for network connection (default: 8090)
-
-P, --patch=FUNC -
Apply dynamic patching for FUNCs
-
--record -
Record a new trace before running given script
-
--report -
Show a live report before replay
-
--rt-prio=PRIO -
Record with real-time (FIFO) priority
-
-r, --time-range=TIME~TIME -
Show output within the TIME (timestamp or elapsed time) range only
-
--run-cmd=CMDLINE -
Command line that want to execute after tracing data received
-
-R, --retval=FUNC[@retspec] -
Show function return values for FUNC, optionally with given uftrace retspec
-
--sample-time=TIME -
Show flame graph with this sampling time
-
--signal=SIGNAL@act[,act,...] -
Trigger the given actions when the given SIGNAL is received
-
--sort-column=INDEX -
Sort diff report on column INDEX (default: 2)
-
--srcline -
Enable recording source line info
-
--symbols -
Print symbol table instead of the recorded tracing info
-
-s, --sort=KEY[,KEY,...] -
Sort reported functions by KEYs (default: 2)
-
-S, --script=SCRIPT -
Run a given SCRIPT in function entry and exit
-
-t, --time-filter=TIME -
Hide small functions run less than the TIME
-
--task -
Print task relationship in a tree form instead of the tracing info.
-
--task-newline -
Interleave a newline when task is changed
-
--tid=TID[,TID,...] -
Only replay those tasks
-
--time -
Print time information
-
-T, --trigger=FUNC@act[,act,...] -
Trigger action on those FUNCs
-
-U, --unpatch=FUNC -
Don’t apply dynamic patching for FUNCs
-
--with-syms=DIR -
Use symbol files in the DIR
-
-W, --watch=POINT -
Watch and report POINT if it’s changed
-
-Z, --size-filter=SIZE -
Apply dynamic patching for functions bigger than SIZE
For more detail about these command-specific options, please see the more specific manual pages listed below.
Releases
4 releases since Debian 9 (Stretch); the text changed 3 times.
--Event since Debian 13 (Trixie);
--agent since Debian 13 (Trixie);
--argument since Debian 13 (Trixie);
--auto-args since Debian 13 (Trixie);
--avg-self since Debian 13 (Trixie);
--avg-total since Debian 13 (Trixie);
--buffer since Debian 13 (Trixie);
--caller-filter since Debian 13 (Trixie);
--chrome since Debian 13 (Trixie);
--clock since Debian 13 (Trixie);
--column-offset since Debian 13 (Trixie);
--column-view since Debian 13 (Trixie);
--demangle since Debian 13 (Trixie);
--depth since Debian 13 (Trixie);
--diff since Debian 13 (Trixie);
--diff-policy since Debian 13 (Trixie);
--disable since Debian 13 (Trixie);
--estimate-return since Debian 13 (Trixie);
--event-full since Debian 13 (Trixie);
--filter since Debian 13 (Trixie);
--flame-graph since Debian 13 (Trixie);
--flat since Debian 13 (Trixie);
--force since Debian 13 (Trixie);
--format since Debian 13 (Trixie);
--graphviz since Debian 13 (Trixie);
--hide since Debian 13 (Trixie);
--host since Debian 13 (Trixie);
--keep-pid since Debian 13 (Trixie);
--kernel since Debian 13 (Trixie);
--kernel-buffer since Debian 13 (Trixie);
--kernel-depth since Debian 13 (Trixie);
--kernel-full since Debian 13 (Trixie);
--kernel-only since Debian 13 (Trixie);
--kernel-skip-out since Debian 13 (Trixie);
--libmcount-path since Debian 13 (Trixie);
--libmcount-single since Debian 13 (Trixie);
--libname since Debian 13 (Trixie);
--list-event since Debian 13 (Trixie);
--match since Debian 13 (Trixie);
--max-stack since Debian 13 (Trixie);
--nest-libcall since Debian 13 (Trixie);
--no-args since Debian 13 (Trixie);
--no-comment since Debian 13 (Trixie);
--no-event since Debian 13 (Trixie);
--no-libcall since Debian 13 (Trixie);
--no-merge since Debian 13 (Trixie);
--no-pltbind since Debian 13 (Trixie);
--no-randomize-addr since Debian 13 (Trixie);
--no-sched since Debian 13 (Trixie);
--no-sched-preempt since Debian 13 (Trixie);
--nop since Debian 13 (Trixie);
--notrace since Debian 13 (Trixie);
--num-thread since Debian 13 (Trixie);
--opt-file since Debian 10 (Buster);
--output-fields since Debian 13 (Trixie);
--patch since Debian 13 (Trixie);
--pid since Debian 13 (Trixie);
--port since Debian 13 (Trixie);
--record since Debian 13 (Trixie);
--report since Debian 13 (Trixie);
--retval since Debian 13 (Trixie);
--rt-prio since Debian 13 (Trixie);
--run-cmd since Debian 13 (Trixie);
--sample-time since Debian 13 (Trixie);
--script since Debian 13 (Trixie);
--signal since Debian 13 (Trixie);
--size-filter since Debian 13 (Trixie);
--sort since Debian 13 (Trixie);
--sort-column since Debian 13 (Trixie);
--srcline since Debian 13 (Trixie);
--symbols since Debian 13 (Trixie);
--task since Debian 13 (Trixie);
--task-newline since Debian 13 (Trixie);
--tid since Debian 13 (Trixie);
--time since Debian 13 (Trixie);
--time-filter since Debian 13 (Trixie);
--time-range since Debian 13 (Trixie);
--trigger since Debian 13 (Trixie);
--unpatch since Debian 13 (Trixie);
--watch since Debian 13 (Trixie);
--with-syms since Debian 13 (Trixie);
-A since Debian 13 (Trixie);
-C since Debian 13 (Trixie);
-D since Debian 13 (Trixie);
-E since Debian 13 (Trixie);
-F since Debian 13 (Trixie);
-H since Debian 13 (Trixie);
-K since Debian 13 (Trixie);
-N since Debian 13 (Trixie);
-P since Debian 13 (Trixie);
-R since Debian 13 (Trixie);
-S since Debian 13 (Trixie);
-T since Debian 13 (Trixie);
-U since Debian 13 (Trixie);
-W since Debian 13 (Trixie);
-Z since Debian 13 (Trixie);
-a since Debian 13 (Trixie);
-b since Debian 13 (Trixie);
-e since Debian 13 (Trixie);
-f since Debian 13 (Trixie);
-g since Debian 13 (Trixie);
-h since Debian 10 (Buster);
-k since Debian 13 (Trixie);
-l since Debian 13 (Trixie);
-p since Debian 13 (Trixie);
-r since Debian 13 (Trixie);
-s since Debian 13 (Trixie);
-t since Debian 13 (Trixie).
-? until Debian 10 (Buster).