block_reporter.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:stackimpact-python 作者: stackimpact 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号