mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Only print timing info in debug mode
This commit is contained in:
parent
4c8e216f5f
commit
6420da0d6e
@ -6,6 +6,7 @@ from __future__ import (unicode_literals, division, absolute_import,
|
|||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
|
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||||
|
|
||||||
|
import time
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
from future_builtins import map
|
from future_builtins import map
|
||||||
from operator import itemgetter
|
from operator import itemgetter
|
||||||
@ -24,6 +25,7 @@ from PyQt5.Qt import (
|
|||||||
QFontDatabase, QComboBox)
|
QFontDatabase, QComboBox)
|
||||||
|
|
||||||
from calibre import human_readable, fit_image
|
from calibre import human_readable, fit_image
|
||||||
|
from calibre.constants import DEBUG
|
||||||
from calibre.ebooks.oeb.polish.report import gather_data, CSSEntry, CSSFileMatch, MatchLocation
|
from calibre.ebooks.oeb.polish.report import gather_data, CSSEntry, CSSFileMatch, MatchLocation
|
||||||
from calibre.gui2 import error_dialog, question_dialog, choose_save_file
|
from calibre.gui2 import error_dialog, question_dialog, choose_save_file
|
||||||
from calibre.gui2.tweak_book import current_container, tprefs, dictionaries
|
from calibre.gui2.tweak_book import current_container, tprefs, dictionaries
|
||||||
@ -944,7 +946,11 @@ class ReportsWidget(QWidget):
|
|||||||
def __call__(self, data):
|
def __call__(self, data):
|
||||||
jump.clear()
|
jump.clear()
|
||||||
for i in xrange(self.stack.count()):
|
for i in xrange(self.stack.count()):
|
||||||
|
st = time.time()
|
||||||
self.stack.widget(i)(data)
|
self.stack.widget(i)(data)
|
||||||
|
if DEBUG:
|
||||||
|
category = self.reports.item(i).data(Qt.DisplayRole)
|
||||||
|
print ('Widget time for %12s: %.2fs seconds' % (category, time.time() - st))
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
save_state('splitter-state', bytearray(self.splitter.saveState()))
|
save_state('splitter-state', bytearray(self.splitter.saveState()))
|
||||||
@ -1042,11 +1048,9 @@ class Reports(Dialog):
|
|||||||
'Failed to gather data for the report. Click "Show details" for more'
|
'Failed to gather data for the report. Click "Show details" for more'
|
||||||
' information.'), det_msg=data, show=True)
|
' information.'), det_msg=data, show=True)
|
||||||
data, timing = data
|
data, timing = data
|
||||||
try:
|
if DEBUG:
|
||||||
for x, t in sorted(timing.iteritems(), key=itemgetter(1)):
|
for x, t in sorted(timing.iteritems(), key=itemgetter(1)):
|
||||||
print ('Time for %6s data: %.3f seconds' % (x, t))
|
print ('Time for %6s data: %.3f seconds' % (x, t))
|
||||||
except Exception:
|
|
||||||
pass
|
|
||||||
self.reports(data)
|
self.reports(data)
|
||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user