Change in vdsm[master]: profiling: Add whole application profile

nsoffer at redhat.com nsoffer at redhat.com
Wed Mar 26 12:34:37 UTC 2014


Nir Soffer has uploaded a new change for review.

Change subject: profiling: Add whole application profile
......................................................................

profiling: Add whole application 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 whole
application profile. A new profile_enable configuration is added to
enable profiling.

Change-Id: I523f52c981f7bb34f3168d3117f00ed5eb6962f8
Relates-to: https://bugzilla.redhat.com/1074097
Signed-off-by: Nir Soffer <nsoffer at redhat.com>
---
M lib/vdsm/config.py.in
M vdsm/vdsm
2 files changed, 14 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/13/26113/1

diff --git a/lib/vdsm/config.py.in b/lib/vdsm/config.py.in
index fb597a8..e208b2a 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 652797c..f89ca1d 100755
--- a/vdsm/vdsm
+++ b/vdsm/vdsm
@@ -65,6 +65,11 @@
     signal.signal(signal.SIGUSR1, sigusr1Handler)
     zombiereaper.registerSignalHandler()
 
+    if config.getboolean('vars', 'profile_enable'):
+        logging.debug("Starting profiling")
+        import yappi
+        yappi.start()
+
     libvirtconnection.start_event_loop()
 
     if config.getboolean('irs', 'irs_enable'):
@@ -79,6 +84,12 @@
     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('/tmp/vdsmd.prof', 'pstat')
     finally:
         cif.prepareForShutdown()
 


-- 
To view, visit http://gerrit.ovirt.org/26113
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I523f52c981f7bb34f3168d3117f00ed5eb6962f8
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer at redhat.com>


More information about the vdsm-patches mailing list