Martin Hoffesommer's Blog Technical dude. Part time martian.

Enhancements to 'Very Sleepy' C++ CPU profiler

June 5, 2011 · programming/cpp · cppgithubprofiler

I've been using the excellent CPU sampling profiler Very Sleepy for quite a while now. The most recent version however had one serious problem for me: sporadic GetThreadContext failures that resulted in aborting the profiler.

Additionally there were some other improvements I was interested in, and since I couldn't find any public depot for the source I decided to create one at github.

The latest forked version can be downloaded here. It includes the following changes:

  • fixed the sporadic GetThreadContext-related profile abort
  • fixed symbol lookup issues if EXE is started from profiler
  • added option to pause/resume profiling, w/ cmdline option to start profiling paused
  • option to use very fast (but non-FPO-aware) stack walker, profiling rate using this one is >100x faster

Future plans are right now:

  • API to control profiler from profiled program (e.g. to profile only a certain section of code under certain conditions)
  • 'frame based' profiler: have the option to capture a profile multiple times (for example once per 'game frame')