Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / doc / rados / troubleshooting / cpu-profiling.rst
1 ===============
2  CPU Profiling
3 ===============
4
5 If you built Ceph from source and compiled Ceph for use with `oprofile`_
6 you can profile Ceph's CPU usage. See `Installing Oprofile`_ for details.
7
8
9 Initializing oprofile
10 =====================
11
12 The first time you use ``oprofile`` you need to initialize it. Locate the
13 ``vmlinux`` image corresponding to the kernel you are now running. :: 
14
15         ls /boot
16         sudo opcontrol --init
17         sudo opcontrol --setup --vmlinux={path-to-image} --separate=library --callgraph=6
18
19
20 Starting oprofile
21 =================
22
23 To start ``oprofile`` execute the following command:: 
24
25         opcontrol --start
26
27 Once you start ``oprofile``, you may run some tests with Ceph. 
28
29
30 Stopping oprofile
31 =================
32
33 To stop ``oprofile`` execute the following command:: 
34
35         opcontrol --stop
36         
37         
38 Retrieving oprofile Results
39 ===========================
40
41 To retrieve the top ``cmon`` results, execute the following command:: 
42
43         opreport -gal ./cmon | less     
44         
45
46 To retrieve the top ``cmon`` results with call graphs attached, execute the
47 following command:: 
48
49         opreport -cal ./cmon | less     
50         
51 .. important:: After reviewing results, you should reset ``oprofile`` before
52    running it again. Resetting ``oprofile`` removes data from the session 
53    directory.
54
55
56 Resetting oprofile
57 ==================
58
59 To reset ``oprofile``, execute the following command:: 
60
61         sudo opcontrol --reset   
62    
63 .. important:: You should reset ``oprofile`` after analyzing data so that 
64    you do not commingle results from different tests.
65
66 .. _oprofile: http://oprofile.sourceforge.net/about/
67 .. _Installing Oprofile: ../../../dev/cpu-profiler