Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

emmai

how can I get cpu frequency?

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

not via time functions(like GetTickCount,timeGetTime,QueryPerformanceCounter)? any idea is appreciated. my game has a Time Axis that manage the time,but there is a Hack software which name is SpeedGear that Hook the time APIs,so it can change the game''s speed!!! I''d like to anti this SpeedGear,I''m now using intel''s RDTSC instruction to do this,the time that passed by can be calculated by RDTSC/CpuFrequency,so I need know cpu''s frequency,but I can''t do this via time functions,because they might have been hooked that return bigger or smaller value.

Share this post


Link to post
Share on other sites
Advertisement
I don''t think there is any instruction that will ask the CPU what frequency it''s running at. Perhaps the OS might be able to tell you what it thinks it''s running at, I know in Linux you could parse /proc/cpu (or whatever it is, I forget), but for anything else - beats me.

Share this post


Link to post
Share on other sites
QueryPerformanceFrequency() returns the cpu''s frequency with a P4 cpu,but returns a nosense value when using a AMD 2200+ cpu!!!

Share this post


Link to post
Share on other sites
Trying to get the computers exact frequency is not an easy job, because in many cases there is no real answer. Crusoe chips (i.e. many Sony Vaio laptops) change their frequency in realtime to optimize battery usage and heat. PIII and Celeron chips with SpeedStep can change their frequency on command. The P4 automatically throttles its frequency based on heat buildup (that''s why you can remove the heatsink from a P4 without crashing it - it almost instantly drops to 60-70Mhz).

Share this post


Link to post
Share on other sites
it''s sufficient for me is I can get the frequency what state the cpu is running at!

Share this post


Link to post
Share on other sites
I believe the (simplest) way to do this is to simply query the OS for the information, I found an app a while back (may be Windows-specific) called Camel CPU Identifier or something along those lines. It spawned multiple threads in order to get the information about each processor in the system, which may or may not be the best way to do it.

Have you tried alternate methods of countering this SpeedGear software, such as setting your app to crash whenever it detects that SpeedGear has been loaded? (Warning: test thoroughly to ensure no false alarms.)

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!