Anonymous - 2011-11-30

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++:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa363696(v=VS.85).aspx

This page briefly discusses the EVENT_TRACE_FLAG_PROFILE which controls the (default 1 KHz) sampling profiler in ETW:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa363784(v=vs.85).aspx

If this sounds interesting, contact me at valvesoftware.com, e-mail alias bruced.