perf-events not showing StackTraces on debian 8 jessie

125 views Asked by At

I am trying to profile a simple C program with perf-events on debian 8 jessie. I can see symbols but I am unable to get stacktraces. The same procedure generates good stacktraces on ubuntu 16.04.

I have installed linux-image-amd64-dbg and libc6-dbg. I have confirmed that kernel config parameters include CONFIG_KALLSYMS=y

I have compiled the program with gcc -g3 -O0 hello.c to enable debug symbols.

I start profiling with the following command. sudo perf record -g ./a.out

I generate a flame graph Flame Graph with the following command

sudo perf script | ~/code/FlameGraph/stackcollapse-perf.pl | \
~/code/FlameGraph/flamegraph.pl > perf-kernel.svg

This is the listing for hello.c which I am trying to profile

#include <stdio.h>
#include <unistd.h>


void do2() {
    FILE* f = fopen("/dev/zero", "r");
    int fd = fileno(f);
    char buf[100];
    while(1) {
        read(fd, buf, sizeof(buf)/sizeof(buf[0]));
    }
}

int main(void)
{
    do2();
    return 0;
}

This is the flame graph with debian jessie

This is the flame graph with ubuntu

Why are stack traces missing in debian jessie?

Thanks Sharath

1

There are 1 answers

0
sha On BEST ANSWER

Managed to find the issue. I had to enable CONFIG_FRAME_POINTER=y and recompile the kernel as per Brendan Gregg's perf site

It is unfortunate that the kernel shipping with Debian 8 does not have this enabled, which breaks perf