Re: [gentoo-user] Questions about cpu frequency utils scripting

2015-04-22 Thread Rich Freeman
On Tue, Apr 21, 2015 at 1:02 PM, Mike Gilbert  wrote:
> On Mon, Apr 20, 2015 at 9:05 PM, Walter Dnes  wrote:
>>   It seems like many of the cpu speed/governor switcher utilities in
>> /usr/portage/sys-power don't work due to being too old.
>
> sys-power/cpupower is probably the best option in the portage tree.
> It's sources are maintained in the kernel source tree.
>

I'm still running cpufreqd which I keep in my overlay, but upstream is
long dead and I wouldn't necessarily recommend it as a first choice.
One of these days I plan to migrate to thermald, though for the most
part I've been of a not-broken-don't-fix mindset.

-- 
Rich



Re: [gentoo-user] Questions about cpu frequency utils scripting

2015-04-21 Thread Mike Gilbert
On Mon, Apr 20, 2015 at 9:05 PM, Walter Dnes  wrote:
>   It seems like many of the cpu speed/governor switcher utilities in
> /usr/portage/sys-power don't work due to being too old.

sys-power/cpupower is probably the best option in the portage tree.
It's sources are maintained in the kernel source tree.



Re: [gentoo-user] Questions about cpu frequency utils scripting

2015-04-21 Thread Alec Ten Harmsel


On 04/21/15 11:24, Walter Dnes wrote:
> On Tue, Apr 21, 2015 at 06:42:35AM -0400, Alec Ten Harmsel wrote
>> for core in `ls /sys/devices/system/cpu/ | egrep "cpu[0-9]+"`
>>
>> This works great on my desktop with 12 cores.
>   Can you please check whether Emanuele's solution works on your system?
>
> for core in /sys/devices/system/cpu/cpu[0-9]*/
>
>   I prefer simpler solutions.
>

That does work. I tested it this morning and it didn't work, but forgot
that I'm using zsh. Works fine with bash.

Alec



Re: [gentoo-user] Questions about cpu frequency utils scripting

2015-04-21 Thread Walter Dnes
On Tue, Apr 21, 2015 at 06:42:35AM -0400, Alec Ten Harmsel wrote
> 
> for core in `ls /sys/devices/system/cpu/ | egrep "cpu[0-9]+"`
> 
> This works great on my desktop with 12 cores.

  Can you please check whether Emanuele's solution works on your system?

for core in /sys/devices/system/cpu/cpu[0-9]*/

  I prefer simpler solutions.

-- 
Walter Dnes 
I don't run "desktop environments"; I run useful applications



Re: [gentoo-user] Questions about cpu frequency utils scripting

2015-04-21 Thread Alec Ten Harmsel


On 04/20/2015 09:05 PM, Walter Dnes wrote:
>
>   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

for core in `ls /sys/devices/system/cpu/ | egrep "cpu[0-9]+"`

This works great on my desktop with 12 cores.

Alec



Re: [gentoo-user] Questions about cpu frequency utils scripting

2015-04-21 Thread Emanuele Rusconi
for core in /sys/devices/system/cpu/cpu[0-9]*/

-- Emanuele Rusconi


[gentoo-user] Questions about cpu frequency utils scripting

2015-04-20 Thread Walter Dnes
  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 
I don't run "desktop environments"; I run useful applications