Add guard rails to the cpu_set_perf_perc script for FreeBSD.

This commit is contained in:
Tom Alexander 2023-10-23 20:10:58 -04:00
parent 3f0b8162b8
commit 5fcb37591c
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
1 changed files with 6 additions and 0 deletions

View File

@ -7,6 +7,12 @@ IFS=$'\n\t'
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
perc=$1
if [ "$perc" -gt 100 ]; then
perc=100
fi
if [ "$perc" -lt 0 ]; then
perc=0
fi
epp=$((100 - perc))
sysctl -N dev.hwpstate_intel | grep -E 'dev.hwpstate_intel.[0-9]+.epp' | while read var; do