Fix turning stats to zero by casting them to int before multiplying.

This commit is contained in:
matlorr
2024-12-28 11:13:11 +01:00
parent 5f30572741
commit 52898d93e7
3 changed files with 5 additions and 5 deletions
+2 -2
View File
@@ -39,5 +39,5 @@ if __name__ == "__main__":
d_total = curr_total - prev_total
d_idle = curr_idle - prev_idle
cpu_usage = ((d_total - d_idle)/d_total) * 100
print(round(cpu_usage, 20))
cpu_usage = ((d_total - d_idle)/d_total)
print(cpu_usage)
+1 -1
View File
@@ -7,6 +7,6 @@ cpu_usage=$L4G_DIR/lean4game/relay/cpu_usage.py
# Execute python script
cpu=$($python $cpu_usage)
# Calculate memory usage by computing used_memory/total_memory
mem=$(free | sed '2q;d' | awk '{print $3/$2*100}')
mem=$(free | sed '2q;d' | awk '{print $3/$2}')
printf "CPU, MEM\n%.2f, %.2f\n" $cpu $mem