[diffoscope] 02/03: WIP: Also profile archive foo.

Chris Lamb chris at chris-lamb.co.uk
Mon Jan 9 17:31:23 CET 2017


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

lamby pushed a commit to branch lamby/profiling
in repository diffoscope.

commit a17bdbb8d2100c371fecc97fc036488c678449d5
Author: Chris Lamb <lamby at debian.org>
Date:   Thu Dec 22 22:59:40 2016 +0000

    WIP: Also profile archive foo.
---
 diffoscope/comparators/utils.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/diffoscope/comparators/utils.py b/diffoscope/comparators/utils.py
index e114de8..1a4b9ca 100644
--- a/diffoscope/comparators/utils.py
+++ b/diffoscope/comparators/utils.py
@@ -32,6 +32,7 @@ import diffoscope.comparators
 from diffoscope import logger, tool_required, get_temporary_directory
 from diffoscope.config import Config
 from diffoscope.progress import Progress
+from diffoscope.profiling import profile
 from diffoscope.comparators.binary import File, NonExistingFile
 
 
@@ -256,7 +257,8 @@ class ArchiveMember(File):
             logger.debug('unpacking %s', self._name)
             assert self._temp_dir is None
             self._temp_dir = get_temporary_directory()
-            self._path = self.container.extract(self._name, self._temp_dir.name)
+            with profile('container_extract', self.container):
+                self._path = self.container.extract(self._name, self._temp_dir.name)
         return self._path
 
     def cleanup(self):
@@ -286,10 +288,12 @@ class Archive(Container, metaclass=abc.ABCMeta):
 
     def __init__(self, *args, **kwargs):
         super().__init__(*args, **kwargs)
-        self._archive = self.open_archive()
+        with profile('open_archive', self):
+            self._archive = self.open_archive()
 
     def __del__(self):
-        self.close_archive()
+        with profile('close_archive', self):
+            self.close_archive()
 
     @property
     def archive(self):

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


More information about the diffoscope mailing list