rdtsc /

Filename Size Date modified Message
17 B
1.3 KB
739 B
1.7 KB

  This program shows the number of cycles a piece of code takes, using
  the RDTSC instruction.


  A Pentium processor or better.  The following platforms are

   - Windows 32 bits
   - Unix 32 bits
   - Unix 64 bits
    The Unix versions should at least work on Linux and BSD.  You will
  also need FASM (www.flatassembler.net).


  Find the subdirectory that matches your plateform. There you should
  only need to issue a "make" command to build the main/main.exe
  program.  On Windows you can also type "fasm main.asm".

    The program will display statistics about the code present in
 ``testcode.asm''.  The code contained there can change the content of
 any register except ESP.  When you change the content of this file
 you need to rebuild the program.  You can also change how many times
 the code will be tested (10 by default). On Unix versions you can do
 this by modifying this line in the corresponding main.c file:

      #define NB_TESTS 10

    On Windows, modify this line in main.asm:

      NB_TESTS = 10


  Modern processors can dynamically change their frequency while the
  TSC doesn't. For this reason the results may be inaccurate.  I've
  heard that on AMD processors a MSR allows you to make the TSC change
  its frequency correctly. On Intel processors the only solution seems
  to be using the performance monitoring counters.  On Windows you can
  check the current frequency of the processor with CPU-Z