From: Thomas Richter <tmricht@linux.ibm.com>
To: "linux-perf-use." <linux-perf-users@vger.kernel.org>
Subject: Question to perf record command
Date: Fri, 29 Sep 2023 11:56:30 +0200 [thread overview]
Message-ID: <3a212e80-b00b-f44b-3d2c-6e221d8cc1ac@linux.ibm.com> (raw)
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
next reply other threads:[~2023-09-29 9:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-29 9:56 Thomas Richter [this message]
2023-09-30 6:32 ` Question to perf record command Namhyung Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3a212e80-b00b-f44b-3d2c-6e221d8cc1ac@linux.ibm.com \
--to=tmricht@linux.ibm.com \
--cc=linux-perf-users@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).