Create breakpoints to time code at

 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

  1. Faster pagination / model object seeking (10x faster infact :o) for larger datasets (500k +) by sleepycal 1 year, 2 months ago
  2. Request time logging middleware by mpasternacki 2 years, 2 months ago
  3. DateTimeField with microseconds by tobias 2 years, 11 months ago
  4. Django load global fixtures test helper by vaz 6 months, 2 weeks ago
  5. grouper tag by visgean 6 months ago

Comments

(Forgotten your password?)