January 20, 2004
Some times a little information is a dangerous thing.
After upgrading to 10.2.8 on my Powerbook (eeyore) I discovered the 'sysctl' command. Among other things it purports to report the CPU frequency of the machine. You do this by issuing this command:
Only the output may upset you. It certainly did me. I have a 867 MHz G4 but sysctl reported my CPU frequency as 667000000. A difference of 200 MHz or about 23%. Not cool. Further investigation into the matter had me reseting my PMU every time I had to restart my laptop. You see after reseting the PMU (and reseting the clock from 12/31/1969 each time) sysctl would return a beautiful 867000000 for cpuFrequency.
Not being happy with this situation I have been searching for clarification about this problem and a fix to make it go away. Yesterday, thanks to live journal thread on cpu frequency I think I found out what is happening. Moreover, I have confidence that my understanding is now the truth.
The hw.cpufrequency is an undocumented parameter of the sysctl command. Its results are not accurate. With the help of the XCode developer's disk included in 10.3 (Panther) I installed the Skidmark GT benchmark tool yesterday. Upon running it with sysctl reporting 867 as the cpu frequency I got benchmarks of 86, 86, and 86 for Integer, Floating Point, and Vector.
Rebooting and not reseting the PMU results in sysctl showing 667 once again. Running Skidmark again I got 86, 86, and 86. Skidmark rates a 1.0 GHz CPU at 100, so values of 86 would be correct for a 867 MHz processor.
In other words, if you have been chasing after the solution to the sysctl hw.cpufrequency "bug" like I have, you can stop. Hw.cpufrequency is undocumented and returns a false value for G4 processors. If you have 10.3, put the XCode CD in your machine and install the Skidmark GT tool (it's part of the CHUD benchmarking package) and use it to evaluate your machine's performance.