2008-06-29 10:30:06 +00:00
|
|
|
.\" Copyright (c) 2003-2008 Joseph Koshy
|
2007-12-07 08:26:21 +00:00
|
|
|
.\" Copyright (c) 2007 The FreeBSD Foundation
|
|
|
|
.\" All rights reserved.
|
2005-04-19 04:01:25 +00:00
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\"
|
|
|
|
.\" This software is provided by Joseph Koshy ``as is'' and
|
|
|
|
.\" any express or implied warranties, including, but not limited to, the
|
|
|
|
.\" implied warranties of merchantability and fitness for a particular purpose
|
|
|
|
.\" are disclaimed. in no event shall Joseph Koshy be liable
|
|
|
|
.\" for any direct, indirect, incidental, special, exemplary, or consequential
|
|
|
|
.\" damages (including, but not limited to, procurement of substitute goods
|
|
|
|
.\" or services; loss of use, data, or profits; or business interruption)
|
|
|
|
.\" however caused and on any theory of liability, whether in contract, strict
|
|
|
|
.\" liability, or tort (including negligence or otherwise) arising in any way
|
|
|
|
.\" out of the use of this software, even if advised of the possibility of
|
|
|
|
.\" such damage.
|
|
|
|
.\"
|
|
|
|
.\" $FreeBSD$
|
|
|
|
.\"
|
2020-08-17 10:51:03 +00:00
|
|
|
.Dd August 17, 2020
|
2005-04-19 04:01:25 +00:00
|
|
|
.Dt PMCSTAT 8
|
2010-04-14 19:08:06 +00:00
|
|
|
.Os
|
2005-04-19 04:01:25 +00:00
|
|
|
.Sh NAME
|
|
|
|
.Nm pmcstat
|
2005-06-24 17:24:55 +00:00
|
|
|
.Nd "performance measurement with performance monitoring hardware"
|
2005-04-19 04:01:25 +00:00
|
|
|
.Sh SYNOPSIS
|
|
|
|
.Nm
|
2020-08-05 19:05:49 +00:00
|
|
|
.Op Fl A
|
2005-04-19 04:01:25 +00:00
|
|
|
.Op Fl C
|
2005-06-30 19:01:26 +00:00
|
|
|
.Op Fl D Ar pathname
|
2005-06-09 19:45:09 +00:00
|
|
|
.Op Fl E
|
2010-02-11 22:51:44 +00:00
|
|
|
.Op Fl F Ar pathname
|
2007-12-07 08:26:21 +00:00
|
|
|
.Op Fl G Ar pathname
|
2018-05-25 18:11:13 +00:00
|
|
|
.Op Fl I
|
2018-05-26 19:29:19 +00:00
|
|
|
.Op Fl L
|
2006-03-26 12:20:54 +00:00
|
|
|
.Op Fl M Ar mapfilename
|
2007-12-07 08:26:21 +00:00
|
|
|
.Op Fl N
|
2005-04-19 04:01:25 +00:00
|
|
|
.Op Fl O Ar logfilename
|
|
|
|
.Op Fl P Ar event-spec
|
2005-06-09 19:45:09 +00:00
|
|
|
.Op Fl R Ar logfilename
|
2005-04-19 04:01:25 +00:00
|
|
|
.Op Fl S Ar event-spec
|
2010-02-11 22:51:44 +00:00
|
|
|
.Op Fl T
|
2018-06-04 01:10:23 +00:00
|
|
|
.Op Fl U
|
2005-06-09 19:45:09 +00:00
|
|
|
.Op Fl W
|
2014-04-29 07:17:33 +00:00
|
|
|
.Op Fl a Ar pathname
|
2007-04-22 15:00:39 +00:00
|
|
|
.Op Fl c Ar cpu-spec
|
2005-04-19 04:01:25 +00:00
|
|
|
.Op Fl d
|
2015-11-18 14:52:01 +00:00
|
|
|
.Op Fl e
|
2010-02-11 22:51:44 +00:00
|
|
|
.Op Fl f Ar pluginopt
|
2005-06-09 19:45:09 +00:00
|
|
|
.Op Fl g
|
2018-05-26 19:29:19 +00:00
|
|
|
.Op Fl i Ar lwp
|
2006-03-26 12:20:54 +00:00
|
|
|
.Op Fl k Ar kerneldir
|
2014-05-16 03:18:09 +00:00
|
|
|
.Op Fl l Ar secs
|
2008-11-25 23:24:29 +00:00
|
|
|
.Op Fl m Ar pathname
|
2005-06-24 17:24:55 +00:00
|
|
|
.Op Fl n Ar rate
|
2005-04-19 04:01:25 +00:00
|
|
|
.Op Fl o Ar outputfile
|
|
|
|
.Op Fl p Ar event-spec
|
2006-03-26 12:20:54 +00:00
|
|
|
.Op Fl q
|
|
|
|
.Op Fl r Ar fsroot
|
2005-04-19 04:01:25 +00:00
|
|
|
.Op Fl s Ar event-spec
|
2007-04-27 12:09:31 +00:00
|
|
|
.Op Fl t Ar process-spec
|
2018-05-26 19:29:19 +00:00
|
|
|
.Op Fl u Ar event-spec
|
2006-03-26 12:20:54 +00:00
|
|
|
.Op Fl v
|
2005-06-24 17:24:55 +00:00
|
|
|
.Op Fl w Ar secs
|
2007-12-07 08:26:21 +00:00
|
|
|
.Op Fl z Ar graphdepth
|
2005-06-24 17:24:55 +00:00
|
|
|
.Op Ar command Op Ar args
|
2005-04-19 04:01:25 +00:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
utility measures system performance using the facilities provided by
|
|
|
|
.Xr hwpmc 4 .
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
utility can measure both hardware events seen by the system as a
|
2007-04-27 12:09:31 +00:00
|
|
|
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,
|
2005-04-19 04:01:25 +00:00
|
|
|
if the
|
2007-04-27 12:09:31 +00:00
|
|
|
.Fl t Ar process-spec
|
2005-04-19 04:01:25 +00:00
|
|
|
option is specified, or if a command line is specified using
|
|
|
|
.Ar command ) ,
|
2007-04-27 12:09:31 +00:00
|
|
|
then measurement occurs till
|
|
|
|
.Ar command
|
|
|
|
exits, or till all target processes specified by the
|
|
|
|
.Fl t Ar process-spec
|
|
|
|
options exit, or till the
|
2005-04-19 04:01:25 +00:00
|
|
|
.Nm
|
|
|
|
utility is interrupted by the user.
|
2007-04-27 12:09:31 +00:00
|
|
|
If a specific set of processes is not targeted for measurement, then
|
2005-04-19 04:01:25 +00:00
|
|
|
.Nm
|
|
|
|
will perform system-wide measurements till interrupted by the
|
|
|
|
user.
|
|
|
|
.Pp
|
|
|
|
A given invocation of
|
|
|
|
.Nm
|
|
|
|
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
|
|
|
|
.Nm .
|
2005-06-09 19:45:09 +00:00
|
|
|
The output of sampling PMCs may be configured to go to a log file for
|
|
|
|
subsequent offline analysis, or, at the expense of greater
|
2005-06-24 17:24:55 +00:00
|
|
|
overhead, may be configured to be printed in text form on the fly.
|
2005-04-19 04:01:25 +00:00
|
|
|
.Pp
|
|
|
|
Hardware events to measure are specified to
|
|
|
|
.Nm
|
|
|
|
using event specifier strings
|
|
|
|
.Ar event-spec .
|
|
|
|
The syntax of these event specifiers is machine dependent and is
|
|
|
|
documented in
|
|
|
|
.Xr pmc 3 .
|
|
|
|
.Pp
|
|
|
|
A process-mode PMC may be configured to be inheritable by the target
|
|
|
|
process' current and future children.
|
|
|
|
.Sh OPTIONS
|
|
|
|
The following options are available:
|
|
|
|
.Bl -tag -width indent
|
2020-08-05 19:05:49 +00:00
|
|
|
.It Fl A
|
|
|
|
Skip symbol lookup and display address instead.
|
2005-04-19 04:01:25 +00:00
|
|
|
.It Fl C
|
2005-06-09 19:45:09 +00:00
|
|
|
Toggle between showing cumulative or incremental counts for
|
2005-04-19 04:01:25 +00:00
|
|
|
subsequent counting mode PMCs specified on the command line.
|
|
|
|
The default is to show incremental counts.
|
2005-06-09 19:45:09 +00:00
|
|
|
.It Fl D Ar pathname
|
|
|
|
Create files with per-program samples in the directory named
|
|
|
|
by
|
|
|
|
.Ar pathname .
|
|
|
|
The default is to create these files in the current directory.
|
|
|
|
.It Fl E
|
|
|
|
Toggle showing per-process counts at the time a tracked process
|
|
|
|
exits for subsequent process-mode PMCs specified on the command line.
|
|
|
|
This option is useful for mapping the performance characteristics of a
|
|
|
|
complex pipeline of processes when used in conjunction with the
|
|
|
|
.Fl d
|
|
|
|
option.
|
|
|
|
The default is to not to enable per-process tracking.
|
2010-02-11 22:51:44 +00:00
|
|
|
.It Fl F Ar pathname
|
|
|
|
Print calltree (Kcachegrind) information to file
|
|
|
|
.Ar pathname .
|
|
|
|
If argument
|
|
|
|
.Ar pathname
|
|
|
|
is a
|
|
|
|
.Dq Li -
|
|
|
|
this information is sent to the output file specified by the
|
|
|
|
.Fl o
|
|
|
|
option.
|
2007-12-07 08:26:21 +00:00
|
|
|
.It Fl G Ar pathname
|
|
|
|
Print callchain information to file
|
|
|
|
.Ar pathname .
|
|
|
|
If argument
|
|
|
|
.Ar pathname
|
|
|
|
is a
|
|
|
|
.Dq Li -
|
|
|
|
this information is sent to the output file specified by the
|
|
|
|
.Fl o
|
|
|
|
option.
|
2018-05-25 18:11:13 +00:00
|
|
|
.It Fl I
|
2020-08-05 19:05:49 +00:00
|
|
|
Show the offset of the instruction pointer into the symbol.
|
2018-05-26 19:29:19 +00:00
|
|
|
.It Fl L
|
|
|
|
List all event names.
|
2006-03-26 12:20:54 +00:00
|
|
|
.It Fl M Ar mapfilename
|
|
|
|
Write the mapping between executable objects encountered in the event
|
|
|
|
log and the abbreviated pathnames used for
|
|
|
|
.Xr gprof 1
|
|
|
|
profiles to file
|
|
|
|
.Ar mapfilename .
|
|
|
|
If this option is not specified, mapping information is not written.
|
|
|
|
Argument
|
|
|
|
.Ar mapfilename
|
|
|
|
may be a
|
|
|
|
.Dq Li -
|
|
|
|
in which case this mapping information is sent to the output
|
|
|
|
file configured by the
|
|
|
|
.Fl o
|
|
|
|
option.
|
2007-12-07 08:26:21 +00:00
|
|
|
.It Fl N
|
|
|
|
Toggle capturing callchain information for subsequent sampling PMCs.
|
|
|
|
The default is for sampling PMCs to capture callchain information.
|
2005-04-19 04:01:25 +00:00
|
|
|
.It Fl O Ar logfilename
|
2005-06-24 17:24:55 +00:00
|
|
|
Send logging output to file
|
2005-04-19 04:01:25 +00:00
|
|
|
.Ar logfilename .
|
2006-04-02 12:52:16 +00:00
|
|
|
If
|
|
|
|
.Ar logfilename
|
|
|
|
is of the form
|
|
|
|
.Ar hostname Ns : Ns Ar port ,
|
|
|
|
where
|
|
|
|
.Ar hostname
|
|
|
|
does not start with a
|
2006-09-29 17:57:04 +00:00
|
|
|
.Ql \&.
|
2006-04-02 12:52:16 +00:00
|
|
|
or a
|
2006-09-29 17:57:04 +00:00
|
|
|
.Ql / ,
|
2006-04-02 12:52:16 +00:00
|
|
|
then
|
|
|
|
.Nm
|
|
|
|
will open a network socket to host
|
2006-09-29 17:57:04 +00:00
|
|
|
.Ar hostname
|
2006-04-02 12:52:16 +00:00
|
|
|
on port
|
|
|
|
.Ar port .
|
|
|
|
.Pp
|
|
|
|
If the
|
|
|
|
.Fl O
|
|
|
|
option is not specified and one of the logging options is requested,
|
|
|
|
then
|
2005-06-09 19:45:09 +00:00
|
|
|
.Nm
|
2005-06-24 17:24:55 +00:00
|
|
|
will print a textual form of the logged events to the configured
|
2005-06-09 19:45:09 +00:00
|
|
|
output file.
|
2005-04-19 04:01:25 +00:00
|
|
|
.It Fl P Ar event-spec
|
|
|
|
Allocate a process mode sampling PMC measuring hardware events
|
|
|
|
specified in
|
|
|
|
.Ar event-spec .
|
2005-06-09 19:45:09 +00:00
|
|
|
.It Fl R Ar logfilename
|
|
|
|
Perform offline analysis using sampling data in file
|
|
|
|
.Ar logfilename .
|
2005-04-19 04:01:25 +00:00
|
|
|
.It Fl S Ar event-spec
|
|
|
|
Allocate a system mode sampling PMC measuring hardware events
|
|
|
|
specified in
|
|
|
|
.Ar event-spec .
|
2010-02-11 22:51:44 +00:00
|
|
|
.It Fl T
|
2020-08-17 10:51:03 +00:00
|
|
|
Use a
|
|
|
|
.Xr top 1 Ns -like
|
|
|
|
mode for sampling PMCs. The following hotkeys
|
|
|
|
can be used:
|
|
|
|
.Pp
|
|
|
|
.Bl -tag -compact -width "Ctrl+a" -offset 4n
|
|
|
|
.It Ic A
|
|
|
|
Toggle symbol resolution
|
|
|
|
.Sm off
|
|
|
|
.It Ic Ctrl + a
|
|
|
|
.Sm on
|
|
|
|
Switch to accumulative mode
|
|
|
|
.Sm off
|
|
|
|
.It Ic Ctrl + d
|
|
|
|
.Sm on
|
|
|
|
Switch to delta mode
|
|
|
|
.It Ic f
|
|
|
|
Represent the
|
|
|
|
.Dq f
|
|
|
|
cost under
|
|
|
|
threshold as a dot (calltree only)
|
|
|
|
.It Ic I
|
|
|
|
Toggle showing offsets into symbols
|
|
|
|
.It Ic m
|
|
|
|
Merge PMCs
|
|
|
|
.It Ic n
|
|
|
|
Change view
|
|
|
|
.It Ic p
|
|
|
|
Show next PMC
|
|
|
|
.It Ic q
|
|
|
|
Quit
|
|
|
|
.It Ic Space
|
|
|
|
Pause
|
|
|
|
.El
|
2018-06-04 01:10:23 +00:00
|
|
|
.It Fl U
|
|
|
|
Toggle capturing user-space call traces while in kernel mode.
|
|
|
|
The default is for sampling PMCs to capture user-space callchain information
|
|
|
|
while in user-space mode, and kernel callchain information while in kernel mode.
|
2005-06-09 19:45:09 +00:00
|
|
|
.It Fl W
|
|
|
|
Toggle logging the incremental counts seen by the threads of a
|
|
|
|
tracked process each time they are scheduled on a CPU.
|
|
|
|
This is an experimental feature intended to help analyse the
|
|
|
|
dynamic behaviour of processes in the system.
|
|
|
|
It may incur substantial overhead if enabled.
|
|
|
|
The default is for this feature to be disabled.
|
2014-04-29 07:17:33 +00:00
|
|
|
.It Fl a Ar pathname
|
|
|
|
Perform a symbol and file:line lookup for each address in each
|
|
|
|
callgraph and save the output to
|
|
|
|
.Ar pathname .
|
|
|
|
Unlike
|
|
|
|
.Fl 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
|
|
|
|
.Fl R
|
|
|
|
option to read in samples that were previously collected and
|
2014-07-29 19:49:27 +00:00
|
|
|
saved with the
|
2015-03-28 21:28:22 +00:00
|
|
|
.Fl O
|
2014-04-29 07:17:33 +00:00
|
|
|
option.
|
2007-04-22 15:00:39 +00:00
|
|
|
.It Fl c Ar cpu-spec
|
|
|
|
Set the cpus for subsequent system mode PMCs specified on the
|
2005-04-19 04:01:25 +00:00
|
|
|
command line to
|
2007-04-22 15:00:39 +00:00
|
|
|
.Ar cpu-spec .
|
|
|
|
Argument
|
|
|
|
.Ar cpu-spec
|
|
|
|
is a comma separated list of CPU numbers, or the literal
|
|
|
|
.Sq *
|
2015-05-27 13:54:37 +00:00
|
|
|
denoting all available CPUs.
|
|
|
|
The default is to allocate system mode PMCs on all available
|
2008-10-07 17:28:52 +00:00
|
|
|
CPUs.
|
2005-04-19 04:01:25 +00:00
|
|
|
.It Fl d
|
|
|
|
Toggle between process mode PMCs measuring events for the target
|
|
|
|
process' current and future children or only measuring events for
|
2005-06-09 19:45:09 +00:00
|
|
|
the target process.
|
2005-04-19 04:01:25 +00:00
|
|
|
The default is to measure events for the target process alone.
|
2014-10-27 15:33:44 +00:00
|
|
|
(it has to be passed in the command line prior to
|
|
|
|
.Fl p ,
|
|
|
|
.Fl s ,
|
|
|
|
.Fl P ,
|
|
|
|
or
|
2014-10-27 15:50:47 +00:00
|
|
|
.Fl S ) .
|
2015-11-18 14:52:01 +00:00
|
|
|
.It Fl e
|
|
|
|
Specify that the gprof profile files will use a wide history counter.
|
|
|
|
These files are produced in a format compatible with
|
|
|
|
.Xr gprof 1 .
|
|
|
|
However, other tools that cannot fully parse a BSD-style
|
|
|
|
gmon header might be unable to correctly parse these files.
|
2010-02-11 22:51:44 +00:00
|
|
|
.It Fl f Ar pluginopt
|
|
|
|
Pass option string to the active plugin.
|
|
|
|
.br
|
|
|
|
threshold=<float> do not display cost under specified value (Top).
|
|
|
|
.br
|
|
|
|
skiplink=0|1 replace node with cost under threshold by a dot (Top).
|
2005-06-09 19:45:09 +00:00
|
|
|
.It Fl g
|
2007-12-07 08:26:21 +00:00
|
|
|
Produce profiles in a format compatible with
|
2005-06-09 19:45:09 +00:00
|
|
|
.Xr gprof 1 .
|
2005-07-01 03:50:30 +00:00
|
|
|
A separate profile file is generated for each executable object
|
|
|
|
encountered.
|
|
|
|
Profile files are placed in sub-directories named by their PMC
|
|
|
|
event name.
|
2018-05-26 19:29:19 +00:00
|
|
|
.It Fl i Ar lwp
|
|
|
|
Filter on thread ID
|
|
|
|
.Ar lwp ,
|
|
|
|
which you can get from
|
|
|
|
.Xr ps 1
|
|
|
|
.Fl o
|
|
|
|
.Li lwp .
|
2006-03-26 12:20:54 +00:00
|
|
|
.It Fl k Ar kerneldir
|
|
|
|
Set the pathname of the kernel directory to argument
|
|
|
|
.Ar kerneldir .
|
|
|
|
This directory specifies where
|
|
|
|
.Nm
|
|
|
|
should look for the kernel and its modules.
|
2015-05-08 16:02:31 +00:00
|
|
|
The default is to use the path of the running kernel obtained from the
|
|
|
|
.Va kern.bootfile
|
|
|
|
sysctl.
|
2020-03-12 23:04:40 +00:00
|
|
|
Modules will also be searched for in /boot/modules if not found in
|
|
|
|
.Ar kerneldir .
|
2014-05-16 03:18:09 +00:00
|
|
|
.It Fl l Ar secs
|
|
|
|
Set system-wide performance measurement duration for
|
|
|
|
.Ar secs
|
|
|
|
seconds.
|
|
|
|
The argument
|
|
|
|
.Ar secs
|
|
|
|
may be a fractional value.
|
2008-11-25 23:24:29 +00:00
|
|
|
.It Fl m Ar pathname
|
|
|
|
Print the sampled PCs with the name, the start and ending addresses
|
|
|
|
of the function within they live.
|
|
|
|
The
|
|
|
|
.Ar pathname
|
2012-06-03 11:29:48 +00:00
|
|
|
argument is mandatory and indicates where the information will be stored.
|
2008-11-25 23:24:29 +00:00
|
|
|
If argument
|
|
|
|
.Ar pathname
|
|
|
|
is a
|
|
|
|
.Dq Li -
|
|
|
|
this information is sent to the output file specified by the
|
|
|
|
.Fl o
|
|
|
|
option.
|
2015-03-28 21:28:22 +00:00
|
|
|
This option requires the
|
|
|
|
.Fl R
|
|
|
|
option to read in samples that were previously collected and
|
|
|
|
saved with the
|
|
|
|
.Fl O
|
|
|
|
option.
|
2005-04-19 04:01:25 +00:00
|
|
|
.It Fl n Ar rate
|
|
|
|
Set the default sampling rate for subsequent sampling mode
|
|
|
|
PMCs specified on the command line.
|
|
|
|
The default is to configure PMCs to sample the CPU's instruction
|
|
|
|
pointer every 65536 events.
|
|
|
|
.It Fl o Ar outputfile
|
2005-06-24 17:24:55 +00:00
|
|
|
Send counter readings and textual representations of logged data
|
2005-04-19 04:01:25 +00:00
|
|
|
to file
|
|
|
|
.Ar outputfile .
|
|
|
|
The default is to send output to
|
2007-12-07 08:26:21 +00:00
|
|
|
.Pa stderr
|
|
|
|
when collecting live data and to
|
|
|
|
.Pa stdout
|
|
|
|
when processing a pre-existing logfile.
|
2005-04-19 04:01:25 +00:00
|
|
|
.It Fl p Ar event-spec
|
|
|
|
Allocate a process mode counting PMC measuring hardware events
|
|
|
|
specified in
|
|
|
|
.Ar event-spec .
|
2006-03-26 12:20:54 +00:00
|
|
|
.It Fl q
|
|
|
|
Decrease verbosity.
|
|
|
|
.It Fl r Ar fsroot
|
|
|
|
Set the top of the filesystem hierarchy under which executables
|
|
|
|
are located to argument
|
|
|
|
.Ar fsroot .
|
|
|
|
The default is
|
|
|
|
.Pa / .
|
2005-04-19 04:01:25 +00:00
|
|
|
.It Fl s Ar event-spec
|
|
|
|
Allocate a system mode counting PMC measuring hardware events
|
|
|
|
specified in
|
|
|
|
.Ar event-spec .
|
2007-04-27 12:09:31 +00:00
|
|
|
.It Fl t Ar process-spec
|
|
|
|
Attach process mode PMCs to the processes named by argument
|
|
|
|
.Ar process-spec .
|
|
|
|
Argument
|
|
|
|
.Ar process-spec
|
|
|
|
may be a non-negative integer denoting a specific process id, or a
|
|
|
|
regular expression for selecting processes based on their command names.
|
2018-05-26 19:29:19 +00:00
|
|
|
.It Fl u Ar event-spec
|
|
|
|
Provide short description of event.
|
2006-03-26 12:20:54 +00:00
|
|
|
.It Fl v
|
|
|
|
Increase verbosity.
|
2005-04-19 04:01:25 +00:00
|
|
|
.It Fl w Ar secs
|
2010-02-11 22:51:44 +00:00
|
|
|
Print the values of all counting mode PMCs or sampling mode PMCs
|
|
|
|
for top mode every
|
2005-04-19 04:01:25 +00:00
|
|
|
.Ar secs
|
|
|
|
seconds.
|
|
|
|
The argument
|
|
|
|
.Ar secs
|
|
|
|
may be a fractional value.
|
|
|
|
The default interval is 5 seconds.
|
2007-12-07 08:26:21 +00:00
|
|
|
.It Fl z Ar graphdepth
|
|
|
|
When printing system-wide callgraphs, limit callgraphs to the depth
|
|
|
|
specified by argument
|
|
|
|
.Ar graphdepth .
|
2005-04-19 04:01:25 +00:00
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
If
|
|
|
|
.Ar command
|
|
|
|
is specified, it is executed using
|
|
|
|
.Xr execvp 3 .
|
|
|
|
.Sh EXAMPLES
|
|
|
|
To perform system-wide statistical sampling on an AMD Athlon CPU with
|
|
|
|
samples taken every 32768 instruction retirals and data being sampled
|
|
|
|
to file
|
2005-06-24 17:24:55 +00:00
|
|
|
.Pa sample.stat ,
|
2005-04-19 04:01:25 +00:00
|
|
|
use:
|
2005-07-13 13:18:17 +00:00
|
|
|
.Dl "pmcstat -O sample.stat -n 32768 -S k7-retired-instructions"
|
2005-04-19 04:01:25 +00:00
|
|
|
.Pp
|
|
|
|
To execute
|
2009-06-02 04:45:56 +00:00
|
|
|
.Nm firefox
|
2005-04-19 04:01:25 +00:00
|
|
|
and measure the number of data cache misses suffered
|
|
|
|
by it and its children every 12 seconds on an AMD Athlon, use:
|
2009-06-02 04:45:56 +00:00
|
|
|
.Dl "pmcstat -d -w 12 -p k7-dc-misses firefox"
|
2005-07-01 03:50:30 +00:00
|
|
|
.Pp
|
2008-09-19 13:17:22 +00:00
|
|
|
To measure instructions retired for all processes named
|
2007-04-27 12:09:31 +00:00
|
|
|
.Dq emacs
|
|
|
|
use:
|
|
|
|
.Dl "pmcstat -t '^emacs$' -p instructions"
|
|
|
|
.Pp
|
2008-09-19 13:17:22 +00:00
|
|
|
To measure instructions retired for processes named
|
|
|
|
.Dq emacs
|
|
|
|
for a period of 10 seconds use:
|
|
|
|
.Dl "pmcstat -t '^emacs$' -p instructions sleep 10"
|
|
|
|
.Pp
|
2007-04-22 15:00:39 +00:00
|
|
|
To count instruction tlb-misses on CPUs 0 and 2 on a Intel
|
|
|
|
Pentium Pro/Pentium III SMP system use:
|
|
|
|
.Dl "pmcstat -c 0,2 -s p6-itlb-miss"
|
|
|
|
.Pp
|
2007-12-07 08:26:21 +00:00
|
|
|
To collect profiling information for a specific process with pid 1234
|
|
|
|
based on instruction cache misses seen by it use:
|
|
|
|
.Dl "pmcstat -P ic-misses -t 1234 -O /tmp/sample.out"
|
|
|
|
.Pp
|
2007-04-22 15:00:39 +00:00
|
|
|
To perform system-wide sampling on all configured processors
|
|
|
|
based on processor instructions retired use:
|
2005-07-01 03:50:30 +00:00
|
|
|
.Dl "pmcstat -S instructions -O /tmp/sample.out"
|
2007-12-07 08:26:21 +00:00
|
|
|
If callgraph capture is not desired use:
|
|
|
|
.Dl "pmcstat -N -S instructions -O /tmp/sample.out"
|
2005-07-01 03:50:30 +00:00
|
|
|
.Pp
|
2006-04-02 12:52:16 +00:00
|
|
|
To send the generated event log to a remote machine use:
|
|
|
|
.Dl "pmcstat -S instructions -O remotehost:port"
|
|
|
|
On the remote machine, the sample log can be collected using
|
|
|
|
.Xr nc 1 :
|
|
|
|
.Dl "nc -l remotehost port > /tmp/sample.out"
|
|
|
|
.Pp
|
2005-07-01 03:50:30 +00:00
|
|
|
To generate
|
|
|
|
.Xr gprof 1
|
2007-12-07 08:26:21 +00:00
|
|
|
compatible profiles from a sample file use:
|
2005-07-01 03:50:30 +00:00
|
|
|
.Dl "pmcstat -R /tmp/sample.out -g"
|
2007-12-07 08:26:21 +00:00
|
|
|
.Pp
|
|
|
|
To print a system-wide profile with callgraphs to file
|
|
|
|
.Pa "foo.graph"
|
|
|
|
use:
|
|
|
|
.Dl "pmcstat -R /tmp/sample.out -G foo.graph"
|
2005-04-19 04:01:25 +00:00
|
|
|
.Sh DIAGNOSTICS
|
2008-06-29 10:30:06 +00:00
|
|
|
If option
|
|
|
|
.Fl v
|
|
|
|
is specified,
|
|
|
|
.Nm
|
|
|
|
may issue the following diagnostic messages:
|
2012-03-26 21:22:53 +00:00
|
|
|
.Bl -diag
|
2008-06-29 10:30:06 +00:00
|
|
|
.It "#callchain/dubious-frames"
|
|
|
|
The number of callchain records that had an
|
|
|
|
.Dq impossible
|
|
|
|
value for a return address.
|
|
|
|
.It "#exec handling errors"
|
|
|
|
The number of
|
|
|
|
.Xr exec 2
|
|
|
|
events in the log file that named executables that could not be
|
|
|
|
analyzed.
|
|
|
|
.It "#exec/elf"
|
|
|
|
The number of
|
|
|
|
.Xr exec 2
|
|
|
|
events that named ELF executables.
|
|
|
|
.It "#exec/unknown"
|
|
|
|
The number of
|
|
|
|
.Xr exec 2
|
|
|
|
events that named executables with unrecognized formats.
|
|
|
|
.It "#samples/total"
|
|
|
|
The total number of samples in the log file.
|
|
|
|
.It "#samples/unclaimed"
|
|
|
|
The number of samples that could not be correlated to a known
|
|
|
|
executable object (i.e., to an executable, shared library, the
|
|
|
|
kernel or the runtime loader).
|
|
|
|
.It "#samples/unknown-object"
|
|
|
|
The number of samples that were associated with an executable
|
|
|
|
with an unrecognized object format.
|
|
|
|
.El
|
|
|
|
.Pp
|
2005-06-24 17:24:55 +00:00
|
|
|
.Ex -std
|
2007-12-07 08:26:21 +00:00
|
|
|
.Sh COMPATIBILITY
|
|
|
|
Due to the limitations of the
|
|
|
|
.Pa gmon.out
|
|
|
|
file format,
|
|
|
|
.Xr gprof 1
|
|
|
|
compatible profiles generated by the
|
|
|
|
.Fl g
|
|
|
|
option do not contain information about calls that cross executable
|
|
|
|
boundaries.
|
|
|
|
The generated
|
|
|
|
.Pa gmon.out
|
|
|
|
files are also only meaningful for native executables.
|
2005-04-19 04:01:25 +00:00
|
|
|
.Sh SEE ALSO
|
2005-06-09 19:45:09 +00:00
|
|
|
.Xr gprof 1 ,
|
2006-04-02 12:52:16 +00:00
|
|
|
.Xr nc 1 ,
|
2005-04-19 04:01:25 +00:00
|
|
|
.Xr execvp 3 ,
|
|
|
|
.Xr pmc 3 ,
|
2005-06-24 17:24:55 +00:00
|
|
|
.Xr pmclog 3 ,
|
2005-04-19 04:01:25 +00:00
|
|
|
.Xr hwpmc 4 ,
|
|
|
|
.Xr pmccontrol 8 ,
|
|
|
|
.Xr sysctl 8
|
2005-06-24 17:24:55 +00:00
|
|
|
.Sh HISTORY
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
utility first appeared in
|
|
|
|
.Fx 6.0 .
|
2005-07-01 03:50:30 +00:00
|
|
|
It is
|
|
|
|
.Ud
|
2005-06-24 17:24:55 +00:00
|
|
|
.Sh AUTHORS
|
2014-06-20 09:57:27 +00:00
|
|
|
.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org
|
2005-10-18 04:40:11 +00:00
|
|
|
.Sh BUGS
|
2006-09-29 17:57:04 +00:00
|
|
|
The
|
2005-10-18 04:40:11 +00:00
|
|
|
.Nm
|
2006-09-29 17:57:04 +00:00
|
|
|
utility cannot yet analyse
|
2006-04-02 12:52:16 +00:00
|
|
|
.Xr hwpmc 4
|
|
|
|
logs generated by non-native architectures.
|