X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/85b57aa2d25552d82260ce40fd9b1063dd7c3dd5..bb68c8efe90a6f818c2c26f36ef0e02c91ed6158:/apps/debug_toolbar/panels/timer.py diff --git a/apps/debug_toolbar/panels/timer.py b/apps/debug_toolbar/panels/timer.py new file mode 100644 index 000000000..d52019163 --- /dev/null +++ b/apps/debug_toolbar/panels/timer.py @@ -0,0 +1,21 @@ +import time +from debug_toolbar.panels import DebugPanel + +class TimerDebugPanel(DebugPanel): + """ + Panel that displays the time a response took. + """ + name = 'Timer' + + def __init__(self, request): + super(TimerDebugPanel, self).__init__(request) + self._start_time = time.time() + + def title(self): + return 'Time: %0.2fms' % ((time.time() - self._start_time) * 1000) + + def url(self): + return '' + + def content(self): + return ''