aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryn M. Reeves <bmr@redhat.com>2014-06-06 19:39:44 +0100
committerBryn M. Reeves <bmr@redhat.com>2014-06-06 19:39:44 +0100
commitfd68a0ca2e65e22bcfcfe886676693e7a339e1e1 (patch)
tree99710d099e85c2fe9d544b837b60e29bca29d81c
parentc2534c9ab618952e415a6af6c8812cbb17b8505c (diff)
downloadsos-fd68a0ca2e65e22bcfcfe886676693e7a339e1e1.tar.gz
Record duration of calls to external programs at debug level
The old profiling report was removed in favour of using external profilers like cProfile. This is useful for overall profiling and identifying code hotspots but is less helpful for drilling down to the collection of individual items. Since running programs is the dominant cost on typical hosts log the time taken to run each call and tag it with the binary name. This allows looking at the per-call and per-command cost across a run of sosreport. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r--sos/plugins/__init__.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py
index 7eff4e65..7758fa99 100644
--- a/sos/plugins/__init__.py
+++ b/sos/plugins/__init__.py
@@ -525,10 +525,12 @@ class Plugin(object):
"""Execute a command and save the output to a file for inclusion in the
report.
"""
+ start = time()
# pylint: disable-msg = W0612
result = self.get_command_output(exe, timeout=timeout, runat=runat)
if (result['status'] == 127):
return None
+ self.log_debug("collected output of '%s' in %s" % (exe.split()[0], time() - start))
if suggest_filename:
outfn = self.make_command_filename(suggest_filename)