Skip to content

Commit

Permalink
Update cpu_freq_scaling.sh
Browse files Browse the repository at this point in the history
Fixed some inaccuracies about Intel pstate.
  • Loading branch information
SujayYadalam94 authored Nov 2, 2023
1 parent 976db77 commit 910136f
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions utils/cpu_freq_scaling.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
#!/bin/bash

##########################################################
# *IMPORTANT*: This script doesn't work for Intel pstate.
# Disable frequency scaling manually if CPU has pstate.
##########################################################

NUM_CORES=$(nproc --all)

# Silent pushd and popd
Expand All @@ -15,20 +10,15 @@ popd () {
command popd "$@" > /dev/null
}

# Check if the CPU has pstate
if [ -d intel_pstate ]; then
echo "Intel pstate detected. Please disable frequency scaling manually."
exit 1
fi
pushd /sys/devices/system/cpu

# Check if the CPU has cpufreq
if [ ! -d cpu0/cpufreq ]; then
echo "CPU frequency scaling not supported."
popd
exit 1
fi

pushd /sys/devices/system/cpu

for i in $(seq 0 $(($NUM_CORES-1)))
do
pushd "cpu${i}"/cpufreq
Expand Down

0 comments on commit 910136f

Please sign in to comment.