History log of /freebsd-current/usr.sbin/pmcstat/pmcstat.8
Revision Date Author Comments
# fa9896e0 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: two-line nroff pattern

Remove /^\.\\"\n\.\\"\s*\$FreeBSD\$$\n/


# a5b3e563 10-Jul-2023 Mitchell Horne <mhorne@FreeBSD.org>

pmcstat(8): Drop .Ud

This utility has existed for a long time and should not be advertised as
"currently under development".

While here, fix the one other warning from igor about using a newline
for a new sentence.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation


# 296a0987 30-May-2023 Jessica Clarke <jrtc27@FreeBSD.org>

pmcstat: Update manpage date

Fixes: 53d0b9e438bc ("pmc: Provide full path to modules from kernel linker")


# 53d0b9e4 30-May-2023 Jessica Clarke <jrtc27@FreeBSD.org>

pmc: Provide full path to modules from kernel linker

This unifies the user object and kernel module paths in libpmcstat,
allows modules loaded from non-standard locations (e.g. from a user's
home directory when testing) to be found and, since buffer is what all
the warnings here use (they were never updated when buffer_modules were
added to pick based on where the file was found) has the side-effect of
ensuring the messages are correct.

This includes obsoleting the now-superfluous -k option in pmcstat.

This change breaks the hwpmc ABI and will be followed by a bump to the
pmc major version.

Reviewed by: jhb, jkoshy, mhorne
Differential Revision: https://reviews.freebsd.org/D40048


# 047ce3db 24-Mar-2023 Joseph Koshy <jkoshy@FreeBSD.org>

pmcstat: Warn about text output format stability.

The formats for pmcstat(8)'s human-readable output are not part of its
user interface definition, and may change in the future. Highlight
this in its manual page.

Approved by: gnn (mentor)
Differential Revision: https://reviews.freebsd.org/D39249


# 51ae4071 17-Aug-2020 Mateusz Piotrowski <0mp@FreeBSD.org>

pmcstat.8: Improve description of -T


# 94e9ef85 05-Aug-2020 Mateusz Guzik <mjg@FreeBSD.org>

pmcstat: implement showing offsets into symbols in top mode

The -I option (and hotkey) is reused for this. Skipping symbol resolution is
moved to the new -A option (and hotkey).

While arguably this violates POLA I think it's a change for the better.
ALso note the -I option was added in head.

Differential Revision: https://reviews.freebsd.org/D21658


# 797711a8 12-Mar-2020 Ryan Moeller <freqlabs@FreeBSD.org>

libpmcstat: Try /boot/modules if module not found

Modules from ports/pkg are commonly installed to /boot/modules rather than to
the same directory the kernel resides in. Look there if a module is not found
next to the kernel.

Submitted by: mmacy
Reported by: Nick Principe <nap@iXsystems.com>
Approved by: mmacy (mentor)
MFC after: 2 weeks
Sponsored by: iXsystems, Inc.


# 5de96e33 03-Jun-2018 Matt Macy <mmacy@FreeBSD.org>

hwpmc: support sampling both kernel and user stacks when interrupted in kernel

This adds the -U options to pmcstat which will attribute in-kernel samples
back to the user stack that invoked the system call. It is not the default,
because when looking at kernel profiles it is generally more desirable to
merge all instances of a given system call together.

Although heavily revised, this change is directly derived from D7350 by
Jonathan T. Looney.

Obtained from: jtl
Sponsored by: Juniper Networks, Limelight Networks


# 959826ca 26-May-2018 Matt Macy <mmacy@FreeBSD.org>

pmc(3)/hwpmc(4): update supported Intel processors to rely fully on the
vendor provided pmu-events tables and sundry cleanups.

The vendor pmu-events tables provide counter descriptions, default
sample rates, event, umask, and flag values for all the counter
configuration permutations. Using this gives us:

- much simpler kernel code for the MD component
- helpful long and short event descriptions
- simpler user code
- sample rates that won't overload the system

Update man page with newer sample types and remove unused sample type.


# 5506ceb8 26-May-2018 Matt Macy <mmacy@FreeBSD.org>

Revert r334242 "pmc(3)/hwpmc(4): update supported Intel processors to rely fully on the"
because of squash commit messages


# 49281356 26-May-2018 Matt Macy <mmacy@FreeBSD.org>

pmc(3)/hwpmc(4): update supported Intel processors to rely fully on the
vendor provided pmu-events tables and sundry cleanups.

The vendor pmu-events tables provide counter descriptions, default
sample rates, event, umask, and flag values for all the counter
configuration permutations. Using this gives us:

- much simpler kernel code for the MD component
- helpful long and short event descriptions
- simpler user code
- sample rates that won't overload the system

Update man page with newer sample types and remove unused sample type.

Squashed commit of the following:

commit 4459d43eff815bec08ccc5533dbe5de846f03128
Author: Matt Macy <mmacy@mattmacy.io>
Date: Sat May 26 00:06:31 2018 -0700

libpmc: fix pmu function signatures for non amd64

commit a2cb8bbc586c65d41f9b291430a2261ec67b59fe
Author: Matt Macy <mmacy@mattmacy.io>
Date: Fri May 25 22:38:11 2018 -0700

pmcstat: fix indentation of usage

commit f686954b15ff56a833ac80404898977cb80a265b
Author: Matt Macy <mmacy@mattmacy.io>
Date: Fri May 25 22:19:49 2018 -0700

pmclog(3): add callchain and pmcallocatedyn, remove pcsample

commit 73e13a0d2e9498c81c150d14d022050cee7511bb
Author: Matt Macy <mmacy@mattmacy.io>
Date: Fri May 25 22:19:00 2018 -0700

pmclog.h: GC pcsample field

commit 3e93ffd65da641fa657539dad3c48e281f8b5798
Author: Matt Macy <mmacy@mattmacy.io>
Date: Fri May 25 22:05:57 2018 -0700

hwpmc: make Intel core CPUs use external event tables

commit 634f5fae1e1644ac324003136c66cd9c619d1c93
Author: Matt Macy <mmacy@mattmacy.io>
Date: Fri May 25 22:00:06 2018 -0700

pmclog: update log record types, bump PMC_MAJOR
- explicitly make log record types a multiple of 8 bytes
- hook in pmu event types for pmc_allocate records
- remove references to no longer PCSAMPLE record

commit 83d84fcd2d65bdf6ddcb2e155a22f0cfa2a9c225
Author: Matt Macy <mmacy@mattmacy.io>
Date: Fri May 25 21:52:10 2018 -0700

libpmc: add support for having vendor table driven pmc_allocate

commit 9e6ad63c40c2fce8404847ace5078ca6cb33a736
Author: Matt Macy <mmacy@mattmacy.io>
Date: Fri May 25 19:11:33 2018 -0700

hwpmc_core: add accessors for EVSEL & UMASK, make IAP_UMASK useful to user

commit 859dceb93daa6419a48c794db99b6758e5b041c9
Author: Matt Macy <mmacy@mattmacy.io>
Date: Fri May 25 19:09:45 2018 -0700

pmcstat: update usage and man page as well as make -L consistent with pmccontrol

commit 79c7d8597e28c2eb13f5f9113e65ec2792ca57b1
Author: Matt Macy <mmacy@mattmacy.io>
Date: Fri May 25 18:07:03 2018 -0700

pmu_util: add support for all current intel event keywords

commit d8089c7f6a6c8527f38324252b1ffb47004694c6
Author: Matt Macy <mmacy@mattmacy.io>
Date: Fri May 25 17:45:00 2018 -0700

add description for new arguments

commit 058336740bab53c62ec88a3a026ea848cf3878c6
Author: Matt Macy <mmacy@mattmacy.io>
Date: Fri May 25 17:38:15 2018 -0700

libpmc: move pmu_events table and pmu_utils out of libpmcstat so that they can be used by pmc_allocate

commit 049b66b382e2f833c3f47bc8df9e750cb265709f
Author: Matt Macy <mmacy@mattmacy.io>
Date: Fri May 25 16:12:41 2018 -0700

pmcstat: hook pmu_events counter description utility routines in

commit f5e01e7b37a691dc045e1aa16b3ebdd162515de8
Author: Matt Macy <mmacy@mattmacy.io>
Date: Fri May 25 16:11:59 2018 -0700

pmu_events: add utility routines for listing counters and their descriptions

commit cba4d4f8907f772279f86f18f915e0d74d33ac56
Author: Matt Macy <mmacy@mattmacy.io>
Date: Fri May 25 16:09:50 2018 -0700

pmu-events: expand out skylake regex to simplify string matches


# e22ee9b2 25-May-2018 Sean Bruno <sbruno@FreeBSD.org>

pmcstat(8)
- Document per thread filtering.

Submitted by: kbowling
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D15549


# cc2ccfbe 18-Nov-2015 Jonathan T. Looney <jtl@FreeBSD.org>

Fix the date on the pmcstat(8) man page from r291016.

Approved by: gnn (mentor)
MFC after: 1 month
X-MFC with: r291016
Pointy hat to: jtl


# 465dadb5 18-Nov-2015 Jonathan T. Looney <jtl@FreeBSD.org>

Support a wider history counter in pmcstat(8) gmon output

pmcstat(8) contains an option to output sampling data in a gmon format
compatible with gprof(1). Currently, it uses the default histcounter,
which is an (unsigned short). With large sets of sampling data, it
is possible to overflow the maximum value provided by an (unsigned
short).

This change adds the -e argument to pmcstat. If -e and -g are both
specified, pmcstat will use a histcounter type of uint64_t.

Differential Revision: https://reviews.freebsd.org/D4151
Reviewed by: jhb, bjk
Approved by: gnn (mentor)
MFC after: 1 month
Sponsored by: Juniper Networks


# ef16b9ab 27-May-2015 John Baldwin <jhb@FreeBSD.org>

Use the cpuset API more consistently:
- Fetch the root set from cpuset_getaffinity() instead of assuming all CPUs
from 0 to hw.ncpu are the root set.
- Use CPU_SETSIZE and CPU_FFS.
- The original notion of halted CPUs the manpage and code refers to is gone.
Use the term "available" instead.

Differential Revision: https://reviews.freebsd.org/D2491
Reviewed by: emaste
MFC after: 1 week


# 38fd3834 08-May-2015 John Baldwin <jhb@FreeBSD.org>

Use the kern.bootfile sysctl to set the default kernel path rather than
hardcoding /boot/kernel. This allows pmcstat(8) to work without -k when
using nextboot -k or 'boot foo' at the loader to boot alternate kernels.

Differential Revision: https://reviews.freebsd.org/D2425
Reviewed by: adrian, emaste, gnn
MFC after: 2 weeks
Sponsored by: Norse Corp, Inc.


# 10813ab3 28-Mar-2015 Eric van Gyzen <vangyzen@FreeBSD.org>

pmcstat.8: fix -a flag description; improve -m flag to match

The -a flag reads a file saved by -O, not -o.

The -m flag requires the -R flag. Copy that paragraph from -a.

Reviewed by: adrian
Approved by: kib (mentor)
MFC after: 1 week
Sponsored by: Dell Inc


# f42d8dec 27-Oct-2014 Baptiste Daroussin <bapt@FreeBSD.org>

Fix rendering

Submitted by: brueffer


# 99e33eab 27-Oct-2014 Baptiste Daroussin <bapt@FreeBSD.org>

Clarify the documentation of pmcstat:
the -d argument should be passed before -p, -s, -P or -S to be taken in account

Differential Revision: https://reviews.freebsd.org/D1011
Reviewed by: adrian, gnn
MFC after: 1 week


# f8d7aff9 29-Jul-2014 Joel Dahl <joel@FreeBSD.org>

mdoc: kill EOL whitespace.


# 01c2b8ac 20-Jun-2014 Baptiste Daroussin <bapt@FreeBSD.org>

use .Mt to mark up email addresses consistently (part2)

PR: 191174
Submitted by: Franco Fichtner <franco@lastsummer.de>


# 1cb3ec2e 18-May-2014 George V. Neville-Neil <gnn@FreeBSD.org>

Update the date on the manual page.

Pointed out by: bz


# 72fe532c 15-May-2014 George V. Neville-Neil <gnn@FreeBSD.org>

Add a command line argument (-l) to end event collection after some
number of seconds. The number of seconds may be a fraction.

Submitted by: Julien Charbon <jcharbon@versign.com>
MFC after: 2 weeks
Relnotes: yes


# f6f851a3 29-Apr-2014 Scott Long <scottl@FreeBSD.org>

Document the -a option that was added in r262424.

Obtained from: Netflix, Inc.
MFC after: 3 days


# 8972c8b6 03-Jun-2012 Joel Dahl <joel@FreeBSD.org>

Minor spelling fixes.


# 46355096 26-Mar-2012 Joel Dahl <joel@FreeBSD.org>

mdoc: correct .Bd/.Bl arguments.

Reviewed by: brueffer


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# aa12cea2 14-Apr-2010 Ulrich Spörlein <uqs@FreeBSD.org>

mdoc: order prologue macros consistently by Dd/Dt/Os

Although groff_mdoc(7) gives another impression, this is the ordering
most widely used and also required by mdocml/mandoc.

Reviewed by: ru
Approved by: philip, ed (mentors)


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# 2553c385 05-Mar-2010 Fabien Thomas <fabient@FreeBSD.org>

MFC 203790:
- Reorganize code in 'plugin' to share log processing.
- Kcachegrind (calltree) support with assembly/source
code mapping and call count estimator (-F).
- Top mode for calltree and callgraph plugin (-T).


# 0b86b1bb 11-Feb-2010 Fabien Thomas <fabient@FreeBSD.org>

- Reorganize code in 'plugin' to share log processing.
- Kcachegrind (calltree) support with assembly/source
code mapping and call count estimator (-F).
- Top mode for calltree and callgraph plugin (-T).

MFC after: 1 month


# a2c0b3ae 01-Jun-2009 Joseph Koshy <jkoshy@FreeBSD.org>

Catch up with the times: "mozilla" -> "firefox".


# c0252222 25-Nov-2008 Attilio Rao <attilio@FreeBSD.org>

Add the -m option to pmcstat.
This option prints the list of sampled PCs along with the function name,
the start and end addresses of this where their live within.

Reviewed by: jkoshy
Tested by: gnn
Sponsored by: Nokia


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 5477328d 07-Oct-2008 Joseph Koshy <jkoshy@FreeBSD.org>

- Avoid a spurious error when a command line is specified without
any process scope PMCs.
- Change the -c '*' option to denote non-halted CPUs.


# 2c79db51 19-Sep-2008 Joseph Koshy <jkoshy@FreeBSD.org>

Add an example illustrating the use sleep(1) for performing timed
measurements.


# e572c7a7 29-Jun-2008 Joseph Koshy <jkoshy@FreeBSD.org>

Document messages printed in verbose mode.

Requested by: Fabien Thomas <fabien.thomas at netasq dot com>


# b6010f9e 07-Dec-2007 Joseph Koshy <jkoshy@FreeBSD.org>

Introduce pmcstat(8) changes for summarizing hwpmc(4) callchain records in
in textual form and in gmon.out format.

Update manual page.

Sponsored by: FreeBSD Foundation and Google Inc.


# fbd8b34a 26-Apr-2007 Joseph Koshy <jkoshy@FreeBSD.org>

MFP4: Enhancements to pmcstat(8):

- Allow the "-t" option to take a regular expression naming command
line processes to attach process PMCs to.

- Update the manual page and add an example showing the use of the
new functionality.

- Update the (c) year on the affected source files.


# ee4910b1 22-Apr-2007 Joseph Koshy <jkoshy@FreeBSD.org>

MFP4: Enhancements and bug-fixes to pmcstat(8):

- The '-c' option now takes a comma-separated list of CPU
numbers, or a literal '*' denoting all CPUs in the system.
Subsequent system PMCs are allocated on the CPUs so specified.

Change the default behaviour to allocate system PMCs on all CPUs,
not just CPU 0.

Update the manual page and add an example of how to use the new
functionality.

- Attach PMCs to a (commandline) child process more reliably. This
fixes a long standing bug in counting events incurred by short-lived
processes.


# bc84aa4b 29-Sep-2006 Ruslan Ermilov <ru@FreeBSD.org>

Markup fixes.


# 302cbb90 01-Apr-2006 Joseph Koshy <jkoshy@FreeBSD.org>

- Teach pmcstat(8) to log over the network; the -O option now
takes a host:port specification.
- Update the manual page and add an example showing how log
over the network using pmcstat(8) and nc(1). Document the
current inability to process logs in cross-platform manner.
- Have pmcstat_open_log() call err(3) directly in case
of an error; this simplifies error handling in its caller.

MFC after: 1 week


# 49874f6e 25-Mar-2006 Joseph Koshy <jkoshy@FreeBSD.org>

MFP4: Support for profiling dynamically loaded objects.

Kernel changes:

Inform hwpmc of executable objects brought into the system by
kldload() and mmap(), and of their removal by kldunload() and
munmap(). A helper function linker_hwpmc_list_objects() has been
added to "sys/kern/kern_linker.c" and is used by hwpmc to retrieve
the list of currently loaded kernel modules.

The unused `MAPPINGCHANGE' event has been deprecated in favour
of separate `MAP_IN' and `MAP_OUT' events; this change reduces
space wastage in the log.

Bump the hwpmc's ABI version to "2.0.00". Teach hwpmc(4) to
handle the map change callbacks.

Change the default per-cpu sample buffer size to hold
32 samples (up from 16).

Increment __FreeBSD_version.

libpmc(3) changes:

Update libpmc(3) to deal with the new events in the log file; bring
the pmclog(3) manual page in sync with the code.

pmcstat(8) changes:

Introduce new options to pmcstat(8): "-r" (root fs path), "-M"
(mapfile name), "-q"/"-v" (verbosity control). Option "-k" now
takes a kernel directory as its argument but will also work with
the older invocation syntax.

Rework string handling in pmcstat(8) to use an opaque type for
interned strings. Clean up ELF parsing code and add support for
tracking dynamic object mappings reported by a v2.0.00 hwpmc(4).

Report statistics at the end of a log conversion run depending
on the requested verbosity level.

Reviewed by: jhb, dds (kernel parts of an earlier patch)
Tested by: gallatin (earlier patch)


# 9f8adcef 17-Oct-2005 Joseph Koshy <jkoshy@FreeBSD.org>

Document pmcstat's inability to handle 32 bit executables on the
AMD64 while I work on a fix.

Noticed by: ps


# 00028966 13-Jul-2005 Robert Watson <rwatson@FreeBSD.org>

Fix spelling error in sample command.

MFC after: 3 days


# 1fdbf256 30-Jun-2005 Joseph Koshy <jkoshy@FreeBSD.org>

Add examples illustrating how to record system-wide profiles and
how to convert these to gprof(1) flat profiles. Augment description
for the '-g' option.

Remove superfluous quotes around a macro argument, bump document date [1].

Reminded by: ru [1]
Approved by: re (blanket hwpmc)


# 15139246 30-Jun-2005 Joseph Koshy <jkoshy@FreeBSD.org>

MFP4:

- pmcstat(8) gprof output mode fixes:

lib/libpmc/pmclog.{c,h}, sys/sys/pmclog.h:
+ Add a 'is_usermode' field to the PMCLOG_PCSAMPLE event
+ Add an 'entryaddr' field to the PMCLOG_PROCEXEC event,
so that pmcstat(8) can determine where the runtime loader
/libexec/ld-elf.so.1 is getting loaded.

sys/kern/kern_exec.c:
+ Use a local struct to group the entry address of the image being
exec()'ed and the process credential changed flag to the exec
handling hook inside hwpmc(4).

usr.sbin/pmcstat/*:
+ Support "-k kernelpath", "-D sampledir".
+ Implement the ELF bits of 'gmon.out' profile generation in a new
file "pmcstat_log.c". Move all log related functions to this
file.
+ Move local definitions and prototypes to "pmcstat.h"

- Other bug fixes:
+ lib/libpmc/pmclog.c: correctly handle EOF in pmclog_read().
+ sys/dev/hwpmc_mod.c: unconditionally log a PROCEXIT event to all
attached PMCs when a process exits.
+ sys/sys/pmc.h: correct a function prototype.
+ Improve usage checks in pmcstat(8).

Approved by: re (blanket hwpmc)


# 21ce09ca 24-Jun-2005 Joseph Koshy <jkoshy@FreeBSD.org>

- Tidy markup. [1]
- Remove mention of an unimplemented option.
- Clarify the behavior of pmcstat when logging PMCs are
requested, but no log output file is specified.
- Add a cross-reference to pmclog(3).
- Bump document date.

Reviewed by: ru
Submitted by: ru [1]
Approved by: re (blanket hwpmc)


# f263522a 09-Jun-2005 Joseph Koshy <jkoshy@FreeBSD.org>

MFP4:

- Implement sampling modes and logging support in hwpmc(4).

- Separate MI and MD parts of hwpmc(4) and allow sharing of
PMC implementations across different architectures.
Add support for P4 (EMT64) style PMCs to the amd64 code.

- New pmcstat(8) options: -E (exit time counts) -W (counts
every context switch), -R (print log file).

- pmc(3) API changes, improve our ability to keep ABI compatibility
in the future. Add more 'alias' names for commonly used events.

- bug fixes & documentation.


# ebccf1e3 18-Apr-2005 Joseph Koshy <jkoshy@FreeBSD.org>

Bring a working snapshot of hwpmc(4), its associated libraries, userland utilities
and documentation into -CURRENT.

Bump FreeBSD_version.

Reviewed by: alc, jhb (kernel changes)