NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Enabling Profiling

A code profiler is a software tool, implemented as a DLL, that is called by the Runtime, during execution of an image – the profiler receives notifications of ‘interesting’ events such as each time a function is entered or exited. By gathering statistics on these events, the profiler tool can build a comprehensive picture of which routines burned most cpu time, when garbage collections occured, exceptions thrown, etc, etc.

‘Connecting’ to a profiler is only done during the initialization phase for the Runtime within each process. In this phase, it checks two environment variables to determine:

If Cor_Enable_Profiling does not exist, or is set to the value 0, the Runtime will make no attempts to ‘connect’ to a profiler.

If Cor_Enable_Profiling has the value 1, the Runtime will attempt to ‘connect’ to the profiler whose CLSID is specified in the Cor_Profiler string. For example:

set Cor_Profiler={32E2F4DA-1BEA-47ea-88F9-C5DAF691C94A}

Then the Runtime will ‘connect’ with the DLL, by instantiating the COM class with that CLSID – the class must implement the ICorProfilerCallback interface (used to receive notifications from the Runtime, during execution, of ‘interesting’ events, such as function enters and leaves)