6 sudo perf top -p `pidof ceph-osd`
8 To capture some data with call graphs::
10 sudo perf record -p `pidof ceph-osd` -F 99 --call-graph dwarf -- sleep 60
12 To view by caller (where you can see what each top function calls)::
14 sudo perf report --call-graph caller
16 To view by callee (where you can see who calls each top function)::
18 sudo perf report --call-graph callee
20 :note: If the caller/callee views look the same you may be
21 suffering from a kernel bug; upgrade to 4.8 or later.
26 Ceph use `RelWithDebInfo` as its default `CMAKE_BUILD_TYPE`. Hence `-O2 -g` is
27 used to compile the tree in this case. And the `-O2` optimization level
28 enables `-fomit-frame-pointer` by default. But this prevents stack profilers
29 from accessing the complete stack information. So one can disable this option
30 when launching `cmake` ::
32 cmake -DCMAKE_CXX_FLAGS="-fno-omit-frame-pointer"
34 or when building the tree::
36 make CMAKE_CXX_FLAGS="-fno-omit-frame-pointer"
42 First, get things set up::
45 git clone https://github.com/brendangregg/FlameGraph
47 Run ceph, then record some perf data::
49 sudo perf record -p `pidof ceph-osd` -F 99 --call-graph dwarf -- sleep 60
51 Then generate the flamegraph::
53 sudo perf script | ~/src/FlameGraph/stackcollapse-perf.pl > /tmp/folded
54 ~/src/FlameGraph/flamegraph.pl /tmp/folded > /tmp/perf.svg