hpmstat Command
Purpose
Provides system-wide hardware performance counter information.
Syntax
hpmstat [ -b time_base ] [ -d ] [ -D metrics ] [ -O options ] [ -g event_groups ] [ -H ] [ -k ] [ -m metrics_groups ] [ -o file ] [ -r ] [ -s set ] [ -T ] [ -U ] [-u ] [ -x ] [ -@ ALL | WparName ] interval count
hpmstat [-h]Description
The hpmstat command provides the execution wall clock time, hardware performance counters information, and derived hardware metrics. Only a user with root privilege can use the hpmstat command.
When specified without command-line options, hpmstat command counts the
default 1 iteration of user, kernel, and hypervisor (for processors that supports
hypervisor mode) activity for 1 second for the default set 1 of events. It then
writes the raw counter values and derived metrics to standard output. By default,
runlatch is disabled so that counts can be performed while executing in idle cycle.
When the -U option is specified, interval is in microseconds, the iteration count is infinity, and derived metrics are not calculated and written to standard output. This option is ignored if the counter multiplexing mode is specified.
When the -T option is specified, output information is preceded by the timestamp (seconds plus microseconds) and timing information is written as timestamps instead of time in seconds.
Event types to be monitored and the associated hardware performance counters are specified by
using either the set -s option or by specifying an event group name or set
number in the HPM_EVENT_SET environment variable. Alternatively, specify counter
and event pairs (POWER3 and PowerPC 604 RISC Microprocessor) or an event group name (POWER4 and later) in the
libHPM_events input file (takes precedence over
HPM_EVENT_SET). A counting mode can qualify each set. An event group number or name
can be specified by setting the -g option or specifying a comma-separated list
of event groups in the HPM_EVENT_GROUP environment variable. In the same manner, a
counting mode can qualify each event group.
A comma-separated list of event sets can be specified
instead of a set number, in which case the counter multiplexing mode
is selected. To select all event sets, set the set number value to 0.
Valid event set numbers run from 1 to a higher limit dependent upon the
processor type, which can be listed by using the pmlist command.
A comma-separated list of derived metrics can be specified by setting the -D option. A counting mode can qualify each derived metric.
A list of derived metric groups can be specified by setting the -m option
or by specifying a comma-separated list of derived metric groups in the
HPM_PMD_GROUP environment variable. This operation allows the user to select all
the derived metrics that pertains to the specified groups. A counting node qualifies each metric
group.
When counting in multiplexing mode, the results must be normalized before being used. The
default base that is used for the data normalization is the timebase. The -b
option allows for the use of the PURR time or the SPURR time (when supported by the processor) for
the data normalization. The base for the data normalization can also be defined by using the
HPM_NORMALIZE environment variable.
When you run the hpmstat command from the global workload partition (WPAR),
it is possible to monitor a specific WPAR by using the -@
WparName option. You can use the -@
ALL option to monitor all active WPARs in the system and to retrieve per-WPAR
data.
Results can be output in XML format by using the -x option.
Flags
| Item | Description |
|---|---|
-@
ALL | WparName |
Selects the target WPAR in which the activity is to be measured. The
ALL value means that the hpmstat command measures all active
WPARs in the system and reports the activity for each WPAR. This option is only available when you
run the hpmstat command from the global WPAR. |
| -b time_base | Selects a base for the data normalization. Following are the available bases:
time. |
| -d | Adds detailed set counts for counter multiplexing mode. |
| -D metrics | Selects a list of derived metrics to be evaluated. A counting mode can qualify each derived
metric by using the following option: (See the
-m option for available counting modes.) |
| -O options | The -O option can have the following values:
|
| -O options (continued) |
|
| -O options (continued) |
|
| -O options (continued) |
|
| -g event_groups | Lists a predefined group of events or a comma-separated list of event group names or numbers.
When a comma-separated list of groups is used, the counter multiplexing mode is selected. A counting
mode can qualify each event group by using the following option:
(See the -m option for
available counting modes.) |
| -H | Counts hypervisor activity only. |
| -h | Displays help message. |
| -k | Counts system activity only. |
| -m metrics_groups | Selects a list of derived metric groups to be evaluated. The default derived metric group
refers to all derived metrics that do not belong to a specific derived metric group. A counting mode
can qualify each metric group by using the following option:
Following are the available counting
modes:
|
| -o file | Output file name. |
| -r | Enables runlatch and disables counts while executing in idle
cycle. |
| -s set | Lists a predefined set of events or a comma-separated list of sets
(1 to N, or 0 to select all. See the pmlist
command.) When a comma-separated list of sets is used, the counter multiplexing mode is selected. A
counting mode can qualify each set by using the following option:
(See the -m option for available
counting modes.) |
| -T | Writes timestamps instead of time in seconds. |
| -U | Puts counting time interval in microseconds. This option is ignored if the counter multiplexing mode is specified. |
| -u | Counts user activity only. |
| -x | Displays results in VPA XML format. |
Parameters
| Item | Description |
|---|---|
| interval | Displays the counting time interval in seconds
or microseconds, with a default value of 1. |
| count | Shows the number of iterations to count. The default is 1
with an interval in seconds, and infinity when the option -U is
specified. |
Environment Variables
The following environment variables directly affect the execution of the
hpmstat command (there are more MP_* environment variables that
influence the execution of parallel programs).
| Item | Description |
|---|---|
| HPM_EVENT_SET | Selects one of the event sets. The value can be an integer from
1 to 6 on POWER3 systems, 1 to
4 on PowerPC 604 RISC Microprocessor systems, or
1 to a processor-dependent higher limit on POWER4 and later systems. This environment
variable is also used to select an event group name on POWER4 and later systems. A counting mode can
qualify each event set by using the following option:
The -g or
-s option takes precedence over this variable. The
HPM_EVENT_GROUP environment variable takes precedence over this
variable. |
| HPM_EVENT_GROUP | Selects the event groups. A comma-separated list of event groups can be specified. In this
case, the counter multiplexing mode is selected. A counting mode can qualify each event group by
using the following option: The
-g or -s option takes precedence over this variable. The
HPM_EVENT_GROUP environment variable takes precedence over the
HPM_EVENT_SET variable. |
| HPM_NORMALIZE | Provides the base to be used for the data normalization. The -b option takes precedence over this variable. |
| HPM_PMD_GROUP | Specifies a comma-separated list of derived metric groups. A counting mode can qualify each metric group. The -m option takes precedence over this variable. |
| HPM_PMD_METRIC | Specifies a comma-separated list of derived metrics. A counting mode can qualify each derived metric. The -D option takes precedence over this variable. |
| HPM_DIV_WEIGHT | Provides a weight (an integer greater than 1)
to be used to compute weighted flips on POWER4 systems. |
HPM_MX_DURATION |
When counting in counter multiplexing mode, this flag specifies the duration of each slice of time. It is expressed in ms, and must lie in the range of 10 ms - 30 s. When this flag is not set, the default value that is used for the time slice duration is 100 ms. |
- HPM_MEM_LATENCY
- HPM_L3_LATENCY
- HPM_L35_LATENCY
- HPM_AVG_L3_LATENCY
- HPM_AVG_L2_LATENCY
- HPM_L2_LATENCY
- HPM_L25_LATENCY
- HPM_L275_LATENCY
- HPM_L1_LATENCY
- HPM_TLB_LATENCY
Exit Status
| Item | Description |
|---|---|
0 |
Successful completion. |
>0 |
An error occurred. |
Security
Examples
- To write information for system, user, and hypervisor activity over a 1-second interval that
concerns events in set 2 from hardware counters, enter the following command:
hpmstat -s 2 - To write information for the user activity that concerns events of group 0 and the system
activity that concerns events of group 1 for the
wpar1WPAR over a five-second interval, enter the following command:hpmstat -@ wpar1 -g 0:u,1:k 5 - To count the number of threshold count events that are elapsed between a distinct
pair of threshold start events and end events and to specify the threshold value for comparison,
enter the following command:
hpmstat -g 607 -O threshold_cmp_val=10000 -O threshold_event_sel=THRESHOLD_COUNT_CYCLES -O threshold_eve_start_sel=PM_MRK_L1_RELOAD_VALID -O threshold_eve_stop_sel=PM_MRK_ST_DONE_L2 -O random_samp_ele_crit=ALL_INSTR
Location
/usr/bin/perf/pmapi/hpmstat
Standard Input
Not used.
Standard Output
Performance monitoring results are written to stdout, unless the
-o
file option is specified on the command line.
Standard Error
Used only for diagnostic messages.
Files
The following input files are used if present.
| Item | Description |
|---|---|
| libHPM_events | User-supplied event set file. This file does not take precedence over the
command lines that are specified with the -s option. The format for a POWER3
andPowerPC 604 RISC Microprocessor counter and event pair is
counternumber eventname. For example: For a POWER4
event group name, the format is event_group_name. For example:
|
| HPM_flags.env | File containing environment variable and value pairs that are used for the
computation of derived metrics. For example: |
The following output files are used.
| Item | Description |
|---|---|
| file | File specified with the -o option for hpmstat command output results. |