From d08f067f8f470b440b563293397116d6036c4d71 Mon Sep 17 00:00:00 2001 From: bd Date: Tue, 15 Jul 2025 13:13:22 -0600 Subject: More cleanup of leftover features --- aergia | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/aergia b/aergia index 2809d37..3f629ef 100755 --- a/aergia +++ b/aergia @@ -87,10 +87,7 @@ class Aergia(object): samples = defaultdict(lambda: 0) # number of times samples have been collected total_samples = 0 - - # the timestamp recorded last signal - last_signal_time = 0.0 - + # the (ideal) interval between samples signal_interval = 0.0 def __init__(self, signal_interval): @@ -98,8 +95,7 @@ class Aergia(object): @staticmethod def start(): - ''' - Turns on asyncio debug mode and sets up our signals. + '''Turns on asyncio debug mode and sets up our signals. Debug mode must be on by default to avoid losing samples. Debug mode is required to view the current coroutine being waited on @@ -108,12 +104,12 @@ class Aergia(object): ''' os.environ["PYTHONASYNCIODEBUG"] = "1" signal.signal(signal.SIGALRM, - Aergia.cpu_signal_handler) + Aergia.idle_signal_handler) signal.setitimer(signal.ITIMER_REAL, Aergia.signal_interval, Aergia.signal_interval) - Aergia.last_signal_time = Aergia.gettime() + @staticmethod def stop(): Aergia.disable_signals() Aergia.print_samples() @@ -143,12 +139,12 @@ class Aergia(object): signal.setitimer(signal.ITIMER_REAL, 0) @staticmethod - def cpu_signal_handler(sig, frame): + def idle_signal_handler(sig, frame): + '''Obtains and records which lines are currently being waited on.''' keys = Aergia.compute_frames_to_record() for key in keys: Aergia.samples[Aergia.frame_to_string(key)] += 1 Aergia.total_samples += 1 - Aergia.last_signal_time = Aergia.gettime() @staticmethod def compute_frames_to_record(): -- cgit v1.2.3