def setup(self):
if self.agent.get_option('cpu_profiler_disabled'):
return
if runtime_info.OS_WIN:
self.agent.log('CPU profiler is not available on Windows.')
return
def _sample(signum, signal_frame):
if self.handler_active:
return
self.handler_active = True
with self.profile_lock:
try:
self.process_sample(signal_frame)
signal_frame = None
except Exception:
self.agent.exception()
self.handler_active = False
self.prev_signal_handler = signal.signal(signal.SIGPROF, _sample)
self.setup_done = True
评论列表
文章目录