perf record question regarding grouped events
Hi all,
I have a question on the intended usage of the grouped events as in test case 114 perf record tests subtest 'Basic leader sampling' test where this command is executed:
# perf record -vv -e '{cycles,cycles}:uS' -- ...In the debug output the following 2 event are installed:
------------------------------------------------------------
perf_event_attr:
type 0 (PERF_TYPE_HARDWARE)
size 136
config 0 (PERF_COUNT_HW_CPU_CYCLES)
{ sample_period, sample_freq } 4000
sample_type IP|TID|TIME|READ|CPU|PERIOD|IDENTIFIER
read_format ID|GROUP|LOST
disabled 1
exclude_kernel 1
exclude_hv 1
freq 1
sample_id_all 1
------------------------------------------------------------
sys_perf_event_open: pid -1 cpu 0 group_fd -1 flags 0x8 = 5
------------------------------------------------------------
perf_event_attr:
type 0 (PERF_TYPE_HARDWARE)
size 136
config 0 (PERF_COUNT_HW_CPU_CYCLES)
sample_type IP|TID|TIME|READ|CPU|PERIOD|IDENTIFIER
read_format ID|GROUP|LOST
exclude_kernel 1
exclude_hv 1
sample_id_all 1 ------------------------------------------------------------
sys_perf_event_open: pid -1 cpu 0 group_fd 5 flags 0x8 = 6
What puzzles me is that the first event with file descriptor 5 is installed for sampling. The second event with file descriptor 6 is installed for counting because event attribute members attr::freq and attr::sample_freq are zero.
So of the 2 cycles events installed, the group leader is sampling and the other event is counting.
Is this understanding correct?
The test then checks if the number of samples matches the count from the counting event?
I have a question on the intended usage of the grouped events as in test case 114 perf record tests subtest 'Basic leader sampling' test where this command is executed:
# perf record -vv -e '{cycles,cycles}:uS' -- ...In the debug output the following 2 event are installed:
------------------------------------------------------------
perf_event_attr:
type 0 (PERF_TYPE_HARDWARE)
size 136
config 0 (PERF_COUNT_HW_CPU_CYCLES)
{ sample_period, sample_freq } 4000
sample_type IP|TID|TIME|READ|CPU|PERIOD|IDENTIFIER
read_format ID|GROUP|LOST
disabled 1
exclude_kernel 1
exclude_hv 1
freq 1
sample_id_all 1
------------------------------------------------------------
sys_perf_event_open: pid -1 cpu 0 group_fd -1 flags 0x8 = 5
------------------------------------------------------------
perf_event_attr:
type 0 (PERF_TYPE_HARDWARE)
size 136
config 0 (PERF_COUNT_HW_CPU_CYCLES)
sample_type IP|TID|TIME|READ|CPU|PERIOD|IDENTIFIER
read_format ID|GROUP|LOST
exclude_kernel 1
exclude_hv 1
sample_id_all 1 ------------------------------------------------------------
sys_perf_event_open: pid -1 cpu 0 group_fd 5 flags 0x8 = 6
What puzzles me is that the first event with file descriptor 5 is installed for sampling. The second event with file descriptor 6 is installed for counting because event attribute members attr::freq and attr::sample_freq are zero.
So of the 2 cycles events installed, the group leader is sampling and the other event is counting.
Is this understanding correct?
The test then checks if the number of samples matches the count from the counting event?
Thanks a lot for your help.
Signature · 9 lines
Thomas Richter, Dept 3303, IBM s390 Linux Development, Boeblingen, Germany -- IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Wolfgang Wendt Geschäftsführung: David Faller Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294
Hello,
Quoted 43 lines · Thomas Richter
Hi all,
I have a question on the intended usage of the grouped events as in test case 114 perf record tests subtest 'Basic leader sampling' test where this command is executed:
# perf record -vv -e '{cycles,cycles}:uS' -- ...In the debug output the following 2 event are installed:
------------------------------------------------------------
perf_event_attr:type 0 (PERF_TYPE_HARDWARE) size 136 config 0 (PERF_COUNT_HW_CPU_CYCLES) { sample_period, sample_freq } 4000 sample_type IP|TID|TIME|READ|CPU|PERIOD|IDENTIFIER read_format ID|GROUP|LOST disabled 1 exclude_kernel 1 exclude_hv 1 freq 1 sample_id_all 1 ------------------------------------------------------------ sys_perf_event_open: pid -1 cpu 0 group_fd -1 flags 0x8 = 5 ------------------------------------------------------------ perf_event_attr: type 0 (PERF_TYPE_HARDWARE) size 136 config 0 (PERF_COUNT_HW_CPU_CYCLES) sample_type IP|TID|TIME|READ|CPU|PERIOD|IDENTIFIER read_format ID|GROUP|LOST exclude_kernel 1 exclude_hv 1 sample_id_all 1------------------------------------------------------------
sys_perf_event_open: pid -1 cpu 0group_fd5 flags0x8= 6What puzzles me is that the first event with file descriptor 5 is installed for sampling. The second event with file descriptor 6 is installed for counting because event attribute members
attr::freqandattr::sample_freqare zero.
Quoted 6 lines
So of the 2 cycles events installed, the group leader is sampling and the other event is counting.
Is this understanding correct?
The test then checks if the number of samples matches the count from the counting event?
Yep, the syntax '{event1,event2}:S' is for group leader sampling which reduces the overhead of PMU interrupts. The idea is that those events are scheduled together so sampling is enabled only for the leader (usually the first) event and it reads counts from the member events using PERF_SAMPLE_READ.
So they should have the same counts if it uses the same events in a group.
Thanks,
Namhyung
Quoted 13 lines
Thanks a lot for your help.
Signature · 9 lines
Thomas Richter, Dept 3303, IBM s390 Linux Development, Boeblingen, Germany -- IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Wolfgang Wendt Geschäftsführung: David Faller Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294