xref: /freebsd/usr.sbin/pmcstat/pmcstat.8 (revision aa12cea2ccc6e686d6d31cf67d6bc69cbc1ba744)
1e572c7a7SJoseph Koshy.\" Copyright (c) 2003-2008 Joseph Koshy
2b6010f9eSJoseph Koshy.\" Copyright (c) 2007 The FreeBSD Foundation
3b6010f9eSJoseph Koshy.\" All rights reserved.
4ebccf1e3SJoseph Koshy.\"
5ebccf1e3SJoseph Koshy.\" Redistribution and use in source and binary forms, with or without
6ebccf1e3SJoseph Koshy.\" modification, are permitted provided that the following conditions
7ebccf1e3SJoseph Koshy.\" are met:
8ebccf1e3SJoseph Koshy.\" 1. Redistributions of source code must retain the above copyright
9ebccf1e3SJoseph Koshy.\"    notice, this list of conditions and the following disclaimer.
10ebccf1e3SJoseph Koshy.\" 2. Redistributions in binary form must reproduce the above copyright
11ebccf1e3SJoseph Koshy.\"    notice, this list of conditions and the following disclaimer in the
12ebccf1e3SJoseph Koshy.\"    documentation and/or other materials provided with the distribution.
13ebccf1e3SJoseph Koshy.\"
14ebccf1e3SJoseph Koshy.\" This software is provided by Joseph Koshy ``as is'' and
15ebccf1e3SJoseph Koshy.\" any express or implied warranties, including, but not limited to, the
16ebccf1e3SJoseph Koshy.\" implied warranties of merchantability and fitness for a particular purpose
17ebccf1e3SJoseph Koshy.\" are disclaimed.  in no event shall Joseph Koshy be liable
18ebccf1e3SJoseph Koshy.\" for any direct, indirect, incidental, special, exemplary, or consequential
19ebccf1e3SJoseph Koshy.\" damages (including, but not limited to, procurement of substitute goods
20ebccf1e3SJoseph Koshy.\" or services; loss of use, data, or profits; or business interruption)
21ebccf1e3SJoseph Koshy.\" however caused and on any theory of liability, whether in contract, strict
22ebccf1e3SJoseph Koshy.\" liability, or tort (including negligence or otherwise) arising in any way
23ebccf1e3SJoseph Koshy.\" out of the use of this software, even if advised of the possibility of
24ebccf1e3SJoseph Koshy.\" such damage.
25ebccf1e3SJoseph Koshy.\"
26ebccf1e3SJoseph Koshy.\" $FreeBSD$
27ebccf1e3SJoseph Koshy.\"
282c79db51SJoseph Koshy.Dd September 19, 2008
29ebccf1e3SJoseph Koshy.Dt PMCSTAT 8
30*aa12cea2SUlrich Spörlein.Os
31ebccf1e3SJoseph Koshy.Sh NAME
32ebccf1e3SJoseph Koshy.Nm pmcstat
3321ce09caSJoseph Koshy.Nd "performance measurement with performance monitoring hardware"
34ebccf1e3SJoseph Koshy.Sh SYNOPSIS
35ebccf1e3SJoseph Koshy.Nm
36ebccf1e3SJoseph Koshy.Op Fl C
3715139246SJoseph Koshy.Op Fl D Ar pathname
38f263522aSJoseph Koshy.Op Fl E
390b86b1bbSFabien Thomas.Op Fl F Ar pathname
40b6010f9eSJoseph Koshy.Op Fl G Ar pathname
4149874f6eSJoseph Koshy.Op Fl M Ar mapfilename
42b6010f9eSJoseph Koshy.Op Fl N
43ebccf1e3SJoseph Koshy.Op Fl O Ar logfilename
44ebccf1e3SJoseph Koshy.Op Fl P Ar event-spec
45f263522aSJoseph Koshy.Op Fl R Ar logfilename
46ebccf1e3SJoseph Koshy.Op Fl S Ar event-spec
470b86b1bbSFabien Thomas.Op Fl T
48f263522aSJoseph Koshy.Op Fl W
49ee4910b1SJoseph Koshy.Op Fl c Ar cpu-spec
50ebccf1e3SJoseph Koshy.Op Fl d
510b86b1bbSFabien Thomas.Op Fl f Ar pluginopt
52f263522aSJoseph Koshy.Op Fl g
5349874f6eSJoseph Koshy.Op Fl k Ar kerneldir
54c0252222SAttilio Rao.Op Fl m Ar pathname
5521ce09caSJoseph Koshy.Op Fl n Ar rate
56ebccf1e3SJoseph Koshy.Op Fl o Ar outputfile
57ebccf1e3SJoseph Koshy.Op Fl p Ar event-spec
5849874f6eSJoseph Koshy.Op Fl q
5949874f6eSJoseph Koshy.Op Fl r Ar fsroot
60ebccf1e3SJoseph Koshy.Op Fl s Ar event-spec
61fbd8b34aSJoseph Koshy.Op Fl t Ar process-spec
6249874f6eSJoseph Koshy.Op Fl v
6321ce09caSJoseph Koshy.Op Fl w Ar secs
64b6010f9eSJoseph Koshy.Op Fl z Ar graphdepth
6521ce09caSJoseph Koshy.Op Ar command Op Ar args
66ebccf1e3SJoseph Koshy.Sh DESCRIPTION
67ebccf1e3SJoseph KoshyThe
68ebccf1e3SJoseph Koshy.Nm
69ebccf1e3SJoseph Koshyutility measures system performance using the facilities provided by
70ebccf1e3SJoseph Koshy.Xr hwpmc 4 .
71ebccf1e3SJoseph Koshy.Pp
72ebccf1e3SJoseph KoshyThe
73ebccf1e3SJoseph Koshy.Nm
74ebccf1e3SJoseph Koshyutility can measure both hardware events seen by the system as a
75fbd8b34aSJoseph Koshywhole, and those seen when a specified set of processes are executing
76fbd8b34aSJoseph Koshyon the system's CPUs.
77fbd8b34aSJoseph KoshyIf a specific set of processes is being targeted (for example,
78ebccf1e3SJoseph Koshyif the
79fbd8b34aSJoseph Koshy.Fl t Ar process-spec
80ebccf1e3SJoseph Koshyoption is specified, or if a command line is specified using
81ebccf1e3SJoseph Koshy.Ar command ) ,
82fbd8b34aSJoseph Koshythen measurement occurs till
83fbd8b34aSJoseph Koshy.Ar command
84fbd8b34aSJoseph Koshyexits, or till all target processes specified by the
85fbd8b34aSJoseph Koshy.Fl t Ar process-spec
86fbd8b34aSJoseph Koshyoptions exit, or till the
87ebccf1e3SJoseph Koshy.Nm
88ebccf1e3SJoseph Koshyutility is interrupted by the user.
89fbd8b34aSJoseph KoshyIf a specific set of processes is not targeted for measurement, then
90ebccf1e3SJoseph Koshy.Nm
91ebccf1e3SJoseph Koshywill perform system-wide measurements till interrupted by the
92ebccf1e3SJoseph Koshyuser.
93ebccf1e3SJoseph Koshy.Pp
94ebccf1e3SJoseph KoshyA given invocation of
95ebccf1e3SJoseph Koshy.Nm
96ebccf1e3SJoseph Koshycan mix allocations of system-mode and process-mode PMCs, of both
97ebccf1e3SJoseph Koshycounting and sampling flavors.
98ebccf1e3SJoseph KoshyThe values of all counting PMCs are printed in human readable form
99ebccf1e3SJoseph Koshyat regular intervals by
100ebccf1e3SJoseph Koshy.Nm .
101f263522aSJoseph KoshyThe output of sampling PMCs may be configured to go to a log file for
102f263522aSJoseph Koshysubsequent offline analysis, or, at the expense of greater
10321ce09caSJoseph Koshyoverhead, may be configured to be printed in text form on the fly.
104ebccf1e3SJoseph Koshy.Pp
105ebccf1e3SJoseph KoshyHardware events to measure are specified to
106ebccf1e3SJoseph Koshy.Nm
107ebccf1e3SJoseph Koshyusing event specifier strings
108ebccf1e3SJoseph Koshy.Ar event-spec .
109ebccf1e3SJoseph KoshyThe syntax of these event specifiers is machine dependent and is
110ebccf1e3SJoseph Koshydocumented in
111ebccf1e3SJoseph Koshy.Xr pmc 3 .
112ebccf1e3SJoseph Koshy.Pp
113ebccf1e3SJoseph KoshyA process-mode PMC may be configured to be inheritable by the target
114ebccf1e3SJoseph Koshyprocess' current and future children.
115ebccf1e3SJoseph Koshy.Sh OPTIONS
116ebccf1e3SJoseph KoshyThe following options are available:
117ebccf1e3SJoseph Koshy.Bl -tag -width indent
118ebccf1e3SJoseph Koshy.It Fl C
119f263522aSJoseph KoshyToggle between showing cumulative or incremental counts for
120ebccf1e3SJoseph Koshysubsequent counting mode PMCs specified on the command line.
121ebccf1e3SJoseph KoshyThe default is to show incremental counts.
122f263522aSJoseph Koshy.It Fl D Ar pathname
123f263522aSJoseph KoshyCreate files with per-program samples in the directory named
124f263522aSJoseph Koshyby
125f263522aSJoseph Koshy.Ar pathname .
126f263522aSJoseph KoshyThe default is to create these files in the current directory.
127f263522aSJoseph Koshy.It Fl E
128f263522aSJoseph KoshyToggle showing per-process counts at the time a tracked process
129f263522aSJoseph Koshyexits for subsequent process-mode PMCs specified on the command line.
130f263522aSJoseph KoshyThis option is useful for mapping the performance characteristics of a
131f263522aSJoseph Koshycomplex pipeline of processes when used in conjunction with the
132f263522aSJoseph Koshy.Fl d
133f263522aSJoseph Koshyoption.
134f263522aSJoseph KoshyThe default is to not to enable per-process tracking.
1350b86b1bbSFabien Thomas.It Fl F Ar pathname
1360b86b1bbSFabien ThomasPrint calltree (Kcachegrind) information to file
1370b86b1bbSFabien Thomas.Ar pathname .
1380b86b1bbSFabien ThomasIf argument
1390b86b1bbSFabien Thomas.Ar pathname
1400b86b1bbSFabien Thomasis a
1410b86b1bbSFabien Thomas.Dq Li -
1420b86b1bbSFabien Thomasthis information is sent to the output file specified by the
1430b86b1bbSFabien Thomas.Fl o
1440b86b1bbSFabien Thomasoption.
145b6010f9eSJoseph Koshy.It Fl G Ar pathname
146b6010f9eSJoseph KoshyPrint callchain information to file
147b6010f9eSJoseph Koshy.Ar pathname .
148b6010f9eSJoseph KoshyIf argument
149b6010f9eSJoseph Koshy.Ar pathname
150b6010f9eSJoseph Koshyis a
151b6010f9eSJoseph Koshy.Dq Li -
152b6010f9eSJoseph Koshythis information is sent to the output file specified by the
153b6010f9eSJoseph Koshy.Fl o
154b6010f9eSJoseph Koshyoption.
15549874f6eSJoseph Koshy.It Fl M Ar mapfilename
15649874f6eSJoseph KoshyWrite the mapping between executable objects encountered in the event
15749874f6eSJoseph Koshylog and the abbreviated pathnames used for
15849874f6eSJoseph Koshy.Xr gprof 1
15949874f6eSJoseph Koshyprofiles to file
16049874f6eSJoseph Koshy.Ar mapfilename .
16149874f6eSJoseph KoshyIf this option is not specified, mapping information is not written.
16249874f6eSJoseph KoshyArgument
16349874f6eSJoseph Koshy.Ar mapfilename
16449874f6eSJoseph Koshymay be a
16549874f6eSJoseph Koshy.Dq Li -
16649874f6eSJoseph Koshyin which case this mapping information is sent to the output
16749874f6eSJoseph Koshyfile configured by the
16849874f6eSJoseph Koshy.Fl o
16949874f6eSJoseph Koshyoption.
170b6010f9eSJoseph Koshy.It Fl N
171b6010f9eSJoseph KoshyToggle capturing callchain information for subsequent sampling PMCs.
172b6010f9eSJoseph KoshyThe default is for sampling PMCs to capture callchain information.
173ebccf1e3SJoseph Koshy.It Fl O Ar logfilename
17421ce09caSJoseph KoshySend logging output to file
175ebccf1e3SJoseph Koshy.Ar logfilename .
176302cbb90SJoseph KoshyIf
177302cbb90SJoseph Koshy.Ar logfilename
178302cbb90SJoseph Koshyis of the form
179302cbb90SJoseph Koshy.Ar hostname Ns : Ns Ar port ,
180302cbb90SJoseph Koshywhere
181302cbb90SJoseph Koshy.Ar hostname
182302cbb90SJoseph Koshydoes not start with a
183bc84aa4bSRuslan Ermilov.Ql \&.
184302cbb90SJoseph Koshyor a
185bc84aa4bSRuslan Ermilov.Ql / ,
186302cbb90SJoseph Koshythen
187302cbb90SJoseph Koshy.Nm
188302cbb90SJoseph Koshywill open a network socket to host
189302cbb90SJoseph Koshy.Ar hostname
190302cbb90SJoseph Koshyon port
191302cbb90SJoseph Koshy.Ar port .
192302cbb90SJoseph Koshy.Pp
193302cbb90SJoseph KoshyIf the
194302cbb90SJoseph Koshy.Fl O
195302cbb90SJoseph Koshyoption is not specified and one of the logging options is requested,
196302cbb90SJoseph Koshythen
197f263522aSJoseph Koshy.Nm
19821ce09caSJoseph Koshywill print a textual form of the logged events to the configured
199f263522aSJoseph Koshyoutput file.
200ebccf1e3SJoseph Koshy.It Fl P Ar event-spec
201ebccf1e3SJoseph KoshyAllocate a process mode sampling PMC measuring hardware events
202ebccf1e3SJoseph Koshyspecified in
203ebccf1e3SJoseph Koshy.Ar event-spec .
204f263522aSJoseph Koshy.It Fl R Ar logfilename
205f263522aSJoseph KoshyPerform offline analysis using sampling data in file
206f263522aSJoseph Koshy.Ar logfilename .
207ebccf1e3SJoseph Koshy.It Fl S Ar event-spec
208ebccf1e3SJoseph KoshyAllocate a system mode sampling PMC measuring hardware events
209ebccf1e3SJoseph Koshyspecified in
210ebccf1e3SJoseph Koshy.Ar event-spec .
2110b86b1bbSFabien Thomas.It Fl T
2120b86b1bbSFabien ThomasUse a top like mode for sampling PMCs. The following hotkeys
2130b86b1bbSFabien Thomascan be used: 'c+a' switch to accumulative mode, 'c+d' switch
2140b86b1bbSFabien Thomasto delta mode, 'm' merge PMCs, 'n' change view, 'p' show next
2150b86b1bbSFabien ThomasPMC, ' ' pause, 'q' quit. calltree only: 'f' cost under threshold
2160b86b1bbSFabien Thomasis seen as a dot.
217f263522aSJoseph Koshy.It Fl W
218f263522aSJoseph KoshyToggle logging the incremental counts seen by the threads of a
219f263522aSJoseph Koshytracked process each time they are scheduled on a CPU.
220f263522aSJoseph KoshyThis is an experimental feature intended to help analyse the
221f263522aSJoseph Koshydynamic behaviour of processes in the system.
222f263522aSJoseph KoshyIt may incur substantial overhead if enabled.
223f263522aSJoseph KoshyThe default is for this feature to be disabled.
224ee4910b1SJoseph Koshy.It Fl c Ar cpu-spec
225ee4910b1SJoseph KoshySet the cpus for subsequent system mode PMCs specified on the
226ebccf1e3SJoseph Koshycommand line to
227ee4910b1SJoseph Koshy.Ar cpu-spec .
228ee4910b1SJoseph KoshyArgument
229ee4910b1SJoseph Koshy.Ar cpu-spec
230ee4910b1SJoseph Koshyis a comma separated list of CPU numbers, or the literal
231ee4910b1SJoseph Koshy.Sq *
2325477328dSJoseph Koshydenoting all unhalted CPUs.
2335477328dSJoseph KoshyThe default is to allocate system mode PMCs on all unhalted
2345477328dSJoseph KoshyCPUs.
235ebccf1e3SJoseph Koshy.It Fl d
236ebccf1e3SJoseph KoshyToggle between process mode PMCs measuring events for the target
237ebccf1e3SJoseph Koshyprocess' current and future children or only measuring events for
238f263522aSJoseph Koshythe target process.
239ebccf1e3SJoseph KoshyThe default is to measure events for the target process alone.
2400b86b1bbSFabien Thomas.It Fl f Ar pluginopt
2410b86b1bbSFabien ThomasPass option string to the active plugin.
2420b86b1bbSFabien Thomas.br
2430b86b1bbSFabien Thomasthreshold=<float> do not display cost under specified value (Top).
2440b86b1bbSFabien Thomas.br
2450b86b1bbSFabien Thomasskiplink=0|1 replace node with cost under threshold by a dot (Top).
246f263522aSJoseph Koshy.It Fl g
247b6010f9eSJoseph KoshyProduce profiles in a format compatible with
248f263522aSJoseph Koshy.Xr gprof 1 .
2491fdbf256SJoseph KoshyA separate profile file is generated for each executable object
2501fdbf256SJoseph Koshyencountered.
2511fdbf256SJoseph KoshyProfile files are placed in sub-directories named by their PMC
2521fdbf256SJoseph Koshyevent name.
25349874f6eSJoseph Koshy.It Fl k Ar kerneldir
25449874f6eSJoseph KoshySet the pathname of the kernel directory to argument
25549874f6eSJoseph Koshy.Ar kerneldir .
25649874f6eSJoseph KoshyThis directory specifies where
25749874f6eSJoseph Koshy.Nm
25849874f6eSJoseph Koshyshould look for the kernel and its modules.
25915139246SJoseph KoshyThe default is
26049874f6eSJoseph Koshy.Pa /boot/kernel .
261c0252222SAttilio Rao.It Fl m Ar pathname
262c0252222SAttilio RaoPrint the sampled PCs with the name, the start and ending addresses
263c0252222SAttilio Raoof the function within they live.
264c0252222SAttilio RaoThe
265c0252222SAttilio Rao.Ar pathname
266c0252222SAttilio Raoargument is mandatory and indicates where informations will be stored.
267c0252222SAttilio RaoIf argument
268c0252222SAttilio Rao.Ar pathname
269c0252222SAttilio Raois a
270c0252222SAttilio Rao.Dq Li -
271c0252222SAttilio Raothis information is sent to the output file specified by the
272c0252222SAttilio Rao.Fl o
273c0252222SAttilio Raooption.
274ebccf1e3SJoseph Koshy.It Fl n Ar rate
275ebccf1e3SJoseph KoshySet the default sampling rate for subsequent sampling mode
276ebccf1e3SJoseph KoshyPMCs specified on the command line.
277ebccf1e3SJoseph KoshyThe default is to configure PMCs to sample the CPU's instruction
278ebccf1e3SJoseph Koshypointer every 65536 events.
279ebccf1e3SJoseph Koshy.It Fl o Ar outputfile
28021ce09caSJoseph KoshySend counter readings and textual representations of logged data
281ebccf1e3SJoseph Koshyto file
282ebccf1e3SJoseph Koshy.Ar outputfile .
283ebccf1e3SJoseph KoshyThe default is to send output to
284b6010f9eSJoseph Koshy.Pa stderr
285b6010f9eSJoseph Koshywhen collecting live data and to
286b6010f9eSJoseph Koshy.Pa stdout
287b6010f9eSJoseph Koshywhen processing a pre-existing logfile.
288ebccf1e3SJoseph Koshy.It Fl p Ar event-spec
289ebccf1e3SJoseph KoshyAllocate a process mode counting PMC measuring hardware events
290ebccf1e3SJoseph Koshyspecified in
291ebccf1e3SJoseph Koshy.Ar event-spec .
29249874f6eSJoseph Koshy.It Fl q
29349874f6eSJoseph KoshyDecrease verbosity.
29449874f6eSJoseph Koshy.It Fl r Ar fsroot
29549874f6eSJoseph KoshySet the top of the filesystem hierarchy under which executables
29649874f6eSJoseph Koshyare located to argument
29749874f6eSJoseph Koshy.Ar fsroot .
29849874f6eSJoseph KoshyThe default is
29949874f6eSJoseph Koshy.Pa / .
300ebccf1e3SJoseph Koshy.It Fl s Ar event-spec
301ebccf1e3SJoseph KoshyAllocate a system mode counting PMC measuring hardware events
302ebccf1e3SJoseph Koshyspecified in
303ebccf1e3SJoseph Koshy.Ar event-spec .
304fbd8b34aSJoseph Koshy.It Fl t Ar process-spec
305fbd8b34aSJoseph KoshyAttach process mode PMCs to the processes named by argument
306fbd8b34aSJoseph Koshy.Ar process-spec .
307fbd8b34aSJoseph KoshyArgument
308fbd8b34aSJoseph Koshy.Ar process-spec
309fbd8b34aSJoseph Koshymay be a non-negative integer denoting a specific process id, or a
310fbd8b34aSJoseph Koshyregular expression for selecting processes based on their command names.
31149874f6eSJoseph Koshy.It Fl v
31249874f6eSJoseph KoshyIncrease verbosity.
313ebccf1e3SJoseph Koshy.It Fl w Ar secs
3140b86b1bbSFabien ThomasPrint the values of all counting mode PMCs or sampling mode PMCs
3150b86b1bbSFabien Thomasfor top mode every
316ebccf1e3SJoseph Koshy.Ar secs
317ebccf1e3SJoseph Koshyseconds.
318ebccf1e3SJoseph KoshyThe argument
319ebccf1e3SJoseph Koshy.Ar secs
320ebccf1e3SJoseph Koshymay be a fractional value.
321ebccf1e3SJoseph KoshyThe default interval is 5 seconds.
322b6010f9eSJoseph Koshy.It Fl z Ar graphdepth
323b6010f9eSJoseph KoshyWhen printing system-wide callgraphs, limit callgraphs to the depth
324b6010f9eSJoseph Koshyspecified by argument
325b6010f9eSJoseph Koshy.Ar graphdepth .
326ebccf1e3SJoseph Koshy.El
327ebccf1e3SJoseph Koshy.Pp
328ebccf1e3SJoseph KoshyIf
329ebccf1e3SJoseph Koshy.Ar command
330ebccf1e3SJoseph Koshyis specified, it is executed using
331ebccf1e3SJoseph Koshy.Xr execvp 3 .
332ebccf1e3SJoseph Koshy.Sh EXAMPLES
333ebccf1e3SJoseph KoshyTo perform system-wide statistical sampling on an AMD Athlon CPU with
334ebccf1e3SJoseph Koshysamples taken every 32768 instruction retirals and data being sampled
335ebccf1e3SJoseph Koshyto file
33621ce09caSJoseph Koshy.Pa sample.stat ,
337ebccf1e3SJoseph Koshyuse:
33800028966SRobert Watson.Dl "pmcstat -O sample.stat -n 32768 -S k7-retired-instructions"
339ebccf1e3SJoseph Koshy.Pp
340ebccf1e3SJoseph KoshyTo execute
341a2c0b3aeSJoseph Koshy.Nm firefox
342ebccf1e3SJoseph Koshyand measure the number of data cache misses suffered
343ebccf1e3SJoseph Koshyby it and its children every 12 seconds on an AMD Athlon, use:
344a2c0b3aeSJoseph Koshy.Dl "pmcstat -d -w 12 -p k7-dc-misses firefox"
3451fdbf256SJoseph Koshy.Pp
3462c79db51SJoseph KoshyTo measure instructions retired for all processes named
347fbd8b34aSJoseph Koshy.Dq emacs
348fbd8b34aSJoseph Koshyuse:
349fbd8b34aSJoseph Koshy.Dl "pmcstat -t '^emacs$' -p instructions"
350fbd8b34aSJoseph Koshy.Pp
3512c79db51SJoseph KoshyTo measure instructions retired for processes named
3522c79db51SJoseph Koshy.Dq emacs
3532c79db51SJoseph Koshyfor a period of 10 seconds use:
3542c79db51SJoseph Koshy.Dl "pmcstat -t '^emacs$' -p instructions sleep 10"
3552c79db51SJoseph Koshy.Pp
356ee4910b1SJoseph KoshyTo count instruction tlb-misses on CPUs 0 and 2 on a Intel
357ee4910b1SJoseph KoshyPentium Pro/Pentium III SMP system use:
358ee4910b1SJoseph Koshy.Dl "pmcstat -c 0,2 -s p6-itlb-miss"
359ee4910b1SJoseph Koshy.Pp
360b6010f9eSJoseph KoshyTo collect profiling information for a specific process with pid 1234
361b6010f9eSJoseph Koshybased on instruction cache misses seen by it use:
362b6010f9eSJoseph Koshy.Dl "pmcstat -P ic-misses -t 1234 -O /tmp/sample.out"
363b6010f9eSJoseph Koshy.Pp
364ee4910b1SJoseph KoshyTo perform system-wide sampling on all configured processors
365ee4910b1SJoseph Koshybased on processor instructions retired use:
3661fdbf256SJoseph Koshy.Dl "pmcstat -S instructions -O /tmp/sample.out"
367b6010f9eSJoseph KoshyIf callgraph capture is not desired use:
368b6010f9eSJoseph Koshy.Dl "pmcstat -N -S instructions -O /tmp/sample.out"
3691fdbf256SJoseph Koshy.Pp
370302cbb90SJoseph KoshyTo send the generated event log to a remote machine use:
371302cbb90SJoseph Koshy.Dl "pmcstat -S instructions -O remotehost:port"
372302cbb90SJoseph KoshyOn the remote machine, the sample log can be collected using
373302cbb90SJoseph Koshy.Xr nc 1 :
374302cbb90SJoseph Koshy.Dl "nc -l remotehost port > /tmp/sample.out"
375302cbb90SJoseph Koshy.Pp
3761fdbf256SJoseph KoshyTo generate
3771fdbf256SJoseph Koshy.Xr gprof 1
378b6010f9eSJoseph Koshycompatible profiles from a sample file use:
3791fdbf256SJoseph Koshy.Dl "pmcstat -R /tmp/sample.out -g"
380b6010f9eSJoseph Koshy.Pp
381b6010f9eSJoseph KoshyTo print a system-wide profile with callgraphs to file
382b6010f9eSJoseph Koshy.Pa "foo.graph"
383b6010f9eSJoseph Koshyuse:
384b6010f9eSJoseph Koshy.Dl "pmcstat -R /tmp/sample.out -G foo.graph"
385ebccf1e3SJoseph Koshy.Sh DIAGNOSTICS
386e572c7a7SJoseph KoshyIf option
387e572c7a7SJoseph Koshy.Fl v
388e572c7a7SJoseph Koshyis specified,
389e572c7a7SJoseph Koshy.Nm
390e572c7a7SJoseph Koshymay issue the following diagnostic messages:
391e572c7a7SJoseph Koshy.Bl -diag -width indent
392e572c7a7SJoseph Koshy.It "#callchain/dubious-frames"
393e572c7a7SJoseph KoshyThe number of callchain records that had an
394e572c7a7SJoseph Koshy.Dq impossible
395e572c7a7SJoseph Koshyvalue for a return address.
396e572c7a7SJoseph Koshy.It "#exec handling errors"
397e572c7a7SJoseph KoshyThe number of
398e572c7a7SJoseph Koshy.Xr exec 2
399e572c7a7SJoseph Koshyevents in the log file that named executables that could not be
400e572c7a7SJoseph Koshyanalyzed.
401e572c7a7SJoseph Koshy.It "#exec/elf"
402e572c7a7SJoseph KoshyThe number of
403e572c7a7SJoseph Koshy.Xr exec 2
404e572c7a7SJoseph Koshyevents that named ELF executables.
405e572c7a7SJoseph Koshy.It "#exec/unknown"
406e572c7a7SJoseph KoshyThe number of
407e572c7a7SJoseph Koshy.Xr exec 2
408e572c7a7SJoseph Koshyevents that named executables with unrecognized formats.
409e572c7a7SJoseph Koshy.It "#samples/total"
410e572c7a7SJoseph KoshyThe total number of samples in the log file.
411e572c7a7SJoseph Koshy.It "#samples/unclaimed"
412e572c7a7SJoseph KoshyThe number of samples that could not be correlated to a known
413e572c7a7SJoseph Koshyexecutable object (i.e., to an executable, shared library, the
414e572c7a7SJoseph Koshykernel or the runtime loader).
415e572c7a7SJoseph Koshy.It "#samples/unknown-object"
416e572c7a7SJoseph KoshyThe number of samples that were associated with an executable
417e572c7a7SJoseph Koshywith an unrecognized object format.
418e572c7a7SJoseph Koshy.El
419e572c7a7SJoseph Koshy.Pp
42021ce09caSJoseph Koshy.Ex -std
421b6010f9eSJoseph Koshy.Sh COMPATIBILITY
422b6010f9eSJoseph KoshyDue to the limitations of the
423b6010f9eSJoseph Koshy.Pa gmon.out
424b6010f9eSJoseph Koshyfile format,
425b6010f9eSJoseph Koshy.Xr gprof 1
426b6010f9eSJoseph Koshycompatible profiles generated by the
427b6010f9eSJoseph Koshy.Fl g
428b6010f9eSJoseph Koshyoption do not contain information about calls that cross executable
429b6010f9eSJoseph Koshyboundaries.
430b6010f9eSJoseph KoshyThe generated
431b6010f9eSJoseph Koshy.Pa gmon.out
432b6010f9eSJoseph Koshyfiles are also only meaningful for native executables.
433ebccf1e3SJoseph Koshy.Sh SEE ALSO
434f263522aSJoseph Koshy.Xr gprof 1 ,
435302cbb90SJoseph Koshy.Xr nc 1 ,
436ebccf1e3SJoseph Koshy.Xr execvp 3 ,
437ebccf1e3SJoseph Koshy.Xr pmc 3 ,
43821ce09caSJoseph Koshy.Xr pmclog 3 ,
439ebccf1e3SJoseph Koshy.Xr hwpmc 4 ,
440ebccf1e3SJoseph Koshy.Xr pmccontrol 8 ,
441ebccf1e3SJoseph Koshy.Xr sysctl 8
44221ce09caSJoseph Koshy.Sh HISTORY
44321ce09caSJoseph KoshyThe
44421ce09caSJoseph Koshy.Nm
44521ce09caSJoseph Koshyutility first appeared in
44621ce09caSJoseph Koshy.Fx 6.0 .
4471fdbf256SJoseph KoshyIt is
4481fdbf256SJoseph Koshy.Ud
44921ce09caSJoseph Koshy.Sh AUTHORS
45021ce09caSJoseph Koshy.An Joseph Koshy Aq jkoshy@FreeBSD.org
4519f8adcefSJoseph Koshy.Sh BUGS
452bc84aa4bSRuslan ErmilovThe
4539f8adcefSJoseph Koshy.Nm
454bc84aa4bSRuslan Ermilovutility cannot yet analyse
455302cbb90SJoseph Koshy.Xr hwpmc 4
456302cbb90SJoseph Koshylogs generated by non-native architectures.
457