Skip to content

Commit 9caf515

Browse files
meteorqz6aduh95
andauthored
Update benchmark/cpu.sh
Co-authored-by: Antoine du Hamel <[email protected]>
1 parent f3ef12a commit 9caf515

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

benchmark/cpu.sh

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,13 @@ MAXID=$(cat $CPUPATH/present | awk -F- '{print $NF}')
1111
echo "Warning: This script typically needs root access to modify CPU governor. Consider running it with sudo." >&2
1212

1313
get_default_governor() {
14-
available_governors=$(cat "$CPUPATH/cpu0/cpufreq/scaling_available_governors")
15-
16-
if echo "$available_governors" | grep -q "schedutil"; then
17-
echo "schedutil"
18-
elif echo "$available_governors" | grep -q "ondemand"; then
19-
echo "ondemand"
20-
elif echo "$available_governors" | grep -q "conservative"; then
21-
echo "conservative"
22-
else
23-
echo "powersave"
24-
fi
14+
case "$(cat "$CPUPATH/cpu0/cpufreq/scaling_available_governors")" in
15+
*"schedutil"*) echo "schedutil" ;;
16+
*"ondemand"*) echo "ondemand" ;;
17+
*"conservative"*) echo "conservative";;
18+
*) echo "powersave" ;;
19+
esac
20+
2521
}
2622

2723
set_governor() {

0 commit comments

Comments
 (0)