Added debug_toolbar app to project.
[wolnelektury.git] / 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 (file)
index 0000000..d520191
--- /dev/null
@@ -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 ''