PDA

View Full Version : [Delphi7] How to get current cpu frequency?


Atak_Snajpera
12th October 2011, 16:06
jvComputerInfo only returns default frequency.
http://i.imgur.com/Yqzpr.png

and this what i'm looking for
http://i.imgur.com/4UwAK.png

As you can see in idle mode cpu frequency is lowered to 2GHz.

LoRd_MuldeR
12th October 2011, 20:19
This is how cpuinfo (http://oss.netfarm.it/mplayer/misc/cpuinfo.exe) detects the MHz:
http://repo.or.cz/w/mplayer.git/blob/HEAD:/cpuinfo.c#l334

LoRd_MuldeR
12th October 2011, 21:43
In MSVC you could use something like this:
http://pastie.org/private/unq5uir8vlomg07673q5oq

Atak_Snajpera
13th October 2011, 12:18
I've tried all these methods and I always get default 3Ghz
http://www.knowledgesutra.com/forums/topic/35569-get-cpu-speed-with-dephi-and-assembler/

BTW. I have another question regarding jvComputerInfo.

Why ProcessorCount = 4 instead of 1 ?
If i'm not mistaken ProcessorCount means number of CPUs on mainboard, right?
PhysicalCores = Physical Cores ;)
LogicalCores = All ALUs (including HT cores)

LoRd_MuldeR
13th October 2011, 13:44
For the software "Processor" is equivalent to "Processor Core".

After all, a multi-core processor is nothing but several fully-fledged processors housed in a single chip package.

And the software generally shouldn't see any difference between CPU cores connected to the same socket and CPU cores connected to different sockets.

(In reality things aren't that easy though. Especially in HPC applications, with multi-socket systems and multiple cores on each socket, CPU affinity can matter a lot)

Also, I wouldn't use the term ALU here. The ALU is only one component of a processor (core). And a single processor may contain several ALU's. For example this will be required to handle SIMD instructions without delay. Finally one ALU/FPU may be shared by several CPU "cores" - think of "Bulldozer" (or, in a way, Hyperthreading)

Atak_Snajpera
28th October 2011, 13:03
Good news! I found a way to get real current cpu speed like CPU-Z. This method uses WMI (Windows Management Instrumentation)

Delphi source -> Download (http://www.mediafire.com/?nk1x5sn4dhg2dzy)