how do i get the computer speed in Ghz in assembly

Recommended Answers

All 3 Replies

You will basically have to come up with a code to test the frequency of the processor, which is basically a while loop that counts the clocks within a time frame. To find the frequency of older processors such as the 80386 which does not have the RDTSC instruction, will be a bit more trivial. In all cases you will need to indentify the family of the processor with CPUID instruction to make results more accurate. So get creative because there is no instruction that will give you this frequency.

This little app might be usefull. although it also contains some Delphi, the core is written in assembly. Here's another one.


If your target CPU is using Intel SpeedStep technology or some kind of PST, ODCM technology then the speed will be varying over time and although you can access the adjusted speed too, the best and easiest way is to use the difference of RDTSC opcode's return value for a fixed amount of time.

Loren Soth

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.