zoom.profiler module

performance profiler

class zoom.profiler.SystemTimer(start_time=None)

Bases: object

time system events

>>> timer = SystemTimer()
>>> timer.add('got here')
>>> timer.add('got there')
>>> import time
>>> timer.time('slow step', time.sleep, 0.1)
>>> report = timer.report()
>>> len(report.splitlines())
7
>>> len(timer.data)
5
add(comment)

add a measure to the system timer log

data
labels
report()

print a report of the timed events

time(name, function, *args, **kwargs)
zoom.profiler.get_profile_data(profiler)

Capture the stdout printout of the code profiler

>>> class Profiler(object):
...     def print_stats(self):
...         print('the stats!')
>>> get_profile_data(Profiler())
'the stats!\n'
zoom.profiler.handler(request, handler, *rest)

Handle profiled requests

zoom.profiler.profiled(request, handler, *rest)
zoom.profiler.round(value)

Round a decimal value

>>> round(Decimal(1.23422))
Decimal('1.234')