Am Saturday 23 October 2010 schrieben Sie:
> On Mon, 18 Oct 2010 14:36:01 +0000, Rolf Eike Beer said:
> >While hacking on gathering system information on QNX (currently completely
> >missing) I found this in SystemInformationImplementation::ParseSysCtl() in
> >
> >source/kwsys/SystemInformation.cxx:
> >  this->CPUSpeedInMHz = static_cast< float >( value )/ 1048576;
> >
> >From what I can find on the web the output is in Hz so it should be
> >divided by 1000000, no?
> 
> I agree, looks like a copy-paste bug.  Indeed, the clock is wrong on our
> dashboards, ex:
> <http://www.cdash.org/CDash/viewSite.php?
> siteid=1987&project=1&currenttime=1287795600>
> 
> Will you submit a bug/patch?

Attached. Fixes the same bug for old x86 processors.

Bill, David, will you pick this up for 2.8.3?

Eike
From cd3a5051ed01d044d7faa8bbf8642e57010813f0 Mon Sep 17 00:00:00 2001
From: Rolf Eike Beer <[email protected]>
Date: Sun, 24 Oct 2010 12:31:11 +0200
Subject: [PATCH] Fix CPU speed calculations

To get from Hz to MHz the factor is 10^6, not 2^20.
---
 Source/kwsys/SystemInformation.cxx |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx
index 936c1f7..dbd9786 100644
--- a/Source/kwsys/SystemInformation.cxx
+++ b/Source/kwsys/SystemInformation.cxx
@@ -1546,17 +1546,17 @@ bool SystemInformationImplementation::RetrieveClassicalCPUClockSpeed()
   if (this->ChipID.Family == 3) 
     {
     // 80386 processors....  Loop time is 115 cycles!
-    dFrequency = (((CLASSICAL_CPU_FREQ_LOOP * 115) / dDifference) / 1048576);
+    dFrequency = (((CLASSICAL_CPU_FREQ_LOOP * 115) / dDifference) / 1000000);
     } 
   else if (this->ChipID.Family == 4) 
     {
     // 80486 processors....  Loop time is 47 cycles!
-    dFrequency = (((CLASSICAL_CPU_FREQ_LOOP * 47) / dDifference) / 1048576);
+    dFrequency = (((CLASSICAL_CPU_FREQ_LOOP * 47) / dDifference) / 1000000);
     } 
   else if (this->ChipID.Family == 5) 
     {
     // Pentium processors....  Loop time is 43 cycles!
-    dFrequency = (((CLASSICAL_CPU_FREQ_LOOP * 43) / dDifference) / 1048576);
+    dFrequency = (((CLASSICAL_CPU_FREQ_LOOP * 43) / dDifference) / 1000000);
     }
   
   // Save the clock speed.
@@ -2945,7 +2945,7 @@ bool SystemInformationImplementation::ParseSysCtl()
 
   len = sizeof(value);
   sysctlbyname("hw.cpufrequency", &value, &len, NULL, 0);
-  this->CPUSpeedInMHz = static_cast< float >( value )/ 1048576;
+  this->CPUSpeedInMHz = static_cast< float >( value )/ 1000000;
 
 
   // Chip family
-- 
1.7.1

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to