You are not logged in.

#1 2011-03-03 03:49:03

tataraperz
Member
Registered: 2011-01-05
Posts: 21

Automatic CPU governor switch in KDE 4.6?

Hi,

I was trying to configure my netbook which as an atom to switch governors automatically depending on the current power profile in KDE.

The problem is i have to be root to switch governors and typing "cpufreq-set -g foo_governor" in the "script" textbox in the power profiles window doesn't works. Trying to put sudo before that but obviously it didn't work. I thought about using a script to do it but my scripting skills are few and i don't know how to grant root privileges from whitin a script.

How do you guys deal with this?

Last edited by tataraperz (2011-03-03 03:49:50)

Offline

#2 2011-03-03 05:58:40

ANOKNUSA
Member
Registered: 2010-10-22
Posts: 2,141

Re: Automatic CPU governor switch in KDE 4.6?

Check out the KDE page and cpufreq page in the wiki...  You'll have to remain root while changing governors.  Unfortunately, the folks at KDE want to keep changing this.  Granted, they're moving forward consstantly, but still... Bit of a pain.  Use cpufreq and you should be good.

Offline

#3 2011-03-03 12:25:38

StarGater93
Member
Registered: 2010-07-15
Posts: 2

Re: Automatic CPU governor switch in KDE 4.6?

Solution :

Add Sudo to the Script file in question :

sudo cpufreq-set -c 0 -g $set
sudo cpufreq-set -c 1 -g $set

Then add the following line to the Sudoers file (visudo)(Replace %wheel with your username if thats what you did to get Sudo Access)

%wheel ALL = NOPASSWD /usr/bin/cpufreq-set

I guess you would run the script with the KDE power thing? or just do it manually if necessary

---
I personally did the same thing although I use a minimalistic openbox install so i manually change it when i need to.. I generally use the Powersave governor since I usually don't need the performance setting on my Laptop unless im messing with Gimp or something

Last edited by StarGater93 (2011-03-04 14:28:52)

Offline

#4 2011-03-03 16:42:54

tataraperz
Member
Registered: 2011-01-05
Posts: 21

Re: Automatic CPU governor switch in KDE 4.6?

thanks a lot it worked like a charm!

Offline

#5 2011-04-04 20:03:36

admiralspark
Member
From: Alaska, USA
Registered: 2011-01-07
Posts: 87

Re: Automatic CPU governor switch in KDE 4.6?

sudo cpufreq-set -r -g ondemand

placed in your xinit script, with the requisite &&'s or whatever, will change all cores to ondemand when initiating X. The option "-r" copies the command for every like-cpu, so for instance all eight cores in an i7 (4 physical 4 hyperthreaded) will be set to ondemand.


Team Ignition Kernel Developer
linux-ideapad developer/maintainer
Flame Kernel developer for Galaxy Nexus and Galaxy S3
Want a cheap, reliable VPS with AWESOME customer service?

Offline

#6 2011-05-19 21:34:47

James_Eder
Member
From: usa
Registered: 2011-05-19
Posts: 14

Re: Automatic CPU governor switch in KDE 4.6?

admiralspark wrote:
sudo cpufreq-set -r -g ondemand

placed in your xinit script, with the requisite &&'s or whatever, will change all cores to ondemand when initiating X. The option "-r" copies the command for every like-cpu, so for instance all eight cores in an i7 (4 physical 4 hyperthreaded) will be set to ondemand.

For my AMD Phenom II X4, the "-r" option has no effect.  cpufreq-set simply sets the governor for CPU 0 and leaves the rest unchanged.  I'm not sure what cpufreq-set uses to determine what CPUs are related but it seems Phenom cores are not "related" as far as it's concerned.  For me, the only option was to create a shell script to iterate through the processors (one cpufreq-set call per core).

I ended up doing something like:

for i in {0..3}; do
  sudo /usr/bin/cpufreq-set -c${i} -gondemand
done

Offline

Board footer

Powered by FluxBB