LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-01-2007, 04:44 PM   #1
billlee
Member
 
Registered: Jun 2003
Location: East Texas
Distribution: Fedora (24)
Posts: 47

Rep: Reputation: 16
Question Confusing CPU speed information


Very confusing collection of information regarding the MHz if the processor on the laptop I'm running. I need to know the value accurately and have always depended on the value found in /proc/cpuinfo. But for some reason this laptop seems screwed up somehow. I am pretty sure that the processor is running at a speed higher than what is reported.

Here's the pertinent information.

System is an HP pavilion ze5500
Processor is a P-4 rated at 2.6GHz
System is Fedora Core 5 - plain vanilla installation
Kernel is 2.6.15-1.2054_FC5

I look in /proc/cpuinfo and find

model name : Mobile Intel(R) Pentium(R) 4 CPU 2.66GHz
cpu MHz : 668.000


Using dmidecode -t processor I find

Version: Mobile Intel(R) Pentium(R) 4
Max Speed: 2667 MHz
Current Speed: 1600 MHz



Similar information on a desktop:

model name : Pentium III (Coppermine)
cpu MHz : 698.524

and
Version: Intel Pentium(R) III Processor
Max Speed: 800 MHz
Current Speed: 700 MHz


When the laptop was new 3-years ago, I encountered a similar problm. /proc/cpuinfo was reporting "cpu MHZ 1594.858". Apparently this was a BIOS problem, solved when I installed a new version. That was back when running Fedora Core 1 (maybe it was 2 by then). After the BIOS upgrade, the /proc/cpuinfo accurately reflected the 2.66GHz cpu speed.

But now it's reporting what I listed above.

Does anyone have any idea what is going on?

Surely a cpu just doesn't "wear out" or something!

Regards,

Bill Lee

Last edited by billlee; 04-02-2007 at 08:05 AM.
 
Old 04-01-2007, 06:00 PM   #2
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
There's a very good chance that the CPU is reporting the correct speed. However, if that's a laptop, the reported speed may be lower due to CPU frequency cycling, ACPI, or other similar power-saving features, which reduce processor speed when there is no need for it.
Lower clock frequencies save power.
As an example of a 'wrong' report, my processor is made as a 1.8 Ghz Pentium. However I have overclocked it to 2.2 Ghz. Then I thought I'd get smart, and install kernel modules for the CPU-frequency-scaling tools out there. I chose "Maximum Performance/Speed" as my default.
Lo and behold, when I booted it up, it was clocking EXACTLY 1800 Mhz... LOL, Because according to the CPU, 1800 IS the max it can do, so the kernel set the clock at that.
I removed the cpufreq modules, and presto, it want back to 2214 Mhz, where I want it.
So, the moral: (LOL) Investigate if there are power-saving systems in use on the machine, and read the file /var/log/dmesg, and look for the 'bogomips' number. Divide that in half, and that should be the CPU clock speed at bootup.
 
Old 04-01-2007, 09:06 PM   #3
billlee
Member
 
Registered: Jun 2003
Location: East Texas
Distribution: Fedora (24)
Posts: 47

Original Poster
Rep: Reputation: 16
Thanks for the input.

Looking at the dmesg file, bogomips is set to 2.66GHz X 2 (approximately) and I am certain that the system is NOT running at anywhere near 2.66 GHz.

The reported speed of "cpu MHz : 668.000" from /proc/cpuinfo just doesn't make any sense. I am certain after making some measurements today that the cpu is running at a nominal 1.6GHz, as reported by dmidecode. Here's how I made that determination:

The pentium has an internal register that is incremented once for every clock cycle. See here:

http://www.cs.wm.edu/~kearns/001lab.d/rdtsc.html

for an explanation.

I have an application that I can trigger with an external switch and it records the "time" (i.e., the cpu clock cycle counter from the register). Some time later I can trigger the same action and convert the cpu clock count to an elapsed time IF I KNOW THE CPU SPEED.

On my HP, I ran this application (several times) and compared the reported time to a hand-held stop watch. Letting the application run for several minutes and repeating the test several times gives me an acceptable level of accuracy. The measurement told me that the cpu speed was 1.5955 GHz, a number that is typical for a 1.6GHz cpu.

This leads me to the conclusion that the CPU is actually running at 1.6GHz, and still with several questions:

1) Where in the dickens is the value of 668.000 (yes, there are that many zero digits reported) coming from?

2) Why isn't it being set in /proc/cpuinfo properly?

3) And why is it running at 1.6GHz and not at 2.66GHz?

Yes, ACPID is running, but I don't see any evidence in its logs that it is doing anything other than looking at the battery.

I have spent several hours searching and reading about CPU frequency management, and have not found definitive information. (I'm sure it's out there, but tracking it down is a nightmare.)

I am still confused.

Regards,

Bill Lee
 
Old 04-01-2007, 09:18 PM   #4
moxieman99
Member
 
Registered: Feb 2004
Distribution: Dabble, but latest used are Fedora 13 and Ubuntu 10.4.1
Posts: 420

Rep: Reputation: 146Reputation: 146
Quote:
Originally Posted by billlee
Thanks for the input.

Looking at the dmesg file, bogomips is set to 2.66GHz X 2 (approximately) and I am certain that the system is NOT running at anywhere near 2.66 GHz.

I am still confused.

Regards,

Bill Lee
-----------------
Have you examined your BIOS settings? My P4 2.4 GigHz CPU (Step 18) was running at 1.8GigHz because I futzed around and wound up with bus settings at 100mhz/100mhz instead of 133mhz/133mhz. Once I changed the settings in BIOS, my computer (desktop) started running at 2.5 GigHz, as advertised.

Also, is your CPU throttled in some way? You said you had a laptop, and laptops, as another poster pointed out, do things to conserve power.
 
Old 04-02-2007, 08:03 AM   #5
billlee
Member
 
Registered: Jun 2003
Location: East Texas
Distribution: Fedora (24)
Posts: 47

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by moxieman99
-----------------
Have you examined your BIOS settings?
Yes. And the interface to the BIOS on this laptop has no controls for clock speed.

Quote:
Originally Posted by moxieman99
Also, is your CPU throttled in some way? You said you had a laptop, and laptops, as another poster pointed out, do things to conserve power.
This is likely the case.

Cutting to the chase: are there programatic ways to query and/or set the CPU clock speed? My application absolutely needs to know the value, and cannot allow the system (whatever) to change it on-the-fly.

Thanks for the help.

Bill Lee
 
Old 04-02-2007, 08:18 AM   #6
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
Quote:
Originally Posted by billlee

Cutting to the chase: are there programatic ways to query and/or set the CPU clock speed? My application absolutely needs to know the value, and cannot allow the system (whatever) to change it on-the-fly.
Bill Lee
I can't specifically suggest much about the 'querying' part, other than standard things I know of like the 'lshw' command, which will return the CURRENT CPU speed, among other things. It has flags to shave down the results, but it may not do exactly what you want.

As for SETTING the clock speed, you probably want to look into how your kernel is compiled. There are kernel-compile options for CPU frequency controls, which can be set for various scheduling methods, and can be set with either USERSPACE priority, STATIC CONSERVATIVE (saves power) , STATIC MAXIMUM and STATIC MINIMUM speed, as well as using the userspace tool 'cpufreq tools' which can be run as a daemon or called as a command/function.

There IS a combination of kernel options will prevent the speed from being changed by the operating system (or by the system to *some* degree).

It really depends how your default kernel is set up as to how the CPU frequency is influenced, including the ACPI system, which also affects power-modes and CPU scheduling. It *is* a laptop after all, so I'm really unsure just how much total control you can acquire.

Last edited by GrapefruiTgirl; 04-02-2007 at 08:20 AM.
 
Old 04-02-2007, 08:25 AM   #7
b0uncer
LQ Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
If you can't let the system change the value (even if that could spare the battery by saving energy while the cpu is not needed), then remove the cpu frequency scaling feature, from your kernel too (that means usually recompiling). After that I don't think the frequency can be altered, it's at the maximum all the time (I wouldn't do that on a laptop, unless it's always plugged to the wall, and in that case there's no sense in having a laptop).

I understand it that /proc/cpuinfo reports the current cpu speed. I remember trying it: when nothing special was running (except the system's "needed" processes), my cpu was reported by cpuinfo to be 800MHz. Then I started updatedb which rebuilds slocate database, using some cpu power, and cat'ed quickly /proc/cpuinfo again, to notice that my cpu was reported to be nearly the maximum MHz of what it can do. So I guess /proc/cpuinfo reports pretty accurate information but just for the moment: should some process use cpu more, the cpu rate is (on laptops, especially) raised to get more power, and that reflects to /proc/cpuinfo (because /proc is a virtual filesystem, and actually a place where you can "peek" what's going on in your kernel at the moment).

I'm not sure where those other values come from, or how much they're rounded, but cpuinfo should be pretty accurate at the moment you read it. Just keep in mind that the value depends on what's running, and how much your frequency scaling module is scaling it, or if it is. To have the value be at maximum I would start off by recompiling the kernel (or obtaining one that has it done) and removing the cpu frequency scaling feature, effectively preventing the system from lowering the frequency when cpu is not needed.

If you need to know the maximum value reported by your cpu, then use the bogomips "method", if you need to know the current cpu speed, use proc if you don't want to do anything more low-level. I wonder what kind of program needs to know the exact clock speed of a cpu, but then again, not my problem and the accuracy you're asking...you can't know exactly what the frequency is, like Mr. Paul said (a long) time ago. You can just get pretty near; the rest depends on a wide range of variables (like build errors, electron tunneling, ...), but after all I'm confident you'll get a decent value for your program if you want to.
 
Old 10-07-2007, 06:43 PM   #8
replica9000
Senior Member
 
Registered: Jul 2006
Location: USA
Distribution: Debian, FreeBSD, Android
Posts: 1,053
Blog Entries: 2

Rep: Reputation: 227Reputation: 227Reputation: 227
I know this thread is a little old, but I was having the same issue with my AMD 2800+ (some of us do use the search option lol)

my CPU used to report 1.80ghz, then one day went to 800mhz (the lowest setting), and I also got conflicting info:

Code:
Debsidian:/home/replica# cat /proc/cpuinfo
processor       : 0
vendor_id       : AuthenticAMD
cpu family      : 15
model           : 36
model name      : AMD Turion(tm) 64 Mobile Technology ML-34
stepping        : 2
cpu MHz         : 800.000
cache size      : 1024 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 1
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx mmxext fxsr_opt lm 3dnowext 3dnow up pni lahf_lm ts fid vid ttp tm stc
bogomips        : 1593.59
clflush size    : 64

Debsidian:/home/replica# dmidecode -t processor I find
# dmidecode 2.9
SMBIOS 2.31 present.

Handle 0x0004, DMI type 4, 35 bytes
Processor Information
        Socket Designation: Socket 754
        Type: Central Processor
        Family: Turion 64
        Manufacturer: AMD
        ID: 42 0F 02 00 FF FB 8B 07
        Signature: Family 15, Model 36, Stepping 2
        Flags:
                FPU (Floating-point unit on-chip)
                VME (Virtual mode extension)
                DE (Debugging extension)
                PSE (Page size extension)
                TSC (Time stamp counter)
                MSR (Model specific registers)
                PAE (Physical address extension)
                MCE (Machine check exception)
                CX8 (CMPXCHG8 instruction supported)
                APIC (On-chip APIC hardware supported)
                SEP (Fast system call)
                MTRR (Memory type range registers)
                PGE (Page global enable)
                MCA (Machine check architecture)
                CMOV (Conditional move instruction supported)
                PAT (Page attribute table)
                PSE-36 (36-bit page size extension)
                CLFSH (CLFLUSH instruction supported)
                MMX (MMX technology supported)
                FXSR (Fast floating-point save and restore)
                SSE (Streaming SIMD extensions)
                SSE2 (Streaming SIMD extensions 2)
        Version: Turion 64D Athlon
        Voltage: 3.3 V
        External Clock: 200 MHz
        Max Speed: 1800 MHz
        Current Speed: 1800 MHz
        Status: Populated, Enabled
        Upgrade: ZIF Socket
        L1 Cache Handle: 0x0008
        L2 Cache Handle: 0x0009
        L3 Cache Handle: Not Provided
        Serial Number: Not Specified
        Asset Tag: Not Specified
        Part Number: Not Specified
After reading this thread and doing some further investigating, it might have been the PowerNow-K8 driver reporting the wrong info. This might have happened when I upgraded from kernel 2.6.18-5-7 to 2.6.22-1-k7.
I've also had AMD drivers do this under WinXP.

I found a couple programs already installed in my distro:
cpufreq-info and cpufreq-set

Code:
Debsidian:/home/replica# cpufreq-info
cpufrequtils 002: cpufreq-info (C) Dominik Brodowski 2004-2006
Report errors and bugs to linux@brodo.de, please.
analyzing CPU 0:
  driver: powernow-k8
  CPUs which need to switch frequency at the same time: 0
  hardware limits: 800 MHz - 1.80 GHz
  available frequency steps: 1.80 GHz, 1.60 GHz, 800 MHz
  available cpufreq governors: powersave, userspace, ondemand, conservative, performance
  current policy: frequency should be within 800 MHz and 1.80 GHz.
                  The governor "ondemand" may decide which speed to use
                  within this range.
  current CPU frequency is 800 MHz (asserted by call to hardware).
cpufreq-set comes with the following options:
-c --cpu <CPU>
number of CPU where cpufreq settings shall be modified.

-d --min <FREQ>
new minimum CPU frequency the governor may select.

-u --max <FREQ>
new maximum CPU frequency the governor may select.

-g --governor <GOV>
new cpufreq governor.

-f --freq <FREQ>
specific frequency to be set. Requires userspace governor to be available and loaded.

So I did:
Code:
Debsidian:/home/replica# cpufreq-set -f 1.80Ghz
Debsidian:/home/replica# cpufreq-set -d 1.80Ghz
Now everything seems to check out fine.

Code:
Debsidian:/home/replica# cpufreq-info
cpufrequtils 002: cpufreq-info (C) Dominik Brodowski 2004-2006
Report errors and bugs to linux@brodo.de, please.
analyzing CPU 0:
  driver: powernow-k8
  CPUs which need to switch frequency at the same time: 0
  hardware limits: 800 MHz - 1.80 GHz
  available frequency steps: 1.80 GHz, 1.60 GHz, 800 MHz
  available cpufreq governors: powersave, userspace, ondemand, conservative, performance
  current policy: frequency should be within 800 MHz and 1.80 GHz.
                  The governor "userspace" may decide which speed to use
                  within this range.
  current CPU frequency is 1.80 GHz (asserted by call to hardware).
Code:
Debsidian:/home/replica# cat /proc/cpuinfo
processor       : 0
vendor_id       : AuthenticAMD
cpu family      : 15
model           : 36
model name      : AMD Turion(tm) 64 Mobile Technology ML-34
stepping        : 2
cpu MHz         : 1800.000
cache size      : 1024 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 1
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx mmxext fxsr_opt lm 3dnowext 3dnow up pni lahf_lm ts fid vid ttp tm stc
bogomips        : 3585.59
clflush size    : 64
Code:
Debsidian:/home/replica# dmidecode -t processor I find
# dmidecode 2.9
SMBIOS 2.31 present.

Handle 0x0004, DMI type 4, 35 bytes
Processor Information
        Socket Designation: Socket 754
        Type: Central Processor
        Family: Turion 64
        Manufacturer: AMD
        ID: 42 0F 02 00 FF FB 8B 07
        Signature: Family 15, Model 36, Stepping 2
        Flags:
                FPU (Floating-point unit on-chip)
                VME (Virtual mode extension)
                DE (Debugging extension)
                PSE (Page size extension)
                TSC (Time stamp counter)
                MSR (Model specific registers)
                PAE (Physical address extension)
                MCE (Machine check exception)
                CX8 (CMPXCHG8 instruction supported)
                APIC (On-chip APIC hardware supported)
                SEP (Fast system call)
                MTRR (Memory type range registers)
                PGE (Page global enable)
                MCA (Machine check architecture)
                CMOV (Conditional move instruction supported)
                PAT (Page attribute table)
                PSE-36 (36-bit page size extension)
                CLFSH (CLFLUSH instruction supported)
                MMX (MMX technology supported)
                FXSR (Fast floating-point save and restore)
                SSE (Streaming SIMD extensions)
                SSE2 (Streaming SIMD extensions 2)
        Version: Turion 64D Athlon
        Voltage: 3.3 V
        External Clock: 200 MHz
        Max Speed: 1800 MHz
        Current Speed: 1800 MHz
        Status: Populated, Enabled
        Upgrade: ZIF Socket
        L1 Cache Handle: 0x0008
        L2 Cache Handle: 0x0009
        L3 Cache Handle: Not Provided
        Serial Number: Not Specified
        Asset Tag: Not Specified
        Part Number: Not Specified
Hope this helps, or helps someone in the future.
 
Old 10-08-2007, 10:33 PM   #9
replica9000
Senior Member
 
Registered: Jul 2006
Location: USA
Distribution: Debian, FreeBSD, Android
Posts: 1,053
Blog Entries: 2

Rep: Reputation: 227Reputation: 227Reputation: 227
Quote:
Originally Posted by replica9000 View Post
Code:
Debsidian:/home/replica# cpufreq-set -f 1.80Ghz
Debsidian:/home/replica# cpufreq-set -d 1.80Ghz
Turns out that only last till reboot, then it goes back to whatever the powernow-k8 drivers feels like doing. This seems to be something added in kernel 2.6.20 and later...

I did find a script that enables this under /etc/init.d/ called "cpufrequtils". There is a value in there set to ENABLE="true", I changed this to ENABLE="false" and now after a reboot my processor stayes at the max cpu frequency.
 
Old 10-08-2007, 11:01 PM   #10
ghostdancer
Member
 
Registered: Apr 2002
Distribution: Slackware
Posts: 266

Rep: Reputation: 30
This is not a bug nor a problem, it is a feature. It suppose to let your laptop battery last longer.

Speedstep
PowerNow!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to get cpu information on Linux machine laxmi_cs Programming 41 03-05-2013 02:55 AM
CPU information structure alltime Programming 2 10-31-2005 05:58 AM
Processor clock speed vs. CPU speed moxieman99 Linux - General 4 06-24-2005 10:43 AM
howto: control CPU fan speed and Northbridge fan speed? hedpe Linux - Software 2 04-18-2005 02:18 AM
please help guys, wrong cpu speed shown with a regular non-mobile cpu !! : ( maku Linux - Hardware 1 01-02-2005 02:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:31 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration