fix mistakes in warc write thread profile aggregation

This commit is contained in:
Noah Levitt 2017-11-14 17:14:21 -08:00
parent 5c2c21de07
commit fdfc84cea0
2 changed files with 3 additions and 6 deletions

View File

@ -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()

View File

@ -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()