Accessing x86 Performance Counters
Benjamin Thaut via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue May 12 23:47:11 PDT 2015
On Wednesday, 13 May 2015 at 03:38:33 UTC, Maxime
Chevalier-Boisvert wrote:
> I was wondering if anyone has written D code to access the x86
> performance counters, to get information such as the number of
> cache misses and cycle count.
I considered doing that at one point. So I looked for resources
on the topic and it turns out that you need a kernel mode
executable to be able to read the performance counters. Luckly
there is a open source driver for windows which gives you some
API to access the counters from user mode executables.
Unfortunately you need to either switch your windows into a
"unsafe mode" to allow for loading unsigned drivers or you need
to somehow get a certificate to sign the driver (these are quite
expensive). At that point I stopped looking into this, because
both of these options weren't viable for my use case. Once I find
some time I could dig up the resources I found if you are
interested.
More information about the Digitalmars-d-learn
mailing list