It seems like many of the cpu speed/governor switcher utilities in
/usr/portage/sys-power don't work due to being too old.  I cobbled
together a simple bash script (YES!) that sort of emulates the eselect
interface, and allows me to switch between
userspace/powersave/performance/ondemend/conservative governors.  Root
permission is required, of course, to write to the /sys pseudo
filesystem.  I want to add some basic error-checking and documentation
in the comments before releasing it in the wild.

  The only thing I can't get working is setting specific speeds.  I do
set the governor to "userspace" first.  I can't think of any other
problem.  Given that I can switch between performance and powersave and
ondemand/conservative, I'm not too worried about this, but I'd like to
know for completeness.

  Another item I'm missing is wildcarding directories in bash.  The
selected values are applied to the CPUs in a loop that goes like so...

for core in /sys/devices/system/cpu/cpu[0-9]/
do
   echo "${governor[${choiceminus}]}" > ${core}cpufreq/scaling_governor
   echo -n "CPU ${core:27:1} set to "
   cat ${core}cpufreq/scaling_governor
done

  That works fine for notebooks with say 8 cores.  But what happens when
you hit 16 cores?  I can't come up with one bash wildcard expression
that handles "/sys/devices/system/cpu/cpu[0-9]/" and
"/sys/devices/system/cpu/cpu[0-9][0-9]/" simultaneously.  There's
probably an elegant solution right under my nose, but my Google-fu is
failing me right now.  In a worst-case-scenario, I could have one loop
for "/sys/devices/system/cpu/cpu[0-9]/".  Then test for the existance of
"/sys/devices/system/cpu/cpu10]/".  If it exists, run a separate loop
for "/sys/devices/system/cpu/cpu[0-9][0-9]/".  Ugly, but it would work.

-- 
Walter Dnes <[email protected]>
I don't run "desktop environments"; I run useful applications

Reply via email to