tommyk tommyk - 14 days ago 8
C++ Question

How to profile a GUI application with a message queue?

I would like to profile a GUI application that uses a message queue. In the profiler results window I see that 80% of the samples are within message loop handling code. Is it possible to filter out the results somehow that I only see the code I can influence?

I am using Visual Studio 2013 C++ profiler.

Answer

What I might do is take each event handler and put a temporary outer loop in it, to make it take a lot longer than it normally would. It needs to run long enough that manual sampling can be used.

This allows finding any possible speedups in the event handlers. After those are fixed, the outer loops are removed, and the code flies!