# Steps to reproduce (in terms of terminal commands) $ gcc test.c -o test -O0 -g3 -fno-omit-frame-pointer $ sudo sysctl kernel.sched_schedstats=1 kernel.sched_schedstats = 1 $ sudo perf record -e sched:sched_stat_sleep,sched:sched_switch,sched:sched_process_exit -g ./test [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.033 MB perf.data (34 samples) ] $ sudo perf script | grep -E "main|\bg\b|\bf\b" ## Expected Last command should've printed lines that accord to frames inside `main`, `g`, `f` functions ## Actual No output from the last command
Omg, sorry, forgot to put the code in the description #include <unistd.h> void f() { for (size_t i = 0; i < 5; ++i) { sleep(1); } } void g() { f(); } int main() { g(); }
I just remember that there's an alternative way to get stack traces: by using `--callgraph=X`. When that X is dwarf, I get the correct output.