def process_sample(self, signal_frame, sample_time, main_thread_id):
if self.profile:
start = time.clock()
current_frames = sys._current_frames()
items = current_frames.items()
for thread_id, thread_frame in items:
if thread_id == main_thread_id:
thread_frame = signal_frame
stack = self.recover_stack(thread_frame)
if stack:
current_node = self.profile
for frame in reversed(stack):
current_node = current_node.find_or_add_child(str(frame))
current_node.increment(sample_time, 1)
thread_id, thread_frame, stack = None, None, None
items = None
current_frames = None
self.profile._overhead += (time.clock() - start)
评论列表
文章目录