The Halloween Spooktacular Challenge has officially concluded! Congratulations to anyone who made it through. For those curious about what a solution looks like, in this video I do a complete walkthrough of the code.
All-in-all, it is nice to finally have a way to gather PMCs for arbitrary regions in a running program on a vanilla install of Windows. Before I attempted it, I wasn’t sure it was possible. In fact, given the tricks I had to pull to make it work — like the SysCall event pairing tick — it’s not clear to me that Microsoft ever even intended this use case to be possible. So it’s nice to know it is possible, and actually works reasonably well.
That said, due to the convoluted nature of the API, and the contortions I had to do to make this kind of PMC collection work, there are still some notable drawbacks: