public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] Questions about cpu frequency utils scripting
@ 2015-04-21  1:05 Walter Dnes
  2015-04-21  8:36 ` Emanuele Rusconi
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Walter Dnes @ 2015-04-21  1:05 UTC (permalink / raw
  To: Gentoo Users List

  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 <waltdnes@waltdnes.org>
I don't run "desktop environments"; I run useful applications


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-04-22 12:48 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-21  1:05 [gentoo-user] Questions about cpu frequency utils scripting Walter Dnes
2015-04-21  8:36 ` Emanuele Rusconi
2015-04-21 10:42 ` Alec Ten Harmsel
2015-04-21 15:24   ` Walter Dnes
2015-04-21 17:01     ` Alec Ten Harmsel
2015-04-21 17:02 ` Mike Gilbert
2015-04-22 12:48   ` Rich Freeman
2015-04-21 19:23 ` [gentoo-user] A bash-based CPU governor/speed-control utility Walter Dnes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox