----- Original Message -----
From: "Nir Soffer" <nsoffer(a)redhat.com>
To: "vdsm-devel" <vdsm-devel(a)lists.fedorahosted.org>
Cc: "Gordon Watson" <gwatson(a)redhat.com>
Sent: Wednesday, March 26, 2014 3:13:16 PM
Subject: [vdsm] Addming whole application profile
Hi all,
Please review this patch:
http://gerrit.ovirt.org/26113
The short term goal of this patch is to allow debugging of this nasty bug:
https://bugzilla.redhat.com/1074097
The long term goal is having an easy way to profile vdsm in the field and
during development, initiative started by Francesco.
Here are some docs to help you get started with the profiler.
Installing yappi
----------------
To try this patch, you must install yappi:
1. wget
http://yappi.googlecode.com/files/yappi-0.82.tar.gz
2. tar xzf yappi-0.82.tar.gz
3. cd yappi-0.82
4. sudo python setup.py install
If you want to build an rpm, the quickest way is:
1. Fix MANIFEST.in so it looks like this:
include *.h
include ez_setup.py
2. Build rpm
$ python setup.py bdist_rpm
You rpm is located in dist.
I built rpm packages for fedora and rhel (looking for a place to share them)
Using the profiler
------------------
Enbale the profiler in vdsm.conf:
[vars]
profile_enable = False
If the profiling is enabled, profiling stats early in vdsm startup,
and stopped when vdsm receives a termination signal. The profile is saved
to /tmp/vdsmd.prof.
Profile is stored now at /var/run/vdsm/vdsmd.prof to protect
from symlink attacks.
IMPORTANT: After you are done, disable profiling.
To explore profile, open it in the pstat commnad shell:
$ python -m pstats /tmp/vdsmd.prof
To view top 30 expensive functions:
% sort time
% stats 30
To view top 30 functions including time spent in called functions:
% sort cumulative
% stats 30
To view callers (who is calling foo() 300,000 times?)
% callers 30
Viewing profile in KCachegrind
------------------------------
Current version of the patch adds profile_format option. To view the
profile using KCachegrind tool, set the format to callgrind:
[vars]
profile_enable = true
profile_format = callgrind
And open the profile with kcachegrind.
http://kcachegrind.sourceforge.net/html/Home.html
Nir