@Alina,
If you read the man page for perf record, you can see that perf record -P
will be used to record the sample period, and not specify it.
If you want to record more/less samples and modify the period, you have to specify the command like perf record -c 2
(--count=
) where 2 is the sampling period. This will mean that for every 2 occurrences of the event that you are measuring, you will have a sample for that. You can then modify the sampling period and test various values.
The other way around to express the sampling period, is to specify the average rate of samples per second (frequency) - which you can do using perf record -F
. So perf record -F 1000
will record around 1000 samples per second and these samples will be generated when the hardware/PMU counter corresponding to the event overflows. This means that the kernel will dynamically adjust the sampling period.