flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
vid
use RDTSC instruction
|
|||
![]() |
|
MazeGen
Don't know what operating system you use, but note that RDTSC can be privileged instruction on some operating systems. I've read somewhere that it is privileged on some Linux systems. As for win32, I'm not aware of any version which makes it privileged though.
|
|||
![]() |
|
zir_blazer
Got any code example commeted enough to be understandable to begineers? I think that this should be extremely useful for code optimization performance increase results.
|
|||
![]() |
|
f0dder
Making it privileged would be pretty silly, but it's technically possible.
Note that if you time with RDTSC, you'll run into trouble on AMD64 dualcore machines if you don't limit thread affinity to one CPU. Results also tend to vary a fair amount, boosting thread+process priority and looping the code a fair amount of times helps. Also keep in mind that for machines with power-saving features, you need to "warm up the CPU" before you start counting. So ideally, you should study min,max,average,median runtimes of the code snippet, not just "total_cycles / total_iterations". |
|||
![]() |
|
DOS386
http://en.wikipedia.org/wiki/RDTSC
Issues: - Need to detect CPU before executing - Multitasking / Multi-CPU (This problem can be very well bypassed using DOS - only 1 CPU active, only 1 task ![]() ![]() _________________ Bug Nr.: 12345 Title: Hello World program compiles to 100 KB !!! Status: Closed: NOT a Bug |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.