Skip to content

Commit

Permalink
Fixed display error of server capacity by performing rounding as last…
Browse files Browse the repository at this point in the history
… step.
  • Loading branch information
matlorr committed Jan 10, 2025
1 parent 52898d9 commit 451dc26
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ server/.lake
**/.DS_Store
logs/
relay/prev_cpu_metric
test.ecosystem.config.cjs
4 changes: 2 additions & 2 deletions client/src/components/landing_page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ function LandingPage() {
</p>
</Trans>
<p>
{ usageMem >= 0 && <> {t("RAM")}: <strong>{usageMem} %</strong>{t(" used")}.<br/></> }
{ usageCPU >= 0 && <> {t("CPU")}: <strong>{usageCPU} %</strong>{t(" used")}. </> }
{ usageMem >= 0 && <> {t("RAM")}: <strong>{usageMem.toFixed(2)} %</strong>{t(" used")}.<br/></> }
{ usageCPU >= 0 && <> {t("CPU")}: <strong>{usageCPU.toFixed(2)} %</strong>{t(" used")}. </> }
</p>
</div>
</section>
Expand Down
4 changes: 2 additions & 2 deletions relay/stats.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
# Load python interpreter
python=/usr/bin/python3
# Load python script
cpu_usage=$L4G_DIR/lean4game/relay/cpu_usage.py
cpu_usage=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}')

printf "CPU, MEM\n%.2f, %.2f\n" $cpu $mem
printf "CPU, MEM\n%f, %f\n" $cpu $mem

0 comments on commit 451dc26

Please sign in to comment.