Questions tagged [perf]

perf is Linux profiling tool for both Linux kernel and underlying hardware (hardware counters).

Filter by
Sorted by
Tagged with
0 votes
1 answer
29 views

perf top not working as expected

I'm completely confused about the output of perf top I'm running a C program called sac2, which burns an entire CPU. Specifically it iterates through a 100 billion byte array adding all the bytes as ...
user avatar
  • 1
0 votes
0 answers
19 views

How does perf manages the execution of a process before reporting its statistics?

Suppose I ran following perf command in the terminal to find number of page faults: perf stat -e page-faults ls I am not able to understand how perf executable (user space process) controls the ...
user avatar
0 votes
0 answers
54 views

How do I debug `perf`'s "Permission error mapping pages." when running `perf` on multiple processes in parallel?

perf sometimes gives me Permission error mapping pages. Consider increasing /proc/sys/kernel/perf_event_mlock_kb, or try again with a smaller value of -m/--mmap_pages. (current value: 4294967295,0) ...
user avatar
1 vote
1 answer
130 views

linux-tools-common when on a newer kernel version

I'm currently running kernel 5.16.15-051615-generic - I've landed on it while diagnosing and trying to fix an audio issue. Everything works great now so I'm reluctant to go back to 5.4.0 I'd like to ...
user avatar
2 votes
1 answer
31 views

How do I use perf trace record?

I can use perf trace as a low-overhead replacement for strace, e.g. to trace all Apache instances: perf trace -p $(pidof apache2 | tr ' ' ',') To run the trace only for up to 10 seconds: perf trace -...
user avatar
2 votes
1 answer
319 views

how to set capabilities (setcap) on perf

I'd like to use the perf utility. I was following instructions to set up a privileged group of users who are permitted to execute performance monitoring and observability without limits (as instructed ...
user avatar
0 votes
0 answers
67 views

perf mem record <command> does not work as non root user

As a non root user, perf mem record does not work even though I have set /proc/sys/kernel/perf_event_paranoid to -1 and set CAP_SYS_ADMIN on /usr/bin/perf getcap /usr/bin/perf /usr/bin/perf = ...
user avatar
  • 1
0 votes
0 answers
38 views

Diagnosing cause of a process using 100% CPU

I'm trying to diagnose a strange error occurring on a fairly stripped-down Celeron N2930 (quad core Atom) PC running a Qt Quick based Application on top of Debian 10 Linux 32-bit (think basically a ...
user avatar
  • 161
2 votes
0 answers
79 views

Error running python script

I am following this tutorial: How to analyze your system with perf and Python. While running the following perf script --gen-script python command I am getting an error. Python scripting not supported....
user avatar
1 vote
0 answers
19 views

linux perf: limiting to just some small periods of time

I'm writing a video game, and have used perf(1) and flame graphs to get some decent "whole program performance" information. However, I also want to investigate specific worst-case periods, ...
user avatar
  • 1,172
4 votes
0 answers
2k views

How to run linux perf without root

I want to benchmark an application of mine. Up to now I used gnu time, but perf yields much better stats. As a matter of principle I would like to go the route of a decicated perf user instead of ...
user avatar
  • 51
2 votes
1 answer
2k views

How does the linux perf tool get the miss rate of the l2 cache?

I want to use perf tool to get the miss rate of l2 cache. I know how to get L1, and LLC. perf stat -e L1-dcache-loads,L1-dcache-load-misses,L1-dcache-stores command perf stat -e LLC-loads,LLC-load-...
user avatar
1 vote
0 answers
225 views

How to take stack samples using `perf` based on wall-clock time

I am trying to use Linux's perf_events framework to investigate an issue with an application on one of our servers. Based on my reading about the perf tool, collecting stacks is relatively ...
user avatar
  • 111
1 vote
2 answers
1k views

Perf permission for users other than root

I don't know why user is not able to collect perf stat for a service (nginx process which has been started by sudo). As you can see the kernel and perf versions match. $ uname -r 4.19.125 $ which perf ...
user avatar
  • 1,015
0 votes
1 answer
103 views

Locating printf object/module

I would like to know which kernel module is called when printf is executed in my C code. How can I find that? Let's say, when I use ldd I can find which libraries are attached to my binary file. I am ...
user avatar
  • 1,015
1 vote
0 answers
527 views

Can't install Perf on Kali Linux

I tried different ways to install perf but they are all failed: root@kali:~/Desktop# perf /usr/bin/perf: line 13: exec: perf_5.3: not found E: linux-perf-5.3 is not installed. root@kali:~/Desktop# ...
user avatar
  • 111
1 vote
0 answers
115 views

Where does `perf script` timestamps come from?

The third column from perf script seems to be close but not quite the uptime, where is that timestamp coming from? Is there a way to access that timestamp other than accessing sampled events? $ perf ...
user avatar
0 votes
0 answers
354 views

High-frequency performance counter sampling using perf record/report

I want to retrieve performance counter counts at a high frequency (i.e. 100-200Hz) using the perf tool (similar in functionality to https://github.com/RRZE-HPC/likwid/wiki/likwid-perfctr#the-timeline-...
user avatar
1 vote
1 answer
55 views

How to get sleep time of a program

I am trying to collect some statistics for a script that I run on a daily bases. I would like to get the amount of time that is actually spent sleeping. Is there a way to just get the sum of all sleep ...
user avatar
  • 11
1 vote
0 answers
17 views

Which of two methodologies is the correct one getting perf stats on a multi-threaded process?

I'm investigating the performance of a multi-threaded database sever. There is a particular workload that runs in roughly 61 seconds on a particular machine. The pid of the database process was 79894 ...
user avatar
1 vote
0 answers
290 views

Perf tool, used for profiling, crashes on heavy load

When I am using "perf record -F 99 -g -p -- sleep 300" during average load, I am getting the perf.data file without any problem. But when the load is high, it is crashing. The only way to get an ok ...
user avatar
  • 19
2 votes
0 answers
112 views

How to trace script execution events

My goal: To receive events from the kernel when a file/script is opened for execution with the absolute path of the file (or maybe the working directory, to resolve the absolute path of the file). I ...
user avatar
0 votes
1 answer
790 views

What does `perf stat` option `--cpu` is actually showing?

I am trying to understand the --cpu option of perf-stat. In the man pages it says: Count only on the list of CPUs provided. Multiple CPUs can be provided as a comma-separated list with no space: ...
user avatar
  • 101
10 votes
1 answer
7k views

Security implications of changing “perf_event_paranoid”

I'd like to use the perf utility to gather measurements for my program. It runs on a shared cluster machine with Debian 9 where by default the /proc/sys/kernel/perf_event_paranoid is set to 3, ...
user avatar
5 votes
1 answer
5k views

How long time does a context switch take in Linux (ubuntu 18.04)

I'm interessted in getting the number of context switches a two processes in a KVM vm takes on a singel CPU over some time. Earlier i have used perf, is this best practice? And how much time is used ...
user avatar
  • 73
1 vote
0 answers
49 views

Determine average and maximum execution time of a task by using ftrace/perf

I've gathered some traces containing scheduling events ('sched:*') by using ftrace and perf record. By analyzing the results many of my questions could already be answered. However, I was wondering ...
user avatar
  • 121
3 votes
0 answers
648 views

Does `perf trace -p <PID>` trace all threads?

strace -f -p <PID> traces system calls in all threads of a multi-threaded process. (This also follows forks, there is an option -b execve that tries to address that). Does perf trace -p <...
user avatar
  • 44.5k
0 votes
1 answer
274 views

Is there a command to show tracepoints "live", which includes the PID?

I have tried looking at the documentation for perf script, perf trace, and trace-cmd, including the list of commands in "SEE ALSO". I can trace e.g. sched:sched_process_exec "live" using perf trace -...
user avatar
  • 44.5k
3 votes
0 answers
630 views

Perf Tool monitoring by PID

I'm using linux perf tool to monitor the performance of some processes. The documentation tells that you can flag it to collect profiles on per-thread, per-process and per-cpu basis. I get that the ...
user avatar
1 vote
1 answer
1k views

Why 'perf' needs to match the exact running Linux kernel version?

If you try to run a random perf binary that does not match your currently running Linux kernel, it says: $ perf WARNING: perf not found for kernel 4.13.0-45 Of course, if I get the perf for this ...
user avatar
  • 113
0 votes
0 answers
1k views

unresolved symbols sudo perf record/report

I am trying to use perf to profile a program that I have written on a work server. I have sudo privilege but should limit what I do with it. $ rm perf.data $ perf record ./catch-hedging ...
user avatar
3 votes
1 answer
1k views

Why does `perf stat` show 0 context switches?

I ran a shell pipeline under perf stat, using taskset 0x1 to pin the whole pipeline to a single CPU. I know taskset 0x1 had an effect, because it more than doubled the throughput of the pipeline. ...
user avatar
  • 44.5k
1 vote
1 answer
2k views

Why does `perf stat -a` show clock (Ghz) lower than my cpu is rated?

Why does perf stat -a show a clock speed three times lower than my CPU is rated for? I don't think power management is an issue, because I made sure the test ran for a whole second to allow the cpu ...
user avatar
  • 44.5k
1 vote
1 answer
1k views

Perf Error While Loading Shared Libraries

I was on CentOS 7.3 on x86_64 using perf compiled on the system itself from Kernel 4.13.7 source. It worked without any issue and was able to profile whichever application I wanted to. For some ...
user avatar
1 vote
0 answers
147 views

How could I add support for an event modifier in perf

I need to account power for the kernel space, but unfortunately the k modifier are not supported for the power/energy-cores/. I have an example of what I'm trying to do below. I'm reading the source ...
user avatar
1 vote
1 answer
2k views

How to show the report of Linux perf record -g without call graph data?

I collected a performance profile of an application with perf record -g. By default, perf report displays call chain data: 100.00% 0.00% htop htop [.] main | ...
user avatar
4 votes
1 answer
6k views

How do I generate the /sys/kernel/debug/tracing folder in kernel with yocto project?

I was tying to use perf on Renesas target and I configured the yocto "local.conf" as showed in this link. #avoid stripping binaries INHIBIT_PACKAGE_STRIP = "1" #add the debug information ...
user avatar
  • 53
0 votes
0 answers
518 views

Run "perf top" on another user's process

We have a CentOS 7 system with two user accounts: Sally, to run production jobs. Tanya, for monitoring and interactive jobs. Sally runs a specific job that Tanya needs to monitor using perf top. ...
user avatar
4 votes
1 answer
1k views

Building .deb package for Linux perf?

There is a convenient Linux kernel makefile target "make deb-pkg" to build kernel, modules, headers as .deb. Then I can install/remove via dpkg command. However, for perf compilation, there is only ...
user avatar
  • 249
9 votes
3 answers
26k views

perf interrupt took too long but perf not being installed

I just now checked my dmesg because my server starts to crash now and then. There I read the following line: perf interrupt took too long (2528 > 2500), lowering kernel.perf_event_max_sample_rate ...
user avatar
  • 225
2 votes
0 answers
555 views

Recording a process with perf using PID doesn't work

When I do performance profiling using perf, normally this works: perf record -g -F99 $BINARY_NAME Upon completion, the command says: [ perf record: Captured and wrote 0.006 MB output.data (37 ...
user avatar
1 vote
0 answers
159 views

Perf tool usage on A7 and A15 cores (Big.Little) on XU3/XU4 boards

Many people have posted on odroid forum and elsewhere on how to enable "perf" on XU3 and XU4 boards. After months of trials, one final solution was presented in http://forum.odroid.com/viewtopic.php?f=...
user avatar
3 votes
0 answers
101 views

perf-like assembly reading tool

perf has a very friendly terminal interface for performance analysis. It has a very helpful feature that the branch target is annotated with beautiful arrows, showing where this branch is going to (if ...
user avatar
  • 215
6 votes
0 answers
1k views

perf cycles not supported

I am trying to use perf for profiling in a Linux virtual machine. However, I am receiving the following output: [vagrant@localhost ~]$ perf stat -d ls / bin boot dev etc home lib lib64 lost+...
user avatar
  • 327
1 vote
1 answer
3k views

Understanding the CPU time spent by process in user/kernel space

I have an application which normally reports (time command reports): real 1.59 user 1.42 sys 4.73 But when I load a shared library and run it then the time goes up quite high (time command reports): ...
user avatar
  • 143
5 votes
1 answer
6k views

perf fails to work on really large process

I use perf quite often to profile my applications. Recently I got a few new machine with ~750G RAM each. I am trying to profile a process that uses about 400G of ram on one of them. This works fine on ...
user avatar
  • 151
4 votes
1 answer
5k views

How to resolve <not counted> problem in perf tool?

perf stat -d ./sample.out Output is: Performance counter stats for './sample.out': 0.586266 task-clock (msec) # 0.007 CPUs utilized 2 context-...
user avatar
  • 63
1 vote
0 answers
241 views

perf_events over ssh (osx -> linux) freezing and unresponsive

I'm using linux perf_events and sometimes am having trouble with the perf report (which is a terminal application) view freezing up. I'm interacting with a remote linux server which is running perf ...
user avatar
  • 273
2 votes
3 answers
6k views

Why can't I find hardware cache event in my perf list?

I have a problem in using linux perf on a newly bought laptop: there is no available hardware cache effect in my perf list!!! Well, this is really all important information that I wish to sample!! ...
user avatar
5 votes
0 answers
931 views

How to interpret perf -e cache-misses:pp?

I find the behavior of perf top -e cache-misses:pp -p <my_pid> quite confusing. I own an Intel i5-3230M, running kernel 4.4.5 64 bit. If I just run that commmand, I get basically no samples ...
user avatar