summaryrefslogtreecommitdiffstats
path: root/doc/rados/troubleshooting/cpu-profiling.rst
blob: b7fdd1d41b31c096ef7286354ca100acd037598e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
===============
 CPU Profiling
===============

If you built Ceph from source and compiled Ceph for use with `oprofile`_
you can profile Ceph's CPU usage. See `Installing Oprofile`_ for details.


Initializing oprofile
=====================

``oprofile`` must be initalized the first time it is used. Locate the
``vmlinux`` image that corresponds to the kernel you are running:

.. prompt:: bash $

   ls /boot
   sudo opcontrol --init
   sudo opcontrol --setup --vmlinux={path-to-image} --separate=library --callgraph=6


Starting oprofile
=================

Run the following command to start ``oprofile``: 

.. prompt:: bash $

   opcontrol --start


Stopping oprofile
=================

Run the following command to stop ``oprofile``: 

.. prompt:: bash $

   opcontrol --stop
    
    
Retrieving oprofile Results
===========================

Run the following command to retrieve the top ``cmon`` results: 

.. prompt:: bash $

   opreport -gal ./cmon | less    
    

Run the following command to retrieve the top ``cmon`` results, with call
graphs attached: 

.. prompt:: bash $

   opreport -cal ./cmon | less    
    
.. important:: After you have reviewed the results, reset ``oprofile`` before
   running it again. The act of resetting ``oprofile`` removes data from the
   session directory.


Resetting oprofile
==================

Run the following command to reset ``oprofile``:  

.. prompt:: bash $

   sudo opcontrol --reset   
   
.. important:: Reset ``oprofile`` after analyzing data. This ensures that 
   results from prior tests do not get mixed in with the results of the current
   test. 

.. _oprofile: http://oprofile.sourceforge.net/about/
.. _Installing Oprofile: ../../../dev/cpu-profiler