Nir Soffer has uploaded a new change for review.
Change subject: profiling: Add an application wide profile
......................................................................
profiling: Add an application wide profile
The built in Python profilers are good for single thread profile but
given the excessive multi-threaded nature of vdsm, they are useless for
understing where we spend our time.
This patch uses yappi <
http://code.google.com/p/yappi> to create an
application wide profile. A new profile_enable configuration was added
to enable profiling.
Change-Id: I523f52c981f7bb34f3168d3117f00ed5eb6962f8
Relates-to:
https://bugzilla.redhat.com/1074097
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
M lib/vdsm/config.py.in
M vdsm/vdsm
2 files changed, 15 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/58/26158/1
diff --git a/lib/vdsm/config.py.in b/lib/vdsm/config.py.in
index a229998..db01568 100644
--- a/lib/vdsm/config.py.in
+++ b/lib/vdsm/config.py.in
@@ -29,6 +29,9 @@
('core_dump_enable', 'true',
'Enable core dump.'),
+ ('profile_enable', 'false',
+ 'Enable whole process profiling (requires yappi profiler).'),
+
('host_mem_reserve', '256',
'Reserves memory for the host to prevent VMs from using all the '
'physical pages. The values are in Mbytes.'),
diff --git a/vdsm/vdsm b/vdsm/vdsm
index aa1bb87..59223ed 100755
--- a/vdsm/vdsm
+++ b/vdsm/vdsm
@@ -20,6 +20,7 @@
import syslog
from logging import config as lconfig
+from vdsm.config import config
from vdsm import constants
import zombieReaper
import dsaversion
@@ -55,12 +56,23 @@
signal.signal(signal.SIGUSR1, sigusr1Handler)
zombieReaper.registerSignalHandler()
+ if config.getboolean('vars', 'profile_enable'):
+ logging.debug("Starting profiling")
+ import yappi
+ yappi.start()
+
from clientIF import clientIF # must import after config is read
cif = clientIF.getInstance(log)
cif.start()
try:
while running[0]:
signal.pause()
+
+ if config.getboolean('vars', 'profile_enable'):
+ logging.debug("Stopping profiling")
+ yappi.stop()
+ stats = yappi.get_func_stats()
+ stats.save(constants.P_VDSM_RUN + 'vdsmd.prof', 'pstat')
finally:
cif.prepareForShutdown()
--
To view, visit
http://gerrit.ovirt.org/26158
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I523f52c981f7bb34f3168d3117f00ed5eb6962f8
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.3
Gerrit-Owner: Nir Soffer <nsoffer(a)redhat.com>