Collecting data in counting mode
In counting mode, you collect counter data across all processes that run on the Linux® instance.
All counters support this mode, including the CRYPTO_ALL
and
NNPA_ALL
summary counters.
# perf stat -e <counter_set>/<counter_name>/<filter> -C<cpus> -- <cmd>
- -e | --event= <counter_set>/<counter_name>/<filter>
- specifies a counter event. Specify multiple events to collect data for multiple counters with a
single command.
- <counter_set>
- specifies one of the available counter sets. Possible values are
pai_crypto
andpai_ext
. - <counter_name>
- is
CRYPTO_ALL
,NNPA_ALL
, or one of the cryptographic or analytic counters that are listed by the perf list command. - <filter>
- omit <filter> to count all calls of the instruction. Specify
u to count only calls from user space or k to count only calls
from the kernel.Note: This option applies only to the cryptographic counters.
Example: This event specification collects data for user space calls of theKM_AES_256
counter.--event=pai_crypto/KM_AES_256/u
The following equivalent specification uses the short option.-e pai_crypto/KM_AES_256/u
As an alternative numeric notation to the pai_crypto/<counter_name>/ format, you can specify the event as the PMU number of
pai_crypto
orpai_ext
, followed by a colon (:), followed by the event number of the counter. To specify a filter in this notation, append a colon (:) followed by u or k.For cryptographic counters, obtain the PMU number by reading /sys/devices/pai_crypto/type and the event number by reading the attribute that represents the counter at /sys/devices/pai_crypto/events.
For analytic counters, obtain the PMU number by reading /sys/devices/pai_ext/type and the event number by reading the attribute that represents the counter at /sys/devices/pai_ext/events.
Example: Issue the following commands to find out which specifications to use for theKM_AES_256
counter.
With this information, the specification becomes:# cat /sys/devices/pai_crypto/type 10 # cat /sys/devices/pai_crypto/events/KM_AES_256 event=0x1009
-e 10:0x1009
Omit the 0x to specify the event number in decimal notation:-e 10:4105
Add a filter if required, for example, add:u
to count only user-space calls:-e 10:4105:u
- -C | --cpu <cpus>
- specifies the CPUs for which the command counts calls. To count calls for all CPUs omit the
-C option and specify -a instead.
<cpus> is a comma-separated list of CPU numbers and ranges of CPU numbers . In a range, a hyphen (-) separates the first CPU number from the last CPU number. Specify the list without blanks.
With both the short option and the long option, you can separate the option and the list of CPUs with a blank. You can omit the blank for the short option. You can specify an equal sign instead of the blank for the long option.
Example: The following specifications are all equivalent variants for counting calls for CPUs with numbers 2, 5, 6, and 7.- Short option and listing all CPUs individually:
-C 2,5,6,7
- Using a range:
-C 2,5-7
- Omitting the blank:
-C2,5-7
- Long option with blank:
--cpu 2,5-7
- Long option with equal sign (=):
--cpu=2,5-7
- Short option and listing all CPUs individually:
- <cmd>
- is a shell command, for example a sleep command to specify a count interval. The perf stat command counts calls for the duration that this command takes to complete. The counter data covers all processes that run on the Linux instance not just instructions that are related to this command.
KM_AES_256
and KMA_GCM_AES_256
counters across all CPUs during a
10 second interval, starting from when the perf command is
issued.# perf stat -e pai_crypto/KM_AES_256/ -e pai_crypto/KMA_GCM_AES_256/ -a -- sleep 10
Performance counter stats for ’system wide’:
703 pai-crypto/KM_AES_256/
36 pai-crypto/KMA_GCM_AES_256/
10.004003874 seconds time elapsed
While the command ran, the KM_AES_256 counter was
incremented to 703 and the KMA_GCM_AES_256 counter to 36. The counter values are decimal
numbers.