waltd
Posts: 27
Joined: Mon Feb 18, 2013 12:58 pm

How to determine CPU clock speed

Tue Feb 19, 2013 2:26 pm

Hi all,
I've overclocked my Raspberry Pi to 850. To do this, I did a manual change to the /boot/config.text file that reads:
arm_freq=850
sdram_freq=500

When I run two different commands to determine my true CPU clock speed I get two different results.
1. cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
I get 700000
2. vcgencmd get_config arm_freq
I get arm_freq=850

Which command is giving me the true CPU clock speed? What is the difference between the two commands? And why am I getting different answers? Thanks for you help. :D

User avatar
RaTTuS
Posts: 10750
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
Contact: Twitter YouTube

Re: How to determine CPU clock speed

Tue Feb 19, 2013 2:41 pm

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
will get the current speed of the clock - if your system is not under load then it will probably be 700000
if it is under load then it will be the
vcgencmd get_config arm_freq
value

that tells you what you have set in /boot/config.txt
you wil lhave the on - demand flag set
Last edited by RaTTuS on Tue Feb 19, 2013 2:55 pm, edited 1 time in total.
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

waltd
Posts: 27
Joined: Mon Feb 18, 2013 12:58 pm

Re: How to determine CPU clock speed

Tue Feb 19, 2013 2:52 pm

Thanks RaTTuS. I appreciate your answer. I'm not sure what you mean by "not under load" and "under load". Am I correct to say that if my system is in a high processing activity I'll get 850, but if my system "resting" it will get 700000? How can I be sure that the 850 overclock that I set in the config file is working? Again thanks.

User avatar
RaTTuS
Posts: 10750
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
Contact: Twitter YouTube

Re: How to determine CPU clock speed

Tue Feb 19, 2013 3:03 pm

I'm not sure on the default conditions - but if you make it work - try a in one Terminal a
watch -n 1 cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
and do something else in another

bascially yes to the Q
[edit for sanity]
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

waltd
Posts: 27
Joined: Mon Feb 18, 2013 12:58 pm

Re: How to determine CPU clock speed

Tue Feb 19, 2013 3:08 pm

Good idea. I'll do a test. I'll run a high CPU intense task in one terminal, and I'll view the CPU clock speed in another terminal.

waltd
Posts: 27
Joined: Mon Feb 18, 2013 12:58 pm

Re: How to determine CPU clock speed

Tue Feb 19, 2013 4:02 pm

The test worked well. I ran a sudo apt-get update in one window and watched the CPU clock speed in another window. During low CPU demand the speed was 700000. However, at one point during a high CPU demand the clock time became 850000. I learned two things: 1. What the commands mean. 2. That the CPU clock speed is not constant but changes depending on the CPU load. (I was under the mistaken idea that the clock speed was constant at all times). This help a lot. Thanks for your help.

shuckle
Posts: 565
Joined: Sun Aug 26, 2012 11:49 am
Location: Finland

Re: How to determine CPU clock speed

Wed Feb 20, 2013 7:14 am

Just fyi: you can change when the higher speed is used by changing
/sys/devices/system/cpu/cpufreq/ondemand/up_threshold
It tells the cpu percentage usage limit that needs to be reached before overeclocking is started.

I have also tuned
/sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
to a value of 10 to save some time and poll less frequently the speed, so that cpu has more time to do real work. (this causes the cpu speed to stay high longer and causes your cpu to run hotter...)

IamtheToph
Posts: 1
Joined: Sat Apr 13, 2013 4:04 am

Re: How to determine CPU clock speed

Sat Apr 13, 2013 4:07 am

shuckle wrote:Just fyi: you can change when the higher speed is used by changing
/sys/devices/system/cpu/cpufreq/ondemand/up_threshold
It tells the cpu percentage usage limit that needs to be reached before overeclocking is started.
Will this work after a reboot, or does this need to be applied each time I restart or unplug?

I saw a post somewhere else that added an autostart.sh script to the /storage/.config/autostart.sh script, and then it added the code you outlined to 40 or 50 instead of 95.

What would be the best way to enable a Turbo OC setting threshold of 40 or 50 each time at boot, without me having to do it manually?

Return to “Beginners”