Skip to content

Commit f3ef12a

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

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

benchmark/cpu.sh

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,11 @@ CPUPATH=/sys/devices/system/cpu
44

55
MAXID=$(cat $CPUPATH/present | awk -F- '{print $NF}')
66

7-
if [ "$(uname -s || true)" != "Linux" ]; then
8-
echo "Error: This script runs on Linux only." >&2
9-
exit 1
10-
fi
11-
12-
if [ "$(id -u || true)" -ne 0 ]; then
13-
echo "Error: Run as root (sudo) to modify CPU governor." >&2
14-
exit 1
15-
fi
7+
[ "$(uname -s || true)" = "Linux" ] || \
8+
echo "Warning: This script supports Linux only." >&2
9+
10+
[ "$(id -u || true)" = "0" ] || \
11+
echo "Warning: This script typically needs root access to modify CPU governor. Consider running it with sudo." >&2
1612

1713
get_default_governor() {
1814
available_governors=$(cat "$CPUPATH/cpu0/cpufreq/scaling_available_governors")

0 commit comments

Comments
 (0)