* Question to perf record command
@ 2023-09-29 9:56 Thomas Richter
2023-09-30 6:32 ` Namhyung Kim
0 siblings, 1 reply; 2+ messages in thread
From: Thomas Richter @ 2023-09-29 9:56 UTC (permalink / raw)
To: linux-perf-use.
I have a question regarding command perf record.
Command ./perf record -R -e cycles -vvv -C0 -- true
sets up perf_event_open system call with CPU == 0 and PID == -1.
According to the documentation, this applies to all processes on CPU 0
and not just the process named true.
Is this indended? I thought process true should be traced when running on
CPU 0. Shouldn't the perf_event_open() system call in called with
CPU set to 0 and PID set to PID of process true?
Tracing output:
# ./perf record -R -e cycles -vvv -C0 -- true
DEBUGINFOD_URLS=
nr_cblocks: 0
affinity: SYS
mmap flush: 1
comp level: 0
perf record opening and mmapping events
Opening: cycles
------------------------------------------------------------
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|ID|CPU|PERIOD|RAW
read_format ID|LOST
disabled 1
inherit 1
freq 1
sample_id_all 1
exclude_guest 1
------------------------------------------------------------
sys_perf_event_open: pid -1 cpu 0 group_fd -1 flags 0x8 = 5
....
When command invocation is
# ./perf record -R -e cycles -vvv -- true
the forked process named true (PID 13092) is traced on all CPUs:
[root@a35lp67 perf]# ./perf record -R -e cycles -vvv -- true
DEBUGINFOD_URLS=
nr_cblocks: 0
affinity: SYS
mmap flush: 1
comp level: 0
perf record opening and mmapping events
Opening: cycles
------------------------------------------------------------
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|CPU|PERIOD|RAW
read_format ID|LOST
disabled 1
inherit 1
mmap 1
comm 1
freq 1
enable_on_exec 1
task 1
sample_id_all 1
exclude_guest 1
mmap2 1
comm_exec 1
ksymbol 1
bpf_event 1
------------------------------------------------------------
sys_perf_event_open: pid 13092 cpu 0 group_fd -1 flags 0x8 = 5
sys_perf_event_open: pid 13092 cpu 1 group_fd -1 flags 0x8 = 6
sys_perf_event_open: pid 13092 cpu 2 group_fd -1 flags 0x8 = 7
sys_perf_event_open: pid 13092 cpu 3 group_fd -1 flags 0x8 = 9
sys_perf_event_open: pid 13092 cpu 4 group_fd -1 flags 0x8 = 10
sys_perf_event_open: pid 13092 cpu 5 group_fd -1 flags 0x8 = 11
sys_perf_event_open: pid 13092 cpu 6 group_fd -1 flags 0x8 = 12
sys_perf_event_open: pid 13092 cpu 7 group_fd -1 flags 0x8 = 13
mmap size 528384B
....
--
Thomas Richter, Dept 3303, IBM s390 Linux Development, Boeblingen, Germany
--
Vorsitzender des Aufsichtsrats: Gregor Pillen
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: Question to perf record command
2023-09-29 9:56 Question to perf record command Thomas Richter
@ 2023-09-30 6:32 ` Namhyung Kim
0 siblings, 0 replies; 2+ messages in thread
From: Namhyung Kim @ 2023-09-30 6:32 UTC (permalink / raw)
To: Thomas Richter; +Cc: linux-perf-use.
Hello,
On Fri, Sep 29, 2023 at 2:56 AM Thomas Richter <tmricht@linux.ibm.com> wrote:
>
> I have a question regarding command perf record.
>
> Command ./perf record -R -e cycles -vvv -C0 -- true
> sets up perf_event_open system call with CPU == 0 and PID == -1.
>
> According to the documentation, this applies to all processes on CPU 0
> and not just the process named true.
>
> Is this indended? I thought process true should be traced when running on
> CPU 0. Shouldn't the perf_event_open() system call in called with
> CPU set to 0 and PID set to PID of process true?
It's intended. When you specify CPU targets (-a or -C options),
it'd profile ALL processes on those CPUs. The command line
task just controls when it terminates the sampling. For example,
we often use sleep command to profile all processes for the
specified time.
$ perf record -a -- sleep 1
Thanks,
Namhyung
>
> Tracing output:
> # ./perf record -R -e cycles -vvv -C0 -- true
> DEBUGINFOD_URLS=
> nr_cblocks: 0
> affinity: SYS
> mmap flush: 1
> comp level: 0
> perf record opening and mmapping events
> Opening: cycles
> ------------------------------------------------------------
> 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|ID|CPU|PERIOD|RAW
> read_format ID|LOST
> disabled 1
> inherit 1
> freq 1
> sample_id_all 1
> exclude_guest 1
> ------------------------------------------------------------
> sys_perf_event_open: pid -1 cpu 0 group_fd -1 flags 0x8 = 5
> ....
>
>
> When command invocation is
> # ./perf record -R -e cycles -vvv -- true
>
> the forked process named true (PID 13092) is traced on all CPUs:
> [root@a35lp67 perf]# ./perf record -R -e cycles -vvv -- true
> DEBUGINFOD_URLS=
> nr_cblocks: 0
> affinity: SYS
> mmap flush: 1
> comp level: 0
> perf record opening and mmapping events
> Opening: cycles
> ------------------------------------------------------------
> 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|CPU|PERIOD|RAW
> read_format ID|LOST
> disabled 1
> inherit 1
> mmap 1
> comm 1
> freq 1
> enable_on_exec 1
> task 1
> sample_id_all 1
> exclude_guest 1
> mmap2 1
> comm_exec 1
> ksymbol 1
> bpf_event 1
> ------------------------------------------------------------
> sys_perf_event_open: pid 13092 cpu 0 group_fd -1 flags 0x8 = 5
> sys_perf_event_open: pid 13092 cpu 1 group_fd -1 flags 0x8 = 6
> sys_perf_event_open: pid 13092 cpu 2 group_fd -1 flags 0x8 = 7
> sys_perf_event_open: pid 13092 cpu 3 group_fd -1 flags 0x8 = 9
> sys_perf_event_open: pid 13092 cpu 4 group_fd -1 flags 0x8 = 10
> sys_perf_event_open: pid 13092 cpu 5 group_fd -1 flags 0x8 = 11
> sys_perf_event_open: pid 13092 cpu 6 group_fd -1 flags 0x8 = 12
> sys_perf_event_open: pid 13092 cpu 7 group_fd -1 flags 0x8 = 13
> mmap size 528384B
> ....
>
> --
> Thomas Richter, Dept 3303, IBM s390 Linux Development, Boeblingen, Germany
> --
> Vorsitzender des Aufsichtsrats: Gregor Pillen
> 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:[~2023-09-30 6:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-29 9:56 Question to perf record command Thomas Richter
2023-09-30 6:32 ` 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).