Created
April 9, 2025 15:19
-
-
Save recalde/705158587e88db24d279bb788110de75 to your computer and use it in GitHub Desktop.
perf-test.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
echo "[Startup] Measuring host compute power..." | |
# CPU Test | |
START=$(date +%s%N) | |
for i in {1..100000}; do echo "$i" | sha256sum > /dev/null; done | |
END=$(date +%s%N) | |
CPU_MS=$(( (END - START) / 1000000 )) | |
echo "[Startup] CPU hash test took ${CPU_MS} ms" | |
# Memory Test | |
START=$(date +%s%N) | |
dd if=/dev/zero of=/dev/null bs=1M count=500 2>/dev/null | |
END=$(date +%s%N) | |
MEM_MS=$(( (END - START) / 1000000 )) | |
echo "[Startup] Memory copy test took ${MEM_MS} ms" | |
# System Info | |
echo "[Startup] CPU: $(grep 'model name' /proc/cpuinfo | uniq)" | |
echo "[Startup] CPU MHz (min core): $(grep 'cpu MHz' /proc/cpuinfo | awk '{print $4}' | sort -n | head -1)" | |
echo "[Startup] MemTotal: $(grep MemTotal /proc/meminfo)" | |
# Continue app startup | |
exec "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment