10 import marshal |
10 import marshal |
11 import profile |
11 import profile |
12 import atexit |
12 import atexit |
13 import pickle |
13 import pickle |
14 |
14 |
|
15 |
15 class PyProfile(profile.Profile): |
16 class PyProfile(profile.Profile): |
16 """ |
17 """ |
17 Class extending the standard Python profiler with additional methods. |
18 Class extending the standard Python profiler with additional methods. |
18 |
19 |
19 This class extends the standard Python profiler by the functionality to |
20 This class extends the standard Python profiler by the functionality to |
20 save the collected timing data in a timing cache, to restore these data |
21 save the collected timing data in a timing cache, to restore these data |
21 on subsequent calls, to store a profile dump to a standard filename and |
22 on subsequent calls, to store a profile dump to a standard filename and |
22 to erase these caches. |
23 to erase these caches. |
23 """ |
24 """ |
24 def __init__(self, basename, timer = None, bias = None): |
25 def __init__(self, basename, timer=None, bias=None): |
25 """ |
26 """ |
26 Constructor |
27 Constructor |
27 |
28 |
28 @param basename name of the script to be profiled (string) |
29 @param basename name of the script to be profiled (string) |
29 @param timer function defining the timing calculation |
30 @param timer function defining the timing calculation |