From c4821be0e427fd2ee0759d77e5ebb0e178563ca4 Mon Sep 17 00:00:00 2001 From: bd Date: Tue, 15 Jul 2025 13:08:57 -0600 Subject: Do not calculate total samples --- aergia | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'aergia') diff --git a/aergia b/aergia index 6b78c7f..2809d37 100755 --- a/aergia +++ b/aergia @@ -102,7 +102,7 @@ class Aergia(object): 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 future being waited on + Debug mode is required to view the current coroutine being waited on in `Aergia.get_idle_task_frames'. The TimerHandler object otherwise does not keep track of a _source_traceback. ''' @@ -115,7 +115,6 @@ class Aergia(object): Aergia.last_signal_time = Aergia.gettime() def stop(): - os.environ["PYTHONASYNCIODEBUG"] = "0" Aergia.disable_signals() Aergia.print_samples() @@ -135,7 +134,7 @@ class Aergia(object): '''Pretty-print a single sample.''' sig_intv = Aergia.signal_interval value = Aergia.samples[key] - print(f"{key} :\t{value / Aergia.total_samples:.3f}%" + print(f"{key} :\t\t{value * 100 / Aergia.total_samples:.3f}%" f"\t({value:.3f} ->" f" {value*sig_intv:.6f} seconds)") @@ -145,15 +144,10 @@ class Aergia(object): @staticmethod def cpu_signal_handler(sig, frame): - sig_intv = Aergia.signal_interval - elapsed_since_last_signal = Aergia.gettime() - \ - Aergia.last_signal_time keys = Aergia.compute_frames_to_record() - for key in keys: Aergia.samples[Aergia.frame_to_string(key)] += 1 - Aergia.total_samples += elapsed_since_last_signal / \ - sig_intv + Aergia.total_samples += 1 Aergia.last_signal_time = Aergia.gettime() @staticmethod -- cgit v1.2.3