* perf record question regarding grouped events
@ 2025-02-19 10:57 Thomas Richter
2025-02-24 23:57 ` Namhyung Kim
0 siblings, 1 reply; 2+ messages in thread
From: Thomas Richter @ 2025-02-19 10:57 UTC (permalink / raw)
To: linux-perf-use., Ian Rogers
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.
--
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: perf record question regarding grouped events
2025-02-19 10:57 perf record question regarding grouped events Thomas Richter
@ 2025-02-24 23:57 ` Namhyung Kim
0 siblings, 0 replies; 2+ messages in thread
From: Namhyung Kim @ 2025-02-24 23:57 UTC (permalink / raw)
To: Thomas Richter; +Cc: linux-perf-use., Ian Rogers
Hello,
On Wed, Feb 19, 2025 at 11:57:46AM +0100, Thomas Richter wrote:
> 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?
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
> Thanks a lot for your help.
>
> --
> 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
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-02-24 23:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-19 10:57 perf record question regarding grouped events Thomas Richter
2025-02-24 23:57 ` Namhyung Kim
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).