mirror of
https://github.com/internetarchive/warcprox.git
synced 2025-01-18 13:22:09 +01:00
run warc writer thread with profiling enabled, dump results when shutting down
This commit is contained in:
parent
e0fe06c891
commit
6476262f11
@ -16,6 +16,7 @@ from datetime import datetime
|
|||||||
import hanzo.httptools
|
import hanzo.httptools
|
||||||
from hanzo import warctools
|
from hanzo import warctools
|
||||||
import warcprox
|
import warcprox
|
||||||
|
import cProfile
|
||||||
|
|
||||||
class WarcWriterThread(threading.Thread):
|
class WarcWriterThread(threading.Thread):
|
||||||
logger = logging.getLogger("warcprox.warcproxwriter.WarcWriterThread")
|
logger = logging.getLogger("warcprox.warcproxwriter.WarcWriterThread")
|
||||||
@ -35,6 +36,9 @@ class WarcWriterThread(threading.Thread):
|
|||||||
self.idle = None
|
self.idle = None
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
cProfile.runctx('self._run()', globals(), locals(), sort='cumulative')
|
||||||
|
|
||||||
|
def _run(self):
|
||||||
try:
|
try:
|
||||||
self.setName('WarcWriterThread(tid={})'.format(warcprox.gettid()))
|
self.setName('WarcWriterThread(tid={})'.format(warcprox.gettid()))
|
||||||
while True:
|
while True:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user