2024-11-28 00:04:57 -05:00
|
|
|
#! /bin/bash
|
|
|
|
|
|
|
|
baseline_time_s="$1"
|
|
|
|
arch=$(uname -m)
|
|
|
|
|
|
|
|
if [[ $arch = aarch64 ]]; then
|
|
|
|
iter=0
|
|
|
|
function aarch64_power {
|
2024-12-09 10:57:15 -05:00
|
|
|
sensors | awk '/CPU power:/ {print $3; exit}'
|
2024-11-28 00:04:57 -05:00
|
|
|
((iter++))
|
|
|
|
sleep 1s
|
|
|
|
}
|
2024-12-11 16:36:06 -05:00
|
|
|
baseline_time_s=-1
|
2024-12-09 10:57:15 -05:00
|
|
|
while [[ "$iter" -ne "$baseline_time_s" ]]; do
|
|
|
|
aarch64_power
|
|
|
|
done
|
2024-11-28 00:04:57 -05:00
|
|
|
elif [[ $arch = x86_64 ]]; then
|
2024-12-11 16:36:06 -05:00
|
|
|
if [[ "$baseline_time_s" -eq -1 ]]; then
|
2024-12-09 10:57:15 -05:00
|
|
|
#turbostat -s PkgWatt -i 1 2>/dev/null | awk -F: '/PkgWatt/ {getline; print $0}'
|
|
|
|
#turbostat -s PkgWatt -i 1 | awk '/PkgWatt/ {getline; print $0}'
|
2024-12-11 16:36:06 -05:00
|
|
|
turbostat -s PkgWatt ${@:2} | sed -n "/PkgWatt/{n;n;p}"
|
2024-11-28 00:04:57 -05:00
|
|
|
else
|
2024-12-09 10:57:15 -05:00
|
|
|
#turbostat -s PkgWatt -n "$baseline_time_s" -i 1 2>/dev/null | awk -F: '/PkgWatt/ {getline; print $0}'
|
2024-12-11 16:36:06 -05:00
|
|
|
turbostat -s PkgWatt -n "$baseline_time_s" -i 1 | sed -n "/PkgWatt/{n;n;p}"
|
2024-11-28 00:04:57 -05:00
|
|
|
fi
|
2024-12-09 10:57:15 -05:00
|
|
|
else
|
|
|
|
echo "Unrecognized arch!"
|
|
|
|
exit 1
|
2024-11-28 00:04:57 -05:00
|
|
|
fi
|