This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import OrderedDict | |
from time import time | |
class Timer(object): | |
""" | |
Measure the time taken by some Python code, incl. its subtasks: | |
>>> with Timer('parent') as timer: | |
... sleep(0.5) | |
... with timer.child('child') as child: |
NewerOlder