I've been experimenting with toggling COR_PRF_MONITOR_ENTERLEAVE dynamically, and I'm seeing some bugs in the behavior. If I start up the app with the flag defined, everything is fine. If I start up without the flag and then enable it later, the ELT hooks are not actually invoked for any of the functions in the application. They are called for a number of Framework classes -- I've seen System.Windows.ni.dll show up quite a lot and I assume this is an NGEN /Profile image. I am asking the runtime to add hooks to all functions that come through the function mapper, and I am seeing all of the app's functions go through the mapper. I'm unable to find any bugs in my code that would cause this. The problem is completely and instantly fixed simply by adding MONITOR_ENTERLEAVE in Initialize. Is there something I'm not understanding about how this flag should behave? | | Promit | Hi Promit,
COR_PRF_MONITOR_ENTERLEAVE must be enabled when the functions of your interested are being JITed. Otherwise, there's is no way to add ELT hooks to the JITed functions. FunctionIDMapper allow you to specify whethera given function being JITed needsto support ELT hooks. If you want to received ELT callbacks from mscrolib, your profiler has to enableCOR_PRF_MONITOR_ENTERLEAVE in ICorProfilerCallback::Initialize callback, which will load NGEN /Profile version of mscorliborforce CLR to JIT mscorlib if there is no NGEN /Profile version of mscorlib. Disabling COR_PRF_MONITOR_ENTERLEAVE means you don't want to functions to be JITed later on to support ELT hooks, but it doesn't affect theexisting JITedfunctions.
Thanks, Shane- Marked As Answer byJon LangdonMSFT, OwnerSaturday, August 08, 2009 4:39 PM
-
All RepliesAny thoughts? Should I file something on Connect?
| | Shane Yuan | Hi Promit,
COR_PRF_MONITOR_ENTERLEAVE must be enabled when the functions of your interested are being JITed. Otherwise, there's is no way to add ELT hooks to the JITed functions. FunctionIDMapper allow you to specify whethera given function being JITed needsto support ELT hooks. If you want to received ELT callbacks from mscrolib, your profiler has to enableCOR_PRF_MONITOR_ENTERLEAVE in ICorProfilerCallback::Initialize callback, which will load NGEN /Profile version of mscorliborforce CLR to JIT mscorlib if there is no NGEN /Profile version of mscorlib. Disabling COR_PRF_MONITOR_ENTERLEAVE means you don't want to functions to be JITed later on to support ELT hooks, but it doesn't affect theexisting JITedfunctions.
Thanks, Shane- Marked As Answer byJon LangdonMSFT, OwnerSaturday, August 08, 2009 4:39 PM
-
I see. That doesn't quite match up with how the documentation and blogs describe it, which I took to mean that that value of pbHookFunction in FunctionIDMapper is the only thing that controls whether the ELT hooks are injected. Thanks.
| | Shane Yuan |
|