digitalmars.D.learn - Accessing x86 Performance Counters
- Maxime Chevalier-Boisvert (3/3) May 12 2015 I was wondering if anyone has written D code to access the x86
- Benjamin Thaut (14/17) May 12 2015 I considered doing that at one point. So I looked for resources
- Kagamin (4/4) May 13 2015 There was no word about windows, but process explorer shows page
- Benjamin Thaut (5/9) May 13 2015 He is talking about the performance counters build into intel x86
- CraigDillabaugh (2/12) May 13 2015 That should be "She is talking about ... " :o)
- "Ola Fosheim =?UTF-8?B?R3LDuHN0YWQi?= (4/7) May 13 2015 For linux, you could try:
- John Colvin (5/8) May 13 2015 It would probably be easiest to write some bindings to PAPI-C or
- Dmitri Makarov (8/11) May 13 2015 Intel made available the source of their performance counter
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.
May 12 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.
May 12 2015
There was no word about windows, but process explorer shows page faults and cycles per process from unprivileged account, so I guess, this information is available through some API. Not sure is such system-wide statistics is available too.
May 13 2015
On Wednesday, 13 May 2015 at 08:53:10 UTC, Kagamin wrote:There was no word about windows, but process explorer shows page faults and cycles per process from unprivileged account, so I guess, this information is available through some API. Not sure is such system-wide statistics is available too.He is talking about the performance counters build into intel x86 processors (at least thats what I understood) thats something completely different from page faults and cycles per process. And as it is processor specific there is _no_ general api for it.
May 13 2015
On Wednesday, 13 May 2015 at 09:26:40 UTC, Benjamin Thaut wrote:On Wednesday, 13 May 2015 at 08:53:10 UTC, Kagamin wrote:That should be "She is talking about ... " :o)There was no word about windows, but process explorer shows page faults and cycles per process from unprivileged account, so I guess, this information is available through some API. Not sure is such system-wide statistics is available too.He is talking about the performance counters build into intel x86 processors (at least thats what I understood) thats something completely different from page faults and cycles per process. And as it is processor specific there is _no_ general api for it.
May 13 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.For linux, you could try: https://www.google.no/search?q=perf_events
May 13 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.It would probably be easiest to write some bindings to PAPI-C or similar. As far as I know, DIY hardware performance monitoring isn't worth the effort.
May 13 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.Intel made available the source of their performance counter monitor, which runs as a service and can be interacted with from a client program running in the user space. PAPI is a big API and it would be a lot of work to write bindings in D. Writing a D application that talks to PCM should be fairly straightforward. https://software.intel.com/en-us/articles/intel-performance-counter-monitor
May 13 2015