# Cpu speed detection

This topic is 5110 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hej, I have a few questions: - How do I determine the speed of a processor? - Are there 3d game engines that use dual processing? Bas

##### Share on other sites
Hi! This is from page www.borland.nq.pl:
const DelayTime = 500;DWORD TimerHi, TimerLo;Integer PriorityClass, Priority;PriorityClass = GetPriorityClass(GetCurrentProcess());Priority      = GetThreadPriority(GetCurrentThread());SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS);SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);Sleep(10);asm{  dw 310Fh  mov TimerLo, eax  mov TimerHi, edx}Sleep(DelayTime);asm{   dw 310Fh  sub eax, TimerLo  sbb edx, TimerHi  mov TimerLo, eax  mov TimerHi, edx}SetThreadPriority(GetCurrentThread, Priority);SetPriorityClass(GetCurrentProcess, PriorityClass);int CPUSpeed = TimerLo / (1000 * DelayTime);

The result is in Mhz. You should do this code more than once and make an average.

##### Share on other sites
Tnx guys, you really helped my out.

##### Share on other sites
@GraphicsBas:
This post is completely off-topic for the DirectX forum.

@Pipo:
Why didn't you tell him? [smile]

@gregory:

##### Share on other sites
In every case, remember that Centrino processor have less mhz but the same horsepower of higher mhz processor. Mhz aren't an accurate way to determine the real CPU power: at least, they are a way only inside a same family of processors. Just to be sure. :)

##### Share on other sites
Quote:
 Original post by Coder@Pipo:Why didn't you tell him? [smile]

I'm not the one with a pinkred tag. [lol] Nah I just focused on helping him, and not on helping, you. [lol]

##### Share on other sites
Quote:
 Original post by Anonymous PosterIn every case, remember that Centrino processor have less mhz but the same horsepower of higher mhz processor. Mhz aren't an accurate way to determine the real CPU power: at least, they are a way only inside a same family of processors. Just to be sure. :)

It also needs to be considered that a number of processors will not give you a constant clockrate. AMD for example advertises it's mobile speedstep type technology to be able to adjust CPU speed over 30 times a second in response to changing demands. Combined with CPU speed not mattering (Pentium M is an extreme example, but many of AMDs processors also run at a much lower clockrate while deliverying the same preformance) there just isn't any reason to measure CPU speed unless you are reporting it directly to the user. The commands used in the example source code are really meant to be used for profiling code on a development machine, not as an accurate timer for events.

1. 1
2. 2
frob
16
3. 3
4. 4
5. 5

• 17
• 13
• 14
• 76
• 22
• ### Forum Statistics

• Total Topics
632148
• Total Posts
3004359

×