Fix turning stats to zero by casting them to int before multiplying.
This commit is contained in:
+2
-2
@@ -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
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user