[diffoscope] 01/02: comparators/{haskell, ppu}: Excplicitly profile manual calls to subprocess.check_output

Chris Lamb chris at chris-lamb.co.uk
Fri Dec 23 12:46:55 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 4234d4cb8e3be133b3b841267e33acd9ec7c5310
Author: Chris Lamb <lamby at debian.org>
Date:   Fri Dec 23 11:44:51 2016 +0000

    comparators/{haskell,ppu}: Excplicitly profile manual calls to subprocess.check_output
    
    Signed-off-by: Chris Lamb <lamby at debian.org>
---
 diffoscope/comparators/haskell.py | 4 +++-
 diffoscope/comparators/ppu.py     | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/diffoscope/comparators/haskell.py b/diffoscope/comparators/haskell.py
index 0e4f9e6..7630941 100644
--- a/diffoscope/comparators/haskell.py
+++ b/diffoscope/comparators/haskell.py
@@ -23,6 +23,7 @@ import platform
 import subprocess
 
 from diffoscope import tool_required, logger
+from diffoscope.profiling import profile
 from diffoscope.difference import Difference
 from diffoscope.comparators.utils import Command
 from diffoscope.comparators.binary import File
@@ -50,7 +51,8 @@ class HiFile(File):
             return False
         if not hasattr(HiFile, 'hi_version'):
             try:
-                output = subprocess.check_output(['ghc', '--numeric-version'], shell=False)
+                with profile('command', 'ghc'):
+                    output = subprocess.check_output(['ghc', '--numeric-version'], shell=False)
                 major, minor, patch = map(int, output.decode('utf-8').strip().split('.'))
                 HiFile.hi_version = "%d%02d%d" % (major, minor, patch)
                 logger.debug('Found .hi version %s', HiFile.hi_version)
diff --git a/diffoscope/comparators/ppu.py b/diffoscope/comparators/ppu.py
index 84609bf..2577816 100644
--- a/diffoscope/comparators/ppu.py
+++ b/diffoscope/comparators/ppu.py
@@ -24,6 +24,7 @@ import re
 import subprocess
 
 from diffoscope import tool_required, logger
+from diffoscope.profiling import profile
 from diffoscope.difference import Difference
 from diffoscope.comparators.utils import Command
 from diffoscope.comparators.binary import File
@@ -66,7 +67,8 @@ class PpuFile(File):
             ppu_version = f.read(3).decode('ascii', errors='ignore')
         if not hasattr(PpuFile, 'ppu_version'):
             try:
-                subprocess.check_output(['ppudump', '-vh', file.path], shell=False, stderr=subprocess.STDOUT)
+                with profile('command', 'ppudump'):
+                    subprocess.check_output(['ppudump', '-vh', file.path], shell=False, stderr=subprocess.STDOUT)
                 PpuFile.ppu_version = ppu_version
             except subprocess.CalledProcessError as e:
                 error = e.output.decode('utf-8', errors='ignore')

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


More information about the diffoscope mailing list