Questions tagged [perf]

Perf is a profiler tool for Linux 2.6+ based systems.

Perf is a profiling tool for Linux 2.6+ based systems that uses the perf_events kernel interface to provide a command-line interface to underlying hardware, software and kernel performance counters. It abstracts away differences in performance counters implemented across different CPU architectures, allowing consistency across different hardware.

See also the perf wiki.

1032 questions
25
votes
2 answers

Use perf inside a docker container without --privileged

I am trying to use the perf tool inside a Docker container to record a given command. kernel.perf_event_paranoid is set to 1, but the container behaves just as if it were 2, when I don't put the --privileged flag. I could use --privileged, but the…
Fred Tingaud
  • 740
  • 1
  • 6
  • 11
21
votes
1 answer

What is lockstep sampling?

I have seen this term in several posts about profiling applications but I don't understand what it actually means and how it affects profiling results. I have seen it here for dtrace: The rate is also increased to 199 Hertz, as capturing kernel…
ks1322
  • 33,961
  • 14
  • 109
  • 164
21
votes
1 answer

How does linux's perf utility understand stack traces?

Linux's perf utility is famously used by Brendan Gregg to generate flamegraphs for c/c++, jvm code, nodejs code, etc. Does the Linux kernel natively understand stack traces? Where can I read more about how a tool is able to introspect into stack…
Shahbaz
  • 10,395
  • 21
  • 54
  • 83
21
votes
1 answer

How to use Intel Westmere 1GB pages on Linux?

Edit: I updated my question with the details of my benchmark For benchmarking purposes, I am trying to setup 1GB pages in a Linux 3.13 system running on top of two Intel Xeon 56xx ("Westmere") processors. For that I modified my boot parameters to…
Manuel Selva
  • 18,554
  • 22
  • 89
  • 134
21
votes
3 answers

Profiling sleep times with perf

I was looking for a way to find out where my program spends time. I read the perf tutorial and tried to profile sleep times as it is described there. I wrote the simplest possible program to profile: #include int main() { sleep(10); …
Pavel Davydov
  • 3,379
  • 3
  • 28
  • 41
21
votes
1 answer

Open perf.data in Kcachegrind

I read somewhere that it is possible to convert perf.data (output from linux perf record profiling tool) to a format that kcachegrind can parse/plot, however I didn't find an application capable of doing this convertion and neither does kcachegrind…
JohnTortugo
  • 6,356
  • 7
  • 36
  • 69
20
votes
1 answer

How does Linux perf calculate the cache-references and cache-misses events

I am confused by the perf events cache-misses and L1-icache-load-misses,L1-dcache-load-misses,LLC-load-misses. As when I tried to perf stat all of them, the answer doesn't seem consistent: %$: sudo perf stat -B -e…
LouisYe
  • 303
  • 2
  • 6
19
votes
2 answers

How to use linux `perf` tool to generate "Off-CPU" profile

Brendan D. Gregg (author of DTrace book) has interesting variant of profiling: the "Off-CPU" profiling (and Off-CPU Flame Graph; slides 2013, p112-137) to see, where the thread or application were blocked (was not executed by CPU, but waiting for…
osgx
  • 90,338
  • 53
  • 357
  • 513
19
votes
2 answers

Analyzing cause of performance regression with different kernel version

I have come across a strange performance regression from Linux kernel 3.11 to 3.12 on x86_64 systems. Running Mark Stock's Radiance benchmark on Fedora 20, 3.12 is noticeably slower. Nothing else is changed - identical binary, identical glibc - I…
Chris
  • 4,133
  • 30
  • 38
19
votes
2 answers

Is there a way to set kptr_restrict to 0?

I am currently having trouble running linux perf, mostly because /proc/sys/kernel/kptr_restrict is currently set to 1. However, if I try to /proc/sys/kernel/kptr_restrict by echoing 0 to it as follows... echo 0 > /proc/sys/kernel/kptr_restrict I…
jab
  • 5,673
  • 9
  • 53
  • 84
18
votes
3 answers

perf.data file has no samples

I am using perf 3.0.4 on ubuntu 11.10. Its record command works well and displays on terminal 256 samples collected. But when I make use of perf report , it gives me the following error: perf.data file has no samples I searched a lot for the…
Xara
  • 8,748
  • 16
  • 52
  • 82
17
votes
1 answer

What do the perf record choices of LBR vs DWARF vs fp do?

When I use the perf record on my code, I find three choices for the --call-graph option: lbr (last branch record), dwarf and fp. What is difference between these?
The flash
  • 171
  • 1
  • 3
17
votes
2 answers

Thread Utilization profiling on linux

Linux perf-tools are great for finding hotspots in CPU cycles and optimizing those hotspots. But once some parts are parallelized it becomes difficult to spot the sequential parts since they take up significant wall time but not necessarily many CPU…
the8472
  • 40,999
  • 5
  • 70
  • 122
17
votes
2 answers

perf enable demangling of callgraph

How do I enable C++ demangling for the perf callgraph? It seems to demangle symbols when I go into annotate mode, but not in the main callgraph. Sample code (using Google Benchmark): #include #include static…
helloworld922
  • 10,801
  • 5
  • 48
  • 85
17
votes
2 answers

Can't add perf probe for C++ methods

I'm trying to add a perf probe for a C++ method in my library, but I keep getting the following: $ perf probe --exec=/path/to/file --add='my::Own::Method' Semantic error :There is non-digit char in line number. I've listed the available functions…
Trevor Norris
  • 20,499
  • 4
  • 26
  • 28
1
2
3
68 69