RDTSCP from dlang
kookman via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Aug 31 00:34:14 PDT 2016
On Tuesday, 30 August 2016 at 09:04:41 UTC, Basile B. wrote:
> ALternatively to Rikki K's solution, you can do this to mimic
> the rdtscp behavior:
>
> asm
> {
> cpuid;
> rdtsc;
> // store time in locals
> }
> // bench
> {
> rdtsc;
> // store time in locals
> }
> // compute delta
>
>
> explanations here:
> -
> http://www.intel.com/content/dam/www/public/us/en/documents/white-papers/ia-32-ia-64-benchmark-code-execution-paper.pdf
> - http://stackoverflow.com/a/14214220
>
> But according to the first link, this solution, while better
> than rdtsc alone, is not as good as rdtscp.
Indeed, I want to use rdtscp to get access to the core ID it
makes available (to at least know when tsc is from different
cores/packages). I guess in the meantime I can use Rikki's
solution.
Sorry I'm a DMD asm newbie: DO i need to worry about which
registers I clobber here? I couldn't find any info about this on
the Inline Assembly doco page on dlang.org.
More information about the Digitalmars-d-learn
mailing list