commit cab605b0a9b40d23a03a3c3b3fac01434e23ca26 parent 1f4b5edf8aba8bfc2317ebd613081a2802aa4fb1 Author: Anders Damsgaard <anders@adamsgaard.dk> Date: Sat, 20 Jun 2020 14:34:25 +0200 Add temperature stress test for openbsd Diffstat:
A | .local/bin/temptest | | | 26 | ++++++++++++++++++++++++++ |
1 file changed, 26 insertions(+), 0 deletions(-)
diff --git a/.local/bin/temptest b/.local/bin/temptest @@ -0,0 +1,26 @@ +#!/bin/sh +# requirements: stress + +n_cores="$(sysctl -n hw.ncpufound)" +if [ "$n_cores" -gt 1 ]; then + label="cpus" +else + label="cpu" +fi + +show_temp() { + load="$(uptime | sed 's/.*: //')" + temp="$(sysctl -n hw.sensors.cpu0.temp0)" + cpuspeed="$(sysctl -n hw.cpuspeed)" + printf '\r ' + printf '\r%s\t%s\t%s MHz\n' "$load" "$temp" "$cpuspeed" +} + +i=1 +while [ i -le 5 ]; do + show_temp + printf 'stressing %s %s...' "$n_cores" "$label" + stress -c "$n_cores" -t 120s >/dev/null + i=$(( i + 1 )) +done +show_temp