Revamped how log file is emptied
This commit is contained in:
parent
c8f9095067
commit
d9295f4cf2
|
@ -464,22 +464,23 @@ def countdown(s):
|
||||||
|
|
||||||
print("\t\t\"auto-cpufreq\" is about to refresh ", end = "")
|
print("\t\t\"auto-cpufreq\" is about to refresh ", end = "")
|
||||||
|
|
||||||
|
# empty log file if size is larger then 10mb
|
||||||
|
if auto_cpufreq_stats_file is not None:
|
||||||
|
log_size = os.path.getsize(auto_cpufreq_stats_path)
|
||||||
|
if log_size >= 1e+7:
|
||||||
|
auto_cpufreq_stats_file.seek(0)
|
||||||
|
auto_cpufreq_stats_file.truncate(0)
|
||||||
|
|
||||||
|
# auto-refresh counter
|
||||||
for remaining in range(s, -1, -1):
|
for remaining in range(s, -1, -1):
|
||||||
|
|
||||||
if remaining <= 3 and remaining >= 0:
|
if remaining <= 3 and remaining >= 0:
|
||||||
print(".", end="", flush=True)
|
print(".", end="", flush=True)
|
||||||
time.sleep(1)
|
time.sleep(0.75)
|
||||||
|
|
||||||
if auto_cpufreq_stats_file is not None:
|
now = datetime.now()
|
||||||
auto_cpufreq_stats_file.seek(0)
|
current_time = now.strftime("%B %d (%A) - %H:%M:%S")
|
||||||
auto_cpufreq_stats_file.truncate(0)
|
print("\n\t\tExecuted on:", current_time)
|
||||||
|
|
||||||
now = datetime.now()
|
|
||||||
current_time = now.strftime("%B %d (%A) - %H:%M:%S")
|
|
||||||
print("\n\t\tExecuted on:", current_time)
|
|
||||||
|
|
||||||
else:
|
|
||||||
run("clear")
|
|
||||||
|
|
||||||
|
|
||||||
# get cpu usage + system load for (last minute)
|
# get cpu usage + system load for (last minute)
|
||||||
|
|
Loading…
Reference in New Issue