Very Slow Capture on large Managed C++ project

I am using Ants v4 to profile an app that makes calls into a very large managed c++ project.

There is a particular method I'm calling that exercises quite a bit of this code. The first time I call this method it is taking roughly 40 minutes to profile (this method takes about 10 seconds to run when outside of the profiler). The second time I call the method it is only taking roughly a minute to profile.

When I initially ran these tests with the profiler it said that virtually all of the time was being taken in JIT Overhead.

This makes sense as there is a lot of code to JIT. However, I've compiled the bytecode with ngen (with profiler scenario turned on) and it still takes just as long. But the method that now takes all of the time is <Module>._initterm_m(void**()* pfbegin, void* *()* pfend).

Do you have any tips on how I can speed this up? Or possibly start profiling after this initial load? It's almost impossible to use the profiler in this situation...


  • Hi,

    You can change the level of profiling in the opening dialog to reduce overhead - line level which is the default can also be the most expensive although the case you describe is extreme by the sounds of it.

    Switch to the 'Method Level Timing; only methods with source' profiling mode and it should improve.

  • I have tried that and it makes very little difference. I've just installed an old ants v3 build and tried using that. When I disable profiling the first time I call the method, then enable it the second time, everything works fine and it takes about 30 seconds....
  • That's a bit strange then.

    I'll check with the developer tomorrow for possible explanations for this and get back to you.


  • Hi,

    could you try one thing for me - delete all the PDB files of anything which you are not interested in seeing the source code for and then trying to line-level profile again.


Sign In or Register to comment.