PMC(1) | General Commands Manual | PMC(1)

# NAME

pmc — performance-monitoring counter interface

# SYNOPSIS

pmc | command [arguments]

# DESCRIPTION

The pmc tool can be used to control and inspect the state of the Performance-Monitoring Counters (PMCs) in the system.
The first argument, command, specifies the action to take. Valid commands are:

list
  Display a list of performance counter events available on the system.
start name:option [name:option ...]
  Start one or several counters. name specifies the name of the event to count; it must be taken from the list of available events. option specifies the source of the event; it must be a combination of u (userland) and k (kernel).
stop
  Stop any performance counters that are currently running, and display the values of these counters.

# FILES

src/sys/arch/x86/x86/pmc.c x86 implementation.
src/usr.bin/pmc/pmc.c pmc tool.

# EXAMPLES

The following command prints the available counters.
`# pmc list`
The following command starts two counters. The former will count the 'l2cache-access' events that are triggered from userland, the latter will count the 'l1cache-access' events triggered from both userland and the kernel.
`# pmc start l2cache-access:u l1cache-access:uk`
Note that the two following commands are not exactly identical.
`# pmc start l1cache-access:u l1cache-access:k`
`# pmc start l1cache-access:uk`
The former will start two different counters that have a different source but track the same event. The latter will start one counter that tracks the event from all sources; it therefore does the sum of the two counters from the first command, but takes only one counter to do so.

# INTERPRETING RESULTS

For each PMC on each CPU, the value reported by the pmc tool is the number of events counted, encoded in a 64bit integer.

# DIAGNOSTICS

PMC support not compiled into the kernel
  Performance-monitoring counter support has not been compiled into the kernel. It may be included using the PMC option. See options(4) for details.

# SEE ALSO

options(4)

# HISTORY

The pmc command first appeared in NetBSD 1.6. It was revamped in NetBSD 8.0.

# BUGS

The pmc command currently only supports performance-monitoring counters on the i386 and amd64 architectures.

July 12, 2017 | NetBSD 8.0