[diffoscope] 04/05: Profile external commands that use "make_feeder_from_command".

Chris Lamb chris at chris-lamb.co.uk
Fri Dec 23 12:46:37 CET 2016


This is an automated email from the git hooks/post-receive script.

lamby pushed a commit to branch master
in repository diffoscope.

commit 0e547f5ec5db5d16cc55cf7b1757a7bd3a586697
Author: Chris Lamb <lamby at debian.org>
Date:   Fri Dec 23 11:43:22 2016 +0000

    Profile external commands that use "make_feeder_from_command".
    
    Signed-off-by: Chris Lamb <lamby at debian.org>
---
 diffoscope/difference.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/diffoscope/difference.py b/diffoscope/difference.py
index 5f4dab8..2634b55 100644
--- a/diffoscope/difference.py
+++ b/diffoscope/difference.py
@@ -32,6 +32,7 @@ from multiprocessing.dummy import Queue
 from diffoscope import logger, tool_required
 from diffoscope.exc import RequiredToolNotFound
 from diffoscope.config import Config
+from diffoscope.profiling import profile
 
 
 class DiffParser(object):
@@ -254,10 +255,11 @@ def make_feeder_from_text_reader(in_file, filter=lambda text_buf: text_buf):
 
 def make_feeder_from_command(command):
     def feeder(out_file):
-        end_nl = make_feeder_from_raw_reader(command.stdout, command.filter)(out_file)
-        if command.poll() is None:
-            command.terminate()
-        returncode = command.wait()
+        with profile('command', command.cmdline()[0]):
+            end_nl = make_feeder_from_raw_reader(command.stdout, command.filter)(out_file)
+            if command.poll() is None:
+                command.terminate()
+            returncode = command.wait()
         if returncode not in (0, -signal.SIGTERM):
             raise subprocess.CalledProcessError(returncode, command.cmdline(), output=command.stderr.getvalue())
         return end_nl

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git


More information about the diffoscope mailing list