29 lines
566 B
Bash
29 lines
566 B
Bash
#! /bin/bash
|
|
|
|
baseline_time_s="$1"
|
|
arch=$(uname -m)
|
|
|
|
if [[ $arch = aarch64 ]]; then
|
|
iter=0
|
|
function aarch64_power {
|
|
sensors | awk '/CPU power:/ {printf "Socket"++count[$1] " "; print $3}'
|
|
((iter++))
|
|
sleep 1s
|
|
}
|
|
if [[ -z "$baseline_time_s" ]]; then
|
|
while true; do
|
|
aarch64_power
|
|
done
|
|
else
|
|
while [[ "$iter" -ne "$baseline_time_s" ]]; do
|
|
aarch64_power
|
|
done
|
|
fi
|
|
elif [[ $arch = x86_64 ]]; then
|
|
if [[ -z "$baseline_time_s" ]]; then
|
|
turbostat -s PkgWatt -i 1 2>/dev/null
|
|
else
|
|
turbostat -s PkgWatt -n "$baseline_time_s" -i 1 2>/dev/null
|
|
fi
|
|
fi
|