[fpc-devel] rdtscp

Nikolay Nikolov nickysn at gmail.com
Sun Oct 22 15:53:28 CEST 2017



On 10/21/2017 10:41 PM, Wolf wrote:
> Hi,
>
> How do you measure time with a one cycle resolution? EpicTimer clearly 
> does not cut it, and from what I gather 
> <https://www.intel.com/content/www/us/en/embedded/training/ia-32-ia-64-benchmark-code-execution-paper.html>, 
> rdtsc cannot do it either. You need to have a CPU capable of 
> understanding rdtscp.
>
> But then, FPC 3.00 does not want to compile this assembly instruction. 
> So how do you guys manage to measure it?

FPC trunk supports rdtscp. And if you're using a FPC version that 
doesn't support an instruction, you can always hardcode it with 'db' 
(make sure you add a comment with the real instruction to keep your code 
readable), e.g:

db 0fh, 01h, 0f9h  { rdtscp - not supported by FPC 3.0's inline assembler }

Nikolay



More information about the fpc-devel mailing list