diff options
| author | bd <bdunahu@operationnull.com> | 2025-06-10 16:05:01 -0400 |
|---|---|---|
| committer | bd <bdunahu@operationnull.com> | 2025-06-10 16:05:01 -0400 |
| commit | f7c41ef8bb7993d09aa54cd9b3773a55a662ffb2 (patch) | |
| tree | 30c9440f1cb5df7f0e02a74f4d69f8276e0ed128 /mini-scalene.py | |
| parent | 669534099639907a0813b6c66b29e9d1ca95229e (diff) | |
Move disabling signals to own method
Diffstat (limited to 'mini-scalene.py')
| -rw-r--r-- | mini-scalene.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/mini-scalene.py b/mini-scalene.py index 4d3909b..5d8f6b2 100644 --- a/mini-scalene.py +++ b/mini-scalene.py @@ -58,9 +58,7 @@ class mini_scalene: @staticmethod def exit_handler(): '''Turn off our profiling signals and pretty-print profiling information.''' - signal.signal(signal.ITIMER_PROF, signal.SIG_IGN) - signal.signal(signal.SIGVTALRM, signal.SIG_IGN) - signal.setitimer(signal.ITIMER_PROF, 0) + mini_scalene.disable_signals() # If we've collected any samples, dump them. print("CPU usage:") if mini_scalene.total_cpu_samples > 0: @@ -79,6 +77,12 @@ class mini_scalene: print("(did not run long enough to profile)") @staticmethod + def disable_signals(): + signal.signal(signal.ITIMER_PROF, signal.SIG_IGN) + signal.signal(signal.SIGVTALRM, signal.SIG_IGN) + signal.setitimer(signal.ITIMER_PROF, 0) + + @staticmethod def cpu_signal_handler(sig, frame): keys = mini_scalene.compute_frames_to_record(frame) for key in keys: @@ -145,11 +149,9 @@ class mini_scalene: # FIXME Assume GuixSD. Makes filtering easy if '/gnu/store' in filename: return False - if 'mini-scalene.py' in filename: + if filename[0] == '<': return False - if '<frozen importlib._bootstrap>' in filename: - return False - if '<frozen importlib._bootstrap_external>' in filename: + if 'mini-scalene.py' in filename: return False return True |
