|
0
|
This recipe provides a very simple time profiling module which helps you to measure actual execution time for blocks of Python code without peppering your code with many time.time() statements.
For profiling actual code execution time, you have to often pepper your Python code with statements like the following: import time t1 = time.time() Execute my huge memory/CPU intensive chunk of code...elapsed = time.time() - t1 This recipe provides a wrapper over such time.time() calls and uses a dictionary to slot times using 'marks', so that profiling time becomes a breeze. This is a simple module. If you want to do some serious time profiling of your code averaged over multiple execution loops, use timeit.py .
Tags: shortcuts
|
Add a comment
Sign in to comment
Download
Copy to clipboard
