Currently Luke Stackwalker uses SuspendThread/GetContext/ResumeThread to do sampling. This has a number of problems, including the documented issue that it can't distinguish between a thread that is waiting on WaitForSingleObject and a thread that is spinning calling it. There are also some other issues.
The sampling would work much better if ETW was used. This would require Vista+ but would dramatically improve the quality.
This page discusses the ControlTrace function which is one of the functions used to control ETW tracing from C++:
This page briefly discusses the EVENT_TRACE_FLAG_PROFILE which controls the (default 1 KHz) sampling profiler in ETW:
If this sounds interesting, contact me at valvesoftware.com, e-mail alias bruced.
Log in to post a comment.