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.

802 questions
12
votes
3 answers

Is there any method to run perf under WSL?

When I wanted to run perf under WSL, I met the follow question: WARNING: perf not found for kernel 4.4.0-18362 You may need to install the following packages for this specific…
yodahaji
  • 397
  • 2
  • 10
12
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
  • 123
  • 1
  • 5
12
votes
1 answer

Perf shows mangled function names

I wanted to give perf a shot to profile some programs after I saw this talk from CppCon 2015. I downloaded the same Google benchmark library that the guy uses in the talk, compiled my program with the appropriate switches, linked it to it, then used…
notadam
  • 2,494
  • 2
  • 16
  • 30
11
votes
2 answers

why perf has such high context-switches?

I was trying to understand the linux perf, and found some really confusing behavior: I wrote a simple multi-threading example with one thread pinned to each core; each thread runs computation locally and does not communicate with each other (see…
daoliker
  • 1,606
  • 10
  • 22
11
votes
1 answer

Perf startup overhead: Why does a simple static executable which performs MOV + SYS_exit have so many stalled cycles (and instructions)?

I'm trying to understand how to measure performance and decided to write the very simple program: section .text global _start _start: mov rax, 60 syscall And I ran the program with perf stat ./bin The thing I was surprised by is the…
St.Antario
  • 23,179
  • 26
  • 96
  • 243
11
votes
1 answer

What is the meaning of perf script output?

I used the perf script command to view the result of the perf.data file, but I don't really understand what each column means. For example, if I have the following result: perf 3198 [000] 13156.201238: bus-cycles: ffffffff81086e90…
AN00
  • 233
  • 3
  • 13
11
votes
1 answer

Getting user-space stack information from perf

I'm currently trying to track down some phantom I/O in a PostgreSQL build I'm testing. It's a multi-process server and it isn't simple to associate disk I/O back to a particular back-end and query. I thought Linux's perf tool would be ideal for…
Craig Ringer
  • 259,831
  • 56
  • 584
  • 684
11
votes
1 answer

Perf annotate, display only source code

I'm using Perf to perform some profiling experiments. However, I would like to know results for a specific code region and for this case seeing the results (percentages) for each line of source code (C/C++ in this case) would ease the task. perf…
JohnTortugo
  • 5,435
  • 7
  • 33
  • 63
10
votes
2 answers

is it possible to run linux perf tool inside docker container

I tried giving the below command from container and found the below issue, may be because of "-moby" kernel version. Can't we get a docker image without word "-moby" coming in linux kernel version. I tried installing linux perf tool on VM having…
Rupesh
  • 101
  • 1
  • 4
10
votes
1 answer

Perf overcounting simple CPU-bound loop: mysterious kernel work?

I've been using Linux perf for some time to do application profiling. Usually the profiled application is fairly complex, so one tends to simply take the reported counter values at face value, as long as there isn't any gross discrepancy with what…
BeeOnRope
  • 51,419
  • 13
  • 149
  • 309
10
votes
3 answers

Measure page faults from a c program

I am comparing a few system calls where I read/write from/to memory. Is there any API defined to measure page faults (pages in/out) in C ? I found this library libperfstat.a but it is for AIX, I couldn't find anything for linux. Edit: I am aware of…
brokenfoot
  • 9,630
  • 9
  • 46
  • 71
9
votes
1 answer

how to interpret perf iTLB-loads,iTLB-load-misses

I have a test case to observe perf iTLB-loads,iTLB-load-misses by perf stat -e dTLB-loads,dTLB-load-misses,iTLB-loads,iTLB-load-misses -p 22479 and get the output : Performance counter stats for process id '22479': 1,262,817 dTLB-loads…
barfatchen
  • 1,426
  • 18
  • 41
9
votes
2 answers

Two TLB-miss per mmap/access/munmap

for (int i = 0; i < 100000; ++i) { int *page = mmap(NULL, PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); page[0] = 0; munmap(page, PAGE_SIZE); } I expect to get ~100000…
9
votes
2 answers

How do you get debugging symbols working in linux perf tool inside Docker containers?

I am using Docker containers based on the "ubuntu" tag and cannot get linux perf tool to display debugging symbols. Here is what I'm doing to demonstrate the problem. First I start a container, here with an interactive shell. $ docker run -t -i…
Nathan Whitehead
  • 1,814
  • 1
  • 16
  • 18
9
votes
0 answers

debugging info for vsyscall and vdso

I'm using perf tool to profile a kernel module on centos 6.5 (kernel version: 2.6.32-431.el6.x86_64). I've installed the kernel debug info packages separately. While I am able to see the list of [kernel.kallsyms] functions, the symbols related to…
soofyaan
  • 269
  • 2
  • 11
1 2
3
53 54