Drops the optional RUN_PTS group, the pts-core phase, and every Phoronix reference from the scripts and docs. The suite is now just PassMark, the bundled llama.cpp, the app workloads, and the quick tools.
128 lines
4.7 KiB
Shell
Executable file
128 lines
4.7 KiB
Shell
Executable file
#!/usr/bin/env bash
|
|
#
|
|
# basic-benchmark / capture-specs.sh
|
|
# Capture a machine spec sheet for whatever host this is run on. Portable across
|
|
# Fedora (and most Linux) systems — no assumptions about hardware or user.
|
|
#
|
|
# ./capture-specs.sh # writes specs.txt and specs-detailed.txt
|
|
# ./capture-specs.sh before # writes specs-<tag>.txt / specs-detailed-<tag>.txt
|
|
#
|
|
# Run this on the machine being benchmarked, right before its benchmark pass.
|
|
|
|
set -u
|
|
|
|
TAG="${1:-}"
|
|
suffix=""
|
|
[ -n "$TAG" ] && suffix="-$TAG"
|
|
|
|
DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
OUT_SUMMARY="$DIR/specs$suffix.txt"
|
|
OUT_DETAIL="$DIR/specs-detailed$suffix.txt"
|
|
|
|
have() { command -v "$1" >/dev/null 2>&1; }
|
|
line() { printf '%s\n' "$*"; }
|
|
|
|
cpu_model() {
|
|
local m
|
|
m="$(sed -n 's/^model name[[:space:]]*: *//p' /proc/cpuinfo 2>/dev/null | head -1)"
|
|
[ -z "$m" ] && m="$(lscpu 2>/dev/null | sed -n 's/^Model name: *//p' | head -1)"
|
|
printf '%s' "${m:-unknown}"
|
|
}
|
|
mem_gib() { awk '/MemTotal/{printf "%.1f", $2/1048576}' /proc/meminfo; }
|
|
vram_gib() {
|
|
local m=0 v
|
|
for f in /sys/class/drm/card*/device/mem_info_vram_total; do
|
|
[ -r "$f" ] || continue
|
|
v="$(cat "$f" 2>/dev/null)"; [ -n "$v" ] && [ "$v" -gt "$m" ] 2>/dev/null && m="$v"
|
|
done
|
|
[ "$m" -gt 0 ] && awk -v m="$m" 'BEGIN{printf "%.1f", m/1073741824}' || printf 'n/a'
|
|
}
|
|
gpus() {
|
|
if have lspci; then
|
|
lspci -nn 2>/dev/null | grep -Ei 'vga|3d|display' | sed 's/^/ /'
|
|
else
|
|
line ' (lspci unavailable)'
|
|
fi
|
|
}
|
|
disks() {
|
|
if have lsblk; then
|
|
lsblk -d -o NAME,SIZE,ROTA,TRAN,MODEL 2>/dev/null | sed 's/^/ /'
|
|
else
|
|
line ' (lsblk unavailable)'
|
|
fi
|
|
}
|
|
tool_versions() {
|
|
for c in 7z openssl fio stress-ng sysbench sensors turbostat cpupower \
|
|
glmark2 vkmark glxinfo vulkaninfo python3 \
|
|
libreoffice inkscape gegl gimp; do
|
|
have "$c" && printf ' %-20s %s\n' "$c" "$("$c" --version 2>&1 | head -1)"
|
|
done
|
|
local pt="$DIR/tools/pt/PerformanceTest/PerformanceTest_Linux_x86-64"
|
|
[ -x "$pt" ] && printf ' %-20s %s\n' "PassMark" "$(sha256sum "$pt" | cut -c1-16)"
|
|
local lb="$DIR/tools/llama/bin/llama-bench"
|
|
[ -x "$lb" ] && printf ' %-20s %s\n' "llama-bench" "$(cd "$DIR/tools/llama/bin" && LD_LIBRARY_PATH="$PWD" ./llama-bench --version 2>&1 | head -1)"
|
|
}
|
|
|
|
{
|
|
line "basic-benchmark — spec sheet"
|
|
line "host: $(hostname) user: $(id -un) captured $(date -Is)"
|
|
[ -n "$TAG" ] && line "tag: $TAG"
|
|
} > "$OUT_SUMMARY"
|
|
|
|
{
|
|
line " ,---."
|
|
line " / . \\ $(id -un)@$(hostname) — benchmark baseline"
|
|
line " | (o) | -----------------------------------------------"
|
|
printf ' \\ %-3s / OS: %s\n' " " "$( . /etc/os-release 2>/dev/null; printf '%s' "${PRETTY_NAME:-unknown Linux}" )"
|
|
printf ' `---%s Kernel: %s\n' " " "$(uname -r)"
|
|
line " CPU: $(cpu_model)"
|
|
line " Memory: $(mem_gib) GiB"
|
|
line " GPU VRAM: $(vram_gib) GiB"
|
|
line " Fedora: $(rpm -E %fedora 2>/dev/null || echo n/a) Packages: $(rpm -qa 2>/dev/null | wc -l)"
|
|
if have systemctl && systemctl is-active graphical.target >/dev/null 2>&1; then
|
|
line " Session: graphical"
|
|
else
|
|
line " Session: headless"
|
|
fi
|
|
} > "$OUT_SUMMARY"
|
|
|
|
{
|
|
line "############################################################"
|
|
line "# basic-benchmark — machine spec (captured)"
|
|
line "# host: $(hostname) user: $(id -un) $(date -Is)"
|
|
line "############################################################"
|
|
line ""
|
|
line " OS"
|
|
line " Distro: $( . /etc/os-release 2>/dev/null; printf '%s' "${PRETTY_NAME:-unknown}" )"
|
|
line " Kernel: $(uname -r)"
|
|
line " Arch: $(uname -m)"
|
|
line " Uptime: $(uptime -p 2>/dev/null || uptime)"
|
|
line " Packages: $(rpm -qa 2>/dev/null | wc -l) rpm"
|
|
line ""
|
|
line " CPU"
|
|
line " Model: $(cpu_model)"
|
|
if have lscpu; then lscpu 2>/dev/null | grep -E '^(Architecture|CPU\(s\)|Thread|Core|Socket|L[123] |NUMA|Virtualization)' | sed 's/^/ /'; fi
|
|
line ""
|
|
line " MEMORY"
|
|
line " Total: $(mem_gib) GiB"
|
|
line " Swap: $(free -h 2>/dev/null | awk '/Swap/{print $2}')"
|
|
line ""
|
|
line " STORAGE"
|
|
disks
|
|
line ""
|
|
line " GPU(s)"
|
|
gpus
|
|
line " Largest VRAM: $(vram_gib) GiB"
|
|
line ""
|
|
line " TOOL VERSIONS"
|
|
tool_versions
|
|
line ""
|
|
line " THERMALS (current)"
|
|
have sensors && sensors 2>/dev/null | sed 's/^/ /' || line " (lm_sensors not installed)"
|
|
line ""
|
|
line "NOTE This is a captured baseline. Capture 'after' the same way once the"
|
|
line " system changes; the kit compares the two."
|
|
} > "$OUT_DETAIL"
|
|
|
|
printf 'wrote %s\n' "$OUT_SUMMARY"
|
|
printf 'wrote %s\n' "$OUT_DETAIL"
|