52 if not os.path.exists(self.timingCache): |
52 if not os.path.exists(self.timingCache): |
53 return |
53 return |
54 |
54 |
55 try: |
55 try: |
56 cache = open(self.timingCache, 'rb') |
56 cache = open(self.timingCache, 'rb') |
57 timings = marshal.load(cache) |
57 timings = marshal.load(cache) # secok |
58 if isinstance(timings, dict): |
58 if isinstance(timings, dict): |
59 self.timings = timings |
59 self.timings = timings |
60 except Exception: |
60 except Exception: # secok |
61 pass |
61 pass |
62 finally: |
62 finally: |
63 cache.close() |
63 cache.close() |
64 |
64 |
65 def save(self): |
65 def save(self): |
68 """ |
68 """ |
69 # dump the raw timing data |
69 # dump the raw timing data |
70 try: |
70 try: |
71 cache = open(self.timingCache, 'wb') |
71 cache = open(self.timingCache, 'wb') |
72 marshal.dump(self.timings, cache) |
72 marshal.dump(self.timings, cache) |
73 except Exception: |
73 except Exception: # secok |
74 pass |
74 pass |
75 finally: |
75 finally: |
76 cache.close() |
76 cache.close() |
77 |
77 |
78 # dump the profile data |
78 # dump the profile data |
152 """ |
152 """ |
153 if self.cur and frame.f_back is not self.cur[-2]: |
153 if self.cur and frame.f_back is not self.cur[-2]: |
154 rpt, rit, ret, rfn, rframe, rcur = self.cur |
154 rpt, rit, ret, rfn, rframe, rcur = self.cur |
155 if not isinstance(rframe, profile.Profile.fake_frame): |
155 if not isinstance(rframe, profile.Profile.fake_frame): |
156 assert rframe.f_back is frame.f_back, ("Bad call", rfn, |
156 assert rframe.f_back is frame.f_back, ("Bad call", rfn, |
|
157 # secok |
157 rframe, rframe.f_back, |
158 rframe, rframe.f_back, |
158 frame, frame.f_back) |
159 frame, frame.f_back) |
159 self.trace_dispatch_return(rframe, 0) |
160 self.trace_dispatch_return(rframe, 0) |
160 assert (self.cur is None or |
161 assert (self.cur is None or # secok |
161 frame.f_back is self.cur[-2]), ("Bad call", |
162 frame.f_back is self.cur[-2]), ("Bad call", |
162 self.cur[-3]) |
163 self.cur[-3]) |
163 fcode = frame.f_code |
164 fcode = frame.f_code |
164 fn = (self.fix_frame_filename(frame), |
165 fn = (self.fix_frame_filename(frame), |
165 fcode.co_firstlineno, fcode.co_name) |
166 fcode.co_firstlineno, fcode.co_name) |