Skip to content

Commit

Permalink
Fix cpuspeed for low loads (#1618)
Browse files Browse the repository at this point in the history
This contains 2 fixes for low loaded nodes that have very dynamic
frequency.

Closes #1617
  • Loading branch information
steveschnepp authored May 13, 2024
2 parents 4cc19f6 + 5e0b7ac commit ce4738b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions plugins/node.d.linux/cpuspeed
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,20 @@ None needed by default.
You can set one environment variable to modify the plugins behaviour:
[cpuspeed]
env.sleep .2
env.scaleto100 yes
Parameter sleep
Sleep for some (fractional) seconds before actually taking the measure.
This is useful to enable the CPU to relax a little from the previous plugins.
"env.sleep .2" will cause a 200ms sleep.
Default is to NOT sleep, aka "env.sleep 0".
Parameter scaleto100
Show the frequency as a percentage instead of absolute frequency.
If set the "yes" the plugin sets up a CDEF to change the speed in Hz
to percent.
Expand Down Expand Up @@ -155,6 +167,7 @@ if [ "$1" = "config" ]; then
echo "cpu$N.min 0"
elif [ -r "$c/cpufreq/cpuinfo_min_freq" ]; then
MINHZ=$(cat "$c/cpufreq/cpuinfo_min_freq")
MINHZ=$(( $MINHZ - $MINHZ / 10 ))
echo "cpu$N.min $MINHZ"
fi

Expand All @@ -165,6 +178,8 @@ if [ "$1" = "config" ]; then
if [ "${MUNIN_CAP_DIRTYCONFIG:-0}" != 1 ]; then exit 0; fi
fi

[ -z "${sleep}" ] || sleep "${sleep}"

for c in /sys/devices/system/cpu/cpu[0-9]*; do
N=${c##*/cpu}
if [ IS_RYZEN ] && [ -r "$c/cpufreq/scaling_cur_freq" ]; then
Expand Down

0 comments on commit ce4738b

Please sign in to comment.