polishing minute display
This commit is contained in:
11
collect.py
11
collect.py
@@ -231,6 +231,8 @@ def collect_data(minutes, interval):
|
|||||||
# Create a Popen object with stdout redirected to the file
|
# Create a Popen object with stdout redirected to the file
|
||||||
process = subprocess.Popen(gstat_command, stdout=output_file)
|
process = subprocess.Popen(gstat_command, stdout=output_file)
|
||||||
|
|
||||||
|
x = 1
|
||||||
|
|
||||||
for _ in range(minutes * 60 // interval):
|
for _ in range(minutes * 60 // interval):
|
||||||
# Collect data using system commands
|
# Collect data using system commands
|
||||||
|
|
||||||
@@ -243,7 +245,14 @@ def collect_data(minutes, interval):
|
|||||||
|
|
||||||
# Print progress indicator
|
# Print progress indicator
|
||||||
elapsed_time = (datetime.now() - start_time).total_seconds() // interval
|
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)
|
time.sleep(interval)
|
||||||
|
|
||||||
# kill gstat if freebsd
|
# kill gstat if freebsd
|
||||||
|
|||||||
Reference in New Issue
Block a user