Note that program-counter-samplers can tell you WHAT is going wrong, but
not WHY.
Some years ago, I wrote an incredibly efficient storage allocator. On a
uniprocessor, we could have had the compiler expand the allocation call
inline, because it was faster to allocate directly than to call the
allocator (remember, we were running on 1 MIPS machines in those days).
The compiler group came to me and said that my allocator was far, far too
slow, and was unusable. To prove this, they showed me the PC-sample run
on Unix. Yes, the gigantic spike was the storage allocator.
So I started up their test, but reached in with the debugger and turned on
a couple internal counters I had in the allocator. Yes, the storage
allocator was the most-used piece of code. On the other hand, there were
2,000,000+ allocate requests and the matching 2,000,000+ release requests.
So I then set some breakpoints, and traced it back by the return address
(we had no source debugger, just to add to the fun). I found an internal
loop that generated all these requests. I recoded it to do just one
allocation per call, and the number of allocations dropped to under
300,000, and the storage allocator was not the problem. Performance data
is always suspect unless you truly understand what it is telling you.
joe
Thanks for your response Daniel.
I already looked at that driver, and unfortunately it only reads total
event counts. It doesn’t provide the program counter and PID/TID for each
event. That would require an interrupt handler for the hardware event and
streaming those values to user space.
I looked at the PAPI project and apparently they once had something that
supported this for 32-bit Windows XP on only one CPU core years ago, but
no longer.
So I guess the consensus is that I must build such a driver myself? No
built-in Windows support, and no driver + user space interface publicly
available on Windows?
Thanks,
David
NTDEV is sponsored by OSR
Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
OSR is HIRING!! See http://www.osr.com/careers
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer