From fdfc84cea02716a03afb8463e759d45ac6eb2fab Mon Sep 17 00:00:00 2001 From: Noah Levitt Date: Tue, 14 Nov 2017 17:14:21 -0800 Subject: [PATCH] fix mistakes in warc write thread profile aggregation --- warcprox/controller.py | 5 ++--- warcprox/writerthread.py | 4 +--- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/warcprox/controller.py b/warcprox/controller.py index fbf9d8a..11291c4 100644 --- a/warcprox/controller.py +++ b/warcprox/controller.py @@ -283,12 +283,11 @@ class WarcproxController(object): 'aggregate performance profile of %s proxy threads:\n%s', len(files), buf.getvalue()) - # warc writer threads files = [] for wwt in self.warc_writer_threads: - file = os.path.join(tmpdir, '%s.dat' % th_id) - profiler.dump_stats(file) + file = os.path.join(tmpdir, '%s.dat' % wwt.ident) + wwt.profiler.dump_stats(file) files.append(file) buf = io.StringIO() diff --git a/warcprox/writerthread.py b/warcprox/writerthread.py index 8138eec..3f42fc1 100644 --- a/warcprox/writerthread.py +++ b/warcprox/writerthread.py @@ -56,12 +56,10 @@ class WarcWriterThread(threading.Thread): self.idle = None self.method_filter = set(method.upper() for method in self.options.method_filter or []) + def run(self): if self.options.profile: import cProfile self.profiler = cProfile.Profile() - - def run(self): - if self.options.profile: self.profiler.enable() self._run() self.profiler.disable()