From 2ff24b41dc51a2212d0d4c070315acce701c6fe2 Mon Sep 17 00:00:00 2001 From: Marc Mance Date: Mon, 29 Jul 2024 14:13:07 -0400 Subject: [PATCH] polishing minute display --- collect.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/collect.py b/collect.py index b664c4c..79189cd 100644 --- a/collect.py +++ b/collect.py @@ -231,6 +231,8 @@ def collect_data(minutes, interval): # Create a Popen object with stdout redirected to the file process = subprocess.Popen(gstat_command, stdout=output_file) + x = 1 + for _ in range(minutes * 60 // interval): # Collect data using system commands @@ -243,7 +245,14 @@ def collect_data(minutes, interval): # Print progress indicator elapsed_time = (datetime.now() - start_time).total_seconds() // interval - print(f"Minute {elapsed_time + 1}", flush=True) + + if x == 1: + print("Minute:", end="", flush=True) + + x = 0 + + print(f" {int(elapsed_time + 1)}", end="", flush=True) + time.sleep(interval) # kill gstat if freebsd