linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Counting page fault per PID
@ 2021-11-12  9:30 Thomas Richter
  2021-11-12  9:57 ` Jiri Olsa
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Richter @ 2021-11-12  9:30 UTC (permalink / raw)
  To: linux-perf-use.

Hi,

I have a question regarding perf tool usage. I would like to know
which process caused how many page faults?

I ran these commands:

 # perf stat -e faults -a -- sleep 4 &
 # find / -ls > /dev/null 2>&1 &
 # dd if=/dev/zero of=/dev/null bs=1M count=10K &
Performance counter stats for 'system wide':

               606      faults

       3.994941053 seconds time elapsed

This tells me 606 page faults in total, but how to find out how many
page faults did hit my two processes dd and find?

When I do this
 # perf report -e faults -a -- sleep 4 &
 # find / -ls > /dev/null 2>&1 &
 36033
 # dd if=/dev/zero of=/dev/null bs=1M count=10K &
 36034
 sleep 4

Now I have a perf.data file and can check for PERF_RECORD_SAMPLE from
pid 36033 and 36034? Is the number of sample entries for pid 36034 identical
with the page faults?

PERF_RECORD_FORK(36034:36034):(36031:36031)
PERF_RECORD_COMM: dd:36034/36034
...
PERF_RECORD_SAMPLE(IP, 0x2): 36034/36034: 0x3ffbaa12d00 period: 1 addr: 0
 ... thread: dd:36034
PERF_RECORD_SAMPLE(IP, 0x2): 36034/36034: 0x3ffba978cc4 period: 1 addr: 0
 ... thread: dd:36034
PERF_RECORD_SAMPLE(IP, 0x2): 36034/36034: 0x3ffba978d02 period: 1 addr: 0
 ... thread: dd:36034
PERF_RECORD_SAMPLE(IP, 0x2): 36034/36034: 0x3ffba9768d2 period: 2 addr: 0
 ... thread: dd:36034
PERF_RECORD_SAMPLE(IP, 0x2): 36034/36034: 0x3ffba961550 period: 9 addr: 0
 ... thread: dd:36034
PERF_RECORD_EXIT(36034:36034):(36031:36031)

Since I detect 5 sample entries from dd command, I can attribute 5 page
faults to the running dd command?

Thanks a lot.

-- 
Thomas Richter, Dept 3303, IBM s390 Linux Development, Boeblingen, Germany
--
Vorsitzender des Aufsichtsrats: Gregor Pillen
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-12  9:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-12  9:30 Counting page fault per PID Thomas Richter
2021-11-12  9:57 ` Jiri Olsa

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).