diff --git a/client/src/components/landing_page.tsx b/client/src/components/landing_page.tsx index af16964..b69f50c 100644 --- a/client/src/components/landing_page.tsx +++ b/client/src/components/landing_page.tsx @@ -134,8 +134,8 @@ function LandingPage() { } if (line2) { let values = line2.split(',') - setUsageCPU(100 * parseInt(values[0])); - setUsageMem(100 * parseInt(values[1])); + setUsageCPU(100 * parseFloat(values[0])); + setUsageMem(100 * parseFloat(values[1])); } }).catch(err => { console.info('server stats unavailable') diff --git a/relay/cpu_usage.py b/relay/cpu_usage.py index e90d694..40599b4 100644 --- a/relay/cpu_usage.py +++ b/relay/cpu_usage.py @@ -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) diff --git a/relay/stats.sh b/relay/stats.sh index f300c7f..8996046 100755 --- a/relay/stats.sh +++ b/relay/stats.sh @@ -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