PMCSTAT(8) | MidnightBSD System Manager's Manual | PMCSTAT(8) |
pmcstat
—
performance measurement with performance monitoring
hardware
pmcstat |
[-C ] [-D
pathname] [-E ]
[-F pathname]
[-G pathname]
[-I ] [-L ]
[-M mapfilename]
[-N ] [-O
logfilename] [-P
event-spec] [-R
logfilename] [-S
event-spec] [-T ]
[-U ] [-W ]
[-a pathname]
[-c cpu-spec]
[-d ] [-e ]
[-f pluginopt]
[-g ] [-i
lwp] [-k
kerneldir] [-l
secs] [-m
pathname] [-n
rate] [-o
outputfile] [-p
event-spec] [-q ]
[-r fsroot]
[-s event-spec]
[-t process-spec]
[-u event-spec]
[-v ] [-w
secs] [-z
graphdepth] [command
[args]] |
The pmcstat
utility measures system
performance using the facilities provided by
hwpmc(4).
The pmcstat
utility can measure both
hardware events seen by the system as a whole, and those seen when a
specified set of processes are executing on the system's CPUs. If a specific
set of processes is being targeted (for example, if the
-t
process-spec option is
specified, or if a command line is specified using
command), then measurement occurs till
command exits, or till all target processes specified
by the -t
process-spec options
exit, or till the pmcstat
utility is interrupted by
the user. If a specific set of processes is not targeted for measurement,
then pmcstat
will perform system-wide measurements
till interrupted by the user.
A given invocation of pmcstat
can mix
allocations of system-mode and process-mode PMCs, of both counting and
sampling flavors. The values of all counting PMCs are printed in human
readable form at regular intervals by pmcstat
. The
output of sampling PMCs may be configured to go to a log file for subsequent
offline analysis, or, at the expense of greater overhead, may be configured
to be printed in text form on the fly.
Hardware events to measure are specified to
pmcstat
using event specifier strings
event-spec. The syntax of these event specifiers is
machine dependent and is documented in
pmc(3).
A process-mode PMC may be configured to be inheritable by the target process' current and future children.
The following options are available:
-C
-D
pathname-E
-d
option. The default is to not to enable per-process tracking.-F
pathname-
” this information is sent to
the output file specified by the -o
option.-G
pathname-
” this information is sent to the
output file specified by the -o
option.-I
-L
-M
mapfilename-
” in which case this mapping
information is sent to the output file configured by the
-o
option.-N
-O
logfilename.
’ or a
‘/
’, then
pmcstat
will open a network socket to host
hostname on port port.
If the -O
option is not specified and
one of the logging options is requested, then
pmcstat
will print a textual form of the logged
events to the configured output file.
-P
event-spec-R
logfilename-S
event-spec-T
-U
-W
-a
pathname-m
that only resolves the first symbol in the
graph, this resolves every node in the callgraph, or prints out addresses
if no lookup information is available. This option requires the
-R
option to read in samples that were previously
collected and saved with the -O
option.-c
cpu-spec-d
-p
, -s
,
-P
, or -S
).-e
-f
pluginopt-g
-i
lwp-o
lwp
.-k
kerneldirpmcstat
should look for the kernel and its
modules. The default is to use the path of the running kernel obtained
from the kern.bootfile sysctl.-l
secs-m
pathname-
” this information is sent to the
output file specified by the -o
option. This
option requires the -R
option to read in samples
that were previously collected and saved with the
-O
option.-n
rate-o
outputfile-p
event-spec-q
-r
fsroot-s
event-spec-t
process-spec-u
event-spec-v
-w
secs-z
graphdepthIf command is specified, it is executed using execvp(3).
To perform system-wide statistical sampling on an AMD Athlon CPU with samples taken every 32768 instruction retirals and data being sampled to file sample.stat, use:
pmcstat -O sample.stat -n 32768 -S
k7-retired-instructions
To execute firefox
and measure the number
of data cache misses suffered by it and its children every 12 seconds on an
AMD Athlon, use:
pmcstat -d -w 12 -p k7-dc-misses
firefox
To measure instructions retired for all processes named “emacs” use:
pmcstat -t '^emacs$' -p
instructions
To measure instructions retired for processes named “emacs” for a period of 10 seconds use:
pmcstat -t '^emacs$' -p instructions
sleep 10
To count instruction tlb-misses on CPUs 0 and 2 on a Intel Pentium Pro/Pentium III SMP system use:
pmcstat -c 0,2 -s
p6-itlb-miss
To collect profiling information for a specific process with pid 1234 based on instruction cache misses seen by it use:
pmcstat -P ic-misses -t 1234 -O
/tmp/sample.out
To perform system-wide sampling on all configured processors based on processor instructions retired use:
pmcstat -S instructions -O
/tmp/sample.out
pmcstat -N -S instructions -O
/tmp/sample.out
To send the generated event log to a remote machine use:
pmcstat -S instructions -O
remotehost:port
nc -l remotehost port >
/tmp/sample.out
To generate gprof(1) compatible profiles from a sample file use:
pmcstat -R /tmp/sample.out
-g
To print a system-wide profile with callgraphs to file foo.graph use:
pmcstat -R /tmp/sample.out -G
foo.graph
If option -v
is specified,
pmcstat
may issue the following diagnostic
messages:
The pmcstat
utility exits 0 on success,
and >0 if an error occurs.
Due to the limitations of the gmon.out
file format, gprof(1)
compatible profiles generated by the -g
option do
not contain information about calls that cross executable boundaries. The
generated gmon.out files are also only meaningful
for native executables.
gprof(1), nc(1), execvp(3), pmc(3), pmclog(3), hwpmc(4), pmccontrol(8), sysctl(8)
The pmcstat
utility first appeared in
FreeBSD 6.0. It is currently under development.
Joseph Koshy <jkoshy@FreeBSD.org>
The pmcstat
utility cannot yet analyse
hwpmc(4) logs generated by
non-native architectures.
May 25, 2018 | midnightbsd-3.1 |