1 2 3 4 5 6 7 8 9 10 11 | # By Ed and Rudy Menendez
import time
class Timer(object):
def __init__(self):
self.bot = self.last_time = time.time()
print u'Starting timer at %s' % self.last_time
def tick(self, msg='Timer'):
x = time.time()
print '%s: Since inception %.3f, since last call %.3f' % (msg, x-self.bot, x - self.last_time)
self.last_time = x
|
More like this
- Add URL Segments to Templates by epicserve 4 years, 8 months ago
- Color SQL logging middleware by moe 5 years, 4 months ago
- Better Static Image Serving With Fallback by menendez 3 years, 3 months ago
- SnippySnip by youell 4 years, 11 months ago
- FormWizard inside view with proper context handling and site templating support, without having to use urls.py by sleepycal 3 years, 6 months ago
Comments