TPROF(8) | System Manager's Manual | TPROF(8) |
tprof
— record
tprof profiling samples
tprof |
op [arguments] |
The tprof
tool can be used to monitor
hardware events (PMCs) during the execution of certain commands.
The tprof
utility makes the kernel driver
start profiling, executes the specified command, keeps recording samples
from the kernel driver until the command finishes, and reports statistics to
the standard error.
The tprof(4) pseudo driver and a suitable backend should be loaded beforehand.
The tprof
utility accepts the following
options. The first argument, op, specifies the action
to take. Valid actions are:
list
monitor
and
top
commandsmonitor
[-e
name[:
option][,
scale]]
[-e
...]
[-o
outfile]
commandu
(userland) and k
(kernel). If omitted, it is assumed that both are specified. Multiple
-e
arguments can be specified. If none of the
-e
arguments are specified, the CPU's default
counter is used.
scale specifies the ratio of the speed
to the cycle counter, or the counter until overflow. The counter reset
value on overflow used for profiling is calculated from the speed of the
cycle counter by default, but for some events this value may be too
large (counter increasing too slowly) to be sufficient for profiling.
For example, to specify an event that increases about 1000 times slower
than the cycle counter, specify ‘-e
event,1000
’. Also, if ‘-e
event,=200
’ is specified, profiling is performed every
time the counter is increased by 200.
The collected samples are written into the file outfile if specified. The default is tprof.out.
count
-e
name[:
option]
[-e
...]
[-i
interval]
commandmonitor
, but does not do any profiling,
only outputs counters every interval second.analyze
[-CkLPs
] [-p
pid] filetprof
, stored in file, and
generate a plain text representation of them.
-C
-k
-L
-P
-p
pid-s
top
[-acu
] [-e
name[,
scale]]
[-e
...]
[-i
interval]-a
-c
-i
interval-u
While tprof
top
is running, it accepts commands from the terminal. These commands are
currently recognized:
a
⟩c
⟩q
⟩tprof
.z
⟩The following command profiles the system during 20 seconds and writes the samples into the file myfile.out.
# tprof monitor -e llc-misses:k -o
myfile.out sleep 20
The following command displays the results of the sampling.
# tprof analyze
myfile.out
The following CPU models are supported:
The tprof
utility reports the following
statistics about the activities of the
tprof(4) pseudo driver.
The tprof
utility was written by
YAMAMOTO Takashi. It was revamped by
Maxime Villard in 2018, and by Ryo
Shimizu in 2022.
The contents and representation of recorded samples are undocumented and will likely be changed for future releases of NetBSD in an incompatible way.
April 17, 2023 | NetBSD 10.99 |