cpu frequency scaling

Optimize your system for ultimate performance.

Moderators: MattKingUSA, khz

halfsoul
Established Member
Posts: 23
Joined: Mon Sep 20, 2010 1:50 pm

Re: cpu frequency scaling

Post by halfsoul »

I suspect that my mobo/CPU does not support governing/scaling. Can someone please confirm?
~$ more /proc/cpuinfo | grep MHz
cpu MHz : 3200.301
cpu MHz : 3200.301
~$ cpufreq-info
cpufrequtils 007: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to cpufreq@vger.kernel.org, please.
analyzing CPU 0:
no or unknown cpufreq driver is active on this CPU
maximum transition latency: 0.00 ms.
analyzing CPU 1:
no or unknown cpufreq driver is active on this CPU
maximum transition latency: 0.00 ms.
User avatar
angelsguitar
Established Member
Posts: 145
Joined: Sat May 31, 2008 10:30 am
Location: Florida
Contact:

Re: cpu frequency scaling

Post by angelsguitar »

halfsoul wrote:I suspect that my mobo/CPU does not support governing/scaling. Can someone please confirm?
~$ more /proc/cpuinfo | grep MHz
cpu MHz : 3200.301
cpu MHz : 3200.301
~$ cpufreq-info
cpufrequtils 007: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to cpufreq@vger.kernel.org, please.
analyzing CPU 0:
no or unknown cpufreq driver is active on this CPU
maximum transition latency: 0.00 ms.
analyzing CPU 1:
no or unknown cpufreq driver is active on this CPU
maximum transition latency: 0.00 ms.
I'm not sure if this would be the correct way to check for scaling compatibility, but maybe you could check for available scaling frequencies running this:

Code: Select all

more /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
Or check for available governors with this one:

Code: Select all

more /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
Ángel A. Candelaria Colón
Guitar Professor
https://angelsguitar.com
StudioDave
Established Member
Posts: 753
Joined: Sat Nov 01, 2008 1:12 pm

Re: cpu frequency scaling

Post by StudioDave »

Thanks to the OP for starting this thread. I discovered that my recent installation of Ubuntu 10.04 had scaled my CPU back to 1 GHz. Ouch. For the record, I edited both /etc/init.d/cpufrequtils and /etc/init.d/ondemand to ensure full performance from my CPU, which is now running at its rated top speed of 2.4 GHz.

Ahh, that's better. :)

Best,

dp
studio32

Re: cpu frequency scaling

Post by studio32 »

StudioDave wrote:Thanks to the OP for starting this thread. I discovered that my recent installation of Ubuntu 10.04 had scaled my CPU back to 1 GHz. Ouch. For the record, I edited both /etc/init.d/cpufrequtils and /etc/init.d/ondemand to ensure full performance from my CPU, which is now running at its rated top speed of 2.4 GHz.

Ahh, that's better. :)

Best,

dp
Hi dp,

Could you be a bit more specific? What did you change in the files, how do they look now?

thanks
User avatar
t-sys
Established Member
Posts: 15
Joined: Mon Jul 12, 2010 4:10 pm
Location: Finland
Contact:

Re: cpu frequency scaling

Post by t-sys »

Thanks to you all, this thread was helpful for setting up my Ubuntu 12.04 system for audio work (particularly the 2nd post by philip888 on the 1st page). Much less xruns now with qtractor.
User avatar
angelsguitar
Established Member
Posts: 145
Joined: Sat May 31, 2008 10:30 am
Location: Florida
Contact:

Re: cpu frequency scaling

Post by angelsguitar »

Studio32, maybe StudioDave is referring to this little "hack" I explained before:
angelsguitar wrote:Well, after a little tweaking and experimentation, I found that by editing /etc/init.d/ondemand I can make the governor change permanent. I just opened the file and on this section

Code: Select all

for CPUFREQ in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
	do
		[ -f $CPUFREQ ] || continue
		echo -n ondemand > $CPUFREQ
	done
I changed the part that says "ondemand" for "performance", so it now reads like this:

Code: Select all

for CPUFREQ in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
	do
		[ -f $CPUFREQ ] || continue
		echo -n performance > $CPUFREQ
	done
I don't know if this is the best way to do it, but it works for me - now the system boots in performance mode everytime, and both the realtime configuration script and cpufreq-info report the system as running in performance mode. Seems that, using this method, neither cpufreqd nor cpufrequtils is needed to make the change permanent.
Since the "ondemand" script is really setting the cpu on performance mode, maybe it should be renamed "performance" or something like that. Or better yet, deactivate the ondemand script, make a copy under another name (maybe name it "performance"), change it as described above, and activate it again.
Ángel A. Candelaria Colón
Guitar Professor
https://angelsguitar.com
User avatar
bluebell
Established Member
Posts: 1926
Joined: Sat Sep 15, 2012 11:44 am
Location: Saarland, Germany
Has thanked: 112 times
Been thanked: 121 times

Re: cpu frequency scaling

Post by bluebell »

Hi all,

two important things:

- Switch off Turbo Boost. The Linux timer can't handle this. I experienced faster tempo in Rosegarden for a few seconds and then Audiotracks were totally out of sync. AFAIK Turbo Boost can only switched off in the BIOS.

- I use cpufreqd and have a rule to use the highest CPU freq when I start my audioprocessing. /etc/cpufreqd.conf:

#-- Profiles ---------------------------------------

[Profile]
name=On_Demand_High
minfreq=100%
maxfreq=100%
policy=ondemand
[/Profile]

[Profile]
name=On_Demand_Standard
minfreq=0%
maxfreq=100%
policy=ondemand
[/Profile]

#-- Rules ------------------------------------------

[Rule]
name=Standard_Rule
cpu_interval=0-100
profile=On_Demand_Standard
[/Rule]

[Rule]
name=CPU_Too_Hot
acpi_temperature=60-100
cpu_interval=50-100
profile=On_Demand_Standard
[/Rule]

[Rule]
name=Music_Production
programs=rosegarden,jamin
cpu_interval=0-100
profile=On_Demand_High
[/Rule]

Linux – MOTU UltraLite AVB – Qtractor – http://suedwestlicht.saar.de/

User avatar
raboof
Established Member
Posts: 1855
Joined: Tue Apr 08, 2008 11:58 am
Location: Deventer, NL
Has thanked: 50 times
Been thanked: 74 times
Contact:

Re: cpu frequency scaling

Post by raboof »

bluebell wrote:Switch off Turbo Boost. The Linux timer can't handle this. I experienced faster tempo in Rosegarden for a few seconds and then Audiotracks were totally out of sync. AFAIK Turbo Boost can only switched off in the BIOS.
Odd, never heard of that.
bluebell wrote:[Profile]
name=On_Demand_High
minfreq=100%
maxfreq=100%
policy=ondemand
[/Profile]
Wouldn't the 'performance' policy be more suitable here?
User avatar
bluebell
Established Member
Posts: 1926
Joined: Sat Sep 15, 2012 11:44 am
Location: Saarland, Germany
Has thanked: 112 times
Been thanked: 121 times

Re: cpu frequency scaling

Post by bluebell »

raboof wrote:
bluebell wrote:Switch off Turbo Boost. The Linux timer can't handle this. I experienced faster tempo in Rosegarden for a few seconds and then Audiotracks were totally out of sync. AFAIK Turbo Boost can only switched off in the BIOS.
Odd, never heard of that.
It drove me crazy until I found out by thinking ... hmmm ... it sounds about 20% faster ... 20% is about the turbo boost that can happen when only one core is busy.
raboof wrote:
bluebell wrote:[Profile]
name=On_Demand_High
minfreq=100%
maxfreq=100%
policy=ondemand
[/Profile]
Wouldn't the 'performance' policy be more suitable here?
Should work as well. But this setup works for me.

Linux – MOTU UltraLite AVB – Qtractor – http://suedwestlicht.saar.de/

User avatar
angelsguitar
Established Member
Posts: 145
Joined: Sat May 31, 2008 10:30 am
Location: Florida
Contact:

Re: cpu frequency scaling

Post by angelsguitar »

bluebell wrote:Switch off Turbo Boost. The Linux timer can't handle this. I experienced faster tempo in Rosegarden for a few seconds and then Audiotracks were totally out of sync. AFAIK Turbo Boost can only switched off in the BIOS.
I too have experienced some tempo variations for a few seconds too, on rare ocassions. I'll check this out if it happens again, thanks.
raboof wrote:
bluebell wrote:[Profile]
name=On_Demand_High
minfreq=100%
maxfreq=100%
policy=ondemand
[/Profile]
Wouldn't the 'performance' policy be more suitable here?
I agree with raboof on this; 'performance' might be a better option (unless you have problems with the CPU temperature, of course). Although, what I see here is that the profile is named "On_Demand_High" but the cpu min and max freq's are set too 100% - which really is a 'performance' setting.
Ángel A. Candelaria Colón
Guitar Professor
https://angelsguitar.com
User avatar
raboof
Established Member
Posts: 1855
Joined: Tue Apr 08, 2008 11:58 am
Location: Deventer, NL
Has thanked: 50 times
Been thanked: 74 times
Contact:

Re: cpu frequency scaling

Post by raboof »

bluebell wrote:
raboof wrote:
bluebell wrote:Switch off Turbo Boost. The Linux timer can't handle this. I experienced faster tempo in Rosegarden for a few seconds and then Audiotracks were totally out of sync. AFAIK Turbo Boost can only switched off in the BIOS.
Odd, never heard of that.
It drove me crazy until I found out by thinking ... hmmm ... it sounds about 20% faster ... 20% is about the turbo boost that can happen when only one core is busy.
Still quite peculiar: I can't see any direct relation between CPU speed and audio speed. After all, the audio speed is determined by the sample rate, and it's the soundcards' clock that takes care of moving bytes from the buffer to the speaker at that rate... shouldn't really be influenced by CPU speed...
User avatar
bluebell
Established Member
Posts: 1926
Joined: Sat Sep 15, 2012 11:44 am
Location: Saarland, Germany
Has thanked: 112 times
Been thanked: 121 times

Re: cpu frequency scaling

Post by bluebell »

raboof wrote:
bluebell wrote: It drove me crazy until I found out by thinking ... hmmm ... it sounds about 20% faster ... 20% is about the turbo boost that can happen when only one core is busy.
Still quite peculiar: I can't see any direct relation between CPU speed and audio speed. After all, the audio speed is determined by the sample rate, and it's the soundcards' clock that takes care of moving bytes from the buffer to the speaker at that rate... shouldn't really be influenced by CPU speed...
Indeed. Rosegarden ran faster for a few seconds but audio didn't, so the synth-tracks and the vocals were out of sync.

Linux – MOTU UltraLite AVB – Qtractor – http://suedwestlicht.saar.de/

ocean
Established Member
Posts: 40
Joined: Sat Sep 15, 2012 3:59 pm

Re: cpu frequency scaling

Post by ocean »

How exactly would I go about installing a governor? Cpufreq reports:

...

* Loading cpufreq kernel modules... [fail]
* CPUFreq Utilities: Setting ondemand CPUFreq governor... * disabled, governor not available... [ OK ]

...

analyzing CPU 0:
no or unknown cpufreq driver is active on this CPU
maximum transition latency: 4294.55 ms.
analyzing CPU 1:
no or unknown cpufreq driver is active on this CPU
maximum transition latency: 4294.55 ms.
analyzing CPU 2:
no or unknown cpufreq driver is active on this CPU
maximum transition latency: 4294.55 ms.
analyzing CPU 3:
no or unknown cpufreq driver is active on this CPU
maximum transition latency: 4294.55 ms.

EDIT: Oh, I see... It was a BIOS setting. Speedstep needed to be ON.
User avatar
Capoeira
Established Member
Posts: 1321
Joined: Tue May 12, 2009 1:01 pm
Location: Brazil
Has thanked: 3 times
Been thanked: 2 times

Re: cpu frequency scaling

Post by Capoeira »

I would like qjackctl to run

Code: Select all

cpupower frequency-set -g performance
on start up...and

Code: Select all

cpupower frequency-set -g ondemand
on stopping.


onfortuantly those need to be executed by root or sudo.
Anbody knows how I could achieve this



BTW: I tested the goveners and it made a huge difference here on my core-i3
User avatar
autostatic
Established Member
Posts: 1994
Joined: Wed Dec 09, 2009 5:26 pm
Location: Beverwijk, The Netherlands
Has thanked: 32 times
Been thanked: 104 times
Contact:

Re: cpu frequency scaling

Post by autostatic »

There are different ways to do this. The easiest I guess would be to add the cpupower to your sudoers file (if your system has one) and allow a user to run it without having to issue a password:

Code: Select all

yourusername ALL=(ALL) NOPASSWD: /path/to/cpupower
Editing the sudoers file is done with the visudo command. Not sure if the sudoers syntax is correct though. There are other ways like using PolicyKit or changing the permissions on cpupower itself (which I wouldn't recommend).
Post Reply