ICorProfilerCallback Interface
Provides methods that are used by the common language runtime (CLR) to notify a code profiler when the events to which the profiler has subscribed occur.
interface ICorProfilerCallback : IUnknown
{
HRESULT Initialize(
[in] IUnknown *pICorProfilerInfoUnk);
HRESULT Shutdown();
HRESULT AppDomainCreationStarted(
[in] AppDomainID appDomainId);
HRESULT AppDomainCreationFinished(
[in] AppDomainID appDomainId,
[in] HRESULT hrStatus);
HRESULT AppDomainShutdownStarted(
[in] AppDomainID appDomainId);
HRESULT AppDomainShutdownFinished(
[in] AppDomainID appDomainId,
[in] HRESULT hrStatus);
HRESULT AssemblyLoadStarted(
[in] AssemblyID assemblyId);
HRESULT AssemblyLoadFinished(
[in] AssemblyID assemblyId,
[in] HRESULT hrStatus);
HRESULT AssemblyUnloadStarted(
[in] AssemblyID assemblyId);
HRESULT AssemblyUnloadFinished(
[in] AssemblyID assemblyId,
[in] HRESULT hrStatus);
HRESULT ModuleLoadStarted(
[in] ModuleID moduleId);
HRESULT ModuleLoadFinished(
[in] ModuleID moduleId,
[in] HRESULT hrStatus);
HRESULT ModuleUnloadStarted(
[in] ModuleID moduleId);
HRESULT ModuleUnloadFinished(
[in] ModuleID moduleId,
[in] HRESULT hrStatus);
HRESULT ModuleAttachedToAssembly(
[in] ModuleID moduleId,
[in] AssemblyID AssemblyId);
HRESULT ClassLoadStarted(
[in] ClassID classId);
HRESULT ClassLoadFinished(
[in] ClassID classId,
[in] HRESULT hrStatus);
HRESULT ClassUnloadStarted(
[in] ClassID classId);
HRESULT ClassUnloadFinished(
[in] ClassID classId,
[in] HRESULT hrStatus);
HRESULT FunctionUnloadStarted(
[in] FunctionID functionId);
HRESULT JITCompilationStarted(
[in] FunctionID functionId,
[in] BOOL fIsSafeToBlock);
HRESULT JITCompilationFinished(
[in] FunctionID functionId,
[in] HRESULT hrStatus,
[in] BOOL fIsSafeToBlock);
HRESULT JITCachedFunctionSearchStarted(
[in] FunctionID functionId,
[out] BOOL *pbUseCachedFunction);
HRESULT JITCachedFunctionSearchFinished(
[in] FunctionID functionId,
[in] COR_PRF_JIT_CACHE result);
HRESULT JITFunctionPitched(
[in] FunctionID functionId);
HRESULT JITInlining(
[in] FunctionID callerId,
[in] FunctionID calleeId,
[out] BOOL *pfShouldInline);
HRESULT ThreadDestroyed(
[in] ThreadID threadId);
HRESULT ThreadAssignedToOSThread(
[in] ThreadID managedThreadId,
[in] DWORD osThreadId);
HRESULT RemotingClientInvocationStarted();
HRESULT RemotingClientSendingMessage(
[in] GUID *pCookie,
[in] BOOL fIsAsync);
HRESULT RemotingClientReceivingReply(
[in] GUID *pCookie,
[in] BOOL fIsAsync);
HRESULT RemotingClientInvocationFinished();
HRESULT RemotingServerReceivingMessage(
[in] GUID *pCookie,
[in] BOOL fIsAsync);
HRESULT RemotingServerInvocationStarted();
HRESULT RemotingServerInvocationReturned();
HRESULT RemotingServerSendingReply(
[in] GUID *pCookie,
[in] BOOL fIsAsync);
HRESULT UnmanagedToManagedTransition(
[in] FunctionID functionId,
[in] COR_PRF_TRANSITION_REASON reason);
HRESULT ManagedToUnmanagedTransition(
[in] FunctionID functionId,
[in] COR_PRF_TRANSITION_REASON reason);
HRESULT RuntimeSuspendStarted(
[in] COR_PRF_SUSPEND_REASON suspendReason);
HRESULT RuntimeSuspendFinished();
HRESULT RuntimeSuspendAborted();
HRESULT RuntimeResumeStarted();
HRESULT RuntimeResumeFinished();
HRESULT RuntimeThreadSuspended(
[in] ThreadID threadId);
HRESULT RuntimeThreadResumed(
[in] ThreadID threadId);
HRESULT MovedReferences(
[in] ULONG cMovedObjectIDRanges,
[in, size_is(cMovedObjectIDRanges)] ObjectID oldObjectIDRangeStart[] ,
[in, size_is(cMovedObjectIDRanges)] ObjectID newObjectIDRangeStart[] ,
[in, size_is(cMovedObjectIDRanges)] ULONG cObjectIDRangeLength[] );
HRESULT ObjectAllocated(
[in] ObjectID objectId,
[in] ClassID classId);
HRESULT ObjectsAllocatedByClass(
[in] ULONG cClassCount,
[in, size_is(cClassCount)] ClassID classIds[] ,
[in, size_is(cClassCount)] ULONG cObjects[] );
HRESULT ObjectReferences(
[in] ObjectID objectId,
[in] ClassID classId,
[in] ULONG cObjectRefs,
[in, size_is(cObjectRefs)] ObjectID objectRefIds[] );
HRESULT RootReferences(
[in] ULONG cRootRefs,
[in, size_is(cRootRefs)] ObjectID rootRefIds[] );
HRESULT ExceptionThrown(
[in] ObjectID thrownObjectId);
HRESULT ExceptionSearchFunctionEnter(
[in] FunctionID functionId);
HRESULT ExceptionSearchFunctionLeave();
HRESULT ExceptionSearchFilterEnter(
[in] FunctionID functionId);
HRESULT ExceptionSearchFilterLeave();
HRESULT ExceptionSearchCatcherFound(
[in] FunctionID functionId);
HRESULT ExceptionOSHandlerEnter(
[in] UINT_PTR __unused);
HRESULT ExceptionOSHandlerLeave(
[in] UINT_PTR __unused);
HRESULT ExceptionUnwindFunctionEnter(
[in] FunctionID functionId);
HRESULT ExceptionUnwindFunctionLeave();
HRESULT ExceptionUnwindFinallyEnter(
[in] FunctionID functionId);
HRESULT ExceptionUnwindFinallyLeave();
HRESULT ExceptionCatcherEnter(
[in] FunctionID functionId,
[in] ObjectID objectId);
HRESULT ExceptionCatcherLeave();
HRESULT COMClassicVTableCreated(
[in] ClassID wrappedClassId,
[in] REFGUID implementedIID,
[in] void *pVTable,
[in] ULONG cSlots);
HRESULT COMClassicVTableDestroyed(
[in] ClassID wrappedClassId,
[in] REFGUID implementedIID,
[in] void *pVTable);
HRESULT ExceptionCLRCatcherFound();
HRESULT ExceptionCLRCatcherExecute();
}
Methods
Method | Description |
---|---|
Notifies the profiler that an application domain has been created. |
|
Notifies the profiler that an application domain is being created. |
|
Notifies the profiler that an application domain has been unloaded from a process. |
|
Notifies the profiler that an application domain is being unloaded from a process. |
|
Notifies the profiler that an assembly has finished loading. |
|
Notifies the profiler that an assembly is being loaded. |
|
Notifies the profiler that an assembly has been unloaded. |
|
Notifies the profiler that an assembly is being unloaded. |
|
Notifies the profiler that a class has finished loading. |
|
Notifies the profiler that a class is being loaded. |
|
Notifies the profiler that a class has finished unloading. |
|
Notifies the profiler that a class is being unloaded. |
|
Notifies the profiler that a runtime callable wrapper (RCW) for the specified IID and class has been created. |
|
Notifies the profiler that an RCW is being destroyed. |
|
Notifies the profiler that control is being passed to the appropriate catch block. |
|
Notifies the profiler that control is being passed out of the appropriate catch block. |
|
Obsolete in the .NET Framework version 2.0. |
|
Obsolete in the .NET Framework 2.0. |
|
Not implemented. A profiler that needs unmanaged exception information must obtain this information through other means. |
|
Not implemented. A profiler that needs unmanaged exception information must obtain this information through other means. |
|
Notifies the profiler that the search phase of exception handling has located a handler for the exception that was thrown. |
|
Notifies the profiler that a user filter is being executed. |
|
Notifies the profiler that a user filter has just finished executing. |
|
Notifies the profiler that the search phase of exception handling has entered a function. |
|
Notifies the profiler that the search phase of exception handling has finished searching a function. |
|
Notifies the profiler that an exception has been thrown. |
|
Notifies the profiler that the unwind phase of exception handling is entering a finally clause contained in the specified function. |
|
Notifies the profiler that the unwind phase of exception handling has left a finally clause. |
|
Notifies the profiler that the unwind phase of exception handling has entered a function. |
|
Notifies the profiler that the unwind phase of exception handling has finished unwinding a function. |
|
Notifies the profiler that the runtime has started to unload a function. |
|
Called to initialize the profiler whenever a new CLR application is started. |
|
ICorProfilerCallback::JITCachedFunctionSearchFinished Method |
Notifies the profiler that a search has finished for a function that was compiled previously using NGen.exe. |
Notifies the profiler that a search has started for a function that was compiled previously using NGen.exe. |
|
Notifies the profiler that the JIT compiler has finished compiling a function. |
|
Notifies the profiler that the just-in-time (JIT) compiler has started to compile a function. |
|
Notifies the profiler that a function that has been JIT-compiled has been removed from memory. |
|
Notifies the profiler that the JIT compiler is about to insert a function in line with another function. |
|
Notifies the profiler that a transition from managed code to unmanaged code has occurred. |
|
Notifies the profiler that a module is being attached to its parent assembly. |
|
Notifies the profiler that a module has finished loading. |
|
Notifies the profiler that a module is being loaded. |
|
Notifies the profiler that a module has finished unloading. |
|
Notifies the profiler that a module is being unloaded. |
|
Notifies the profiler about object references that were moved during garbage collection. |
|
Notifies the profiler that memory within the heap has been allocated for an object. |
|
Notifies the profiler about objects in memory referenced by the specified object. |
|
Notifies the profiler about the number of instances of each specified class that have been created since the previous garbage collection. |
|
ICorProfilerCallback::RemotingClientInvocationFinished Method |
Notifies the profiler that a remoting call has run to completion on the client. |
ICorProfilerCallback::RemotingClientInvocationStarted Method |
Notifies the profiler that a remoting call has started. |
Notifies the profiler that the server-side portion of a remoting call has completed and the client is now receiving and about to process the reply. |
|
Notifies the profiler that the client is sending a request to the server. |
|
ICorProfilerCallback::RemotingServerInvocationReturned Method |
Notifies the profiler that the process has finished invoking a method in response to a remote method invocation request. |
ICorProfilerCallback::RemotingServerInvocationStarted Method |
Notifies the profiler that the process is invoking a method in response to a remote method invocation request. |
Notifies the profiler that the process is receiving a remote method invocation or activation request. |
|
Notifies the profiler that the process has finished processing a remote method invocation request and is about to transmit the reply through a channel. |
|
Notifies the profiler with information about root references after garbage collection. |
|
Notifies the profiler that the runtime has resumed all runtime threads and has returned to normal operation. |
|
Notifies the profiler that the runtime is resuming all run-time threads. |
|
Notifies the profiler that the runtime has aborted the run-time suspension that was occurring. |
|
Notifies the profiler that the runtime has completed suspension of all run-time threads. |
|
Notifies the profiler that the runtime is about to suspend all run-time threads. |
|
Notifies the profiler that the specified thread has resumed after being suspended. |
|
Notifies the profiler that the specified thread has been, or is about to be, suspended. |
|
Notifies the profiler that the application is shutting down. |
|
Notifies the profiler that a managed thread is being implemented using a particular operating system (OS) thread. |
|
Notifies the profiler that a thread has been created. |
|
Notifies the profiler that a thread has been destroyed. |
|
Notifies the profiler that a transition from unmanaged code to managed code has occurred. |
Remarks
The CLR calls a method in the ICorProfilerCallback (or ICorProfilerCallback2 Interface) interface to notify the profiler when an event, to which the profiler has subscribed, occurs. This is the primary callback interface through which the CLR communicates with the code profiler.
A code profiler must implement the methods of the ICorProfilerCallback interface. For the .NET Framework version 2.0, the profiler must also implement the ICorProfilerCallback2 methods. Each method implementation must return an HRESULT that has a value of S_OK on success or E_FAIL on failure. Currently, the CLR ignores the HRESULT that is returned by each callback except ICorProfilerCallback::ObjectReferences Method.
In the Microsoft Windows registry, a code profiler must register its Component Object Model (COM) object that implements the ICorProfilerCallback and ICorProfilerCallback2 interfaces. A code profiler subscribes to the events for which it wants to receive notification by calling ICorProfilerInfo::SetEventMask Method. This is usually done in the profiler's implementation of ICorProfilerCallback::Initialize Method. The profiler is then able to receive notification from the runtime when an event is about to occur or has just occurred in an executing runtime process.
Note
The profiler registers a single COM object. If the profiler is targeting the .NET Framework version 1.x, that COM object needs to implement only the methods of ICorProfilerCallback. If it is targeting .NET Framework version 2.0, the COM object must also implement the methods of ICorProfilerCallback2.
Requirements
Platforms: Windows 2000, Windows XP, Windows Server 2003 family
Header: CorProf.idl
Library: CorGuids.lib
.NET Framework Version: 2.0, 1.1, 1.0
See Also
Reference
ICorProfilerCallback2 Interface