]> git.proxmox.com Git - ceph.git/blob - ceph/doc/dev/perf.rst
import ceph quincy 17.2.6
[ceph.git] / ceph / doc / dev / perf.rst
1 Using perf
2 ==========
3
4 Top::
5
6 sudo perf top -p `pidof ceph-osd`
7
8 To capture some data with call graphs::
9
10 sudo perf record -p `pidof ceph-osd` -F 99 --call-graph dwarf -- sleep 60
11
12 To view by caller (where you can see what each top function calls)::
13
14 sudo perf report --call-graph caller
15
16 To view by callee (where you can see who calls each top function)::
17
18 sudo perf report --call-graph callee
19
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.
22
23 Common Issues
24 -------------
25
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` ::
31
32 cmake -DCMAKE_CXX_FLAGS="-fno-omit-frame-pointer"
33
34 or when building the tree::
35
36 make CMAKE_CXX_FLAGS="-fno-omit-frame-pointer"
37
38
39 Flamegraphs
40 -----------
41
42 First, get things set up::
43
44 cd ~/src
45 git clone https://github.com/brendangregg/FlameGraph
46
47 Run ceph, then record some perf data::
48
49 sudo perf record -p `pidof ceph-osd` -F 99 --call-graph dwarf -- sleep 60
50
51 Then generate the flamegraph::
52
53 sudo perf script | ~/src/FlameGraph/stackcollapse-perf.pl > /tmp/folded
54 ~/src/FlameGraph/flamegraph.pl /tmp/folded > /tmp/perf.svg
55 firefox /tmp/perf.svg