ICorProfilerCallback 接口ICorProfilerCallback Interface

提供公共语言运行时(CLR)用于在探查器订阅的事件发生时通知代码探查器的方法。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.

方法Methods

方法Method 说明Description
AppDomainCreationFinished 方法AppDomainCreationFinished Method 通知探查器已创建应用程序域。Notifies the profiler that an application domain has been created.
AppDomainCreationStarted 方法AppDomainCreationStarted Method 通知探查器正在创建应用程序域。Notifies the profiler that an application domain is being created.
AppDomainShutdownFinished 方法AppDomainShutdownFinished Method 通知探查器已从进程中卸载应用程序域。Notifies the profiler that an application domain has been unloaded from a process.
AppDomainShutdownStarted 方法AppDomainShutdownStarted Method 通知探查器正在从进程中卸载应用程序域。Notifies the profiler that an application domain is being unloaded from a process.
AssemblyLoadFinished 方法AssemblyLoadFinished Method 通知探查器程序集已完成加载。Notifies the profiler that an assembly has finished loading.
AssemblyLoadStarted 方法AssemblyLoadStarted Method 通知探查器正在加载程序集。Notifies the profiler that an assembly is being loaded.
AssemblyUnloadFinished 方法AssemblyUnloadFinished Method 通知探查器已卸载程序集。Notifies the profiler that an assembly has been unloaded.
AssemblyUnloadStarted 方法AssemblyUnloadStarted Method 通知探查器正在卸载程序集。Notifies the profiler that an assembly is being unloaded.
ClassLoadFinished 方法ClassLoadFinished Method 通知探查器类已经完成加载。Notifies the profiler that a class has finished loading.
ClassLoadStarted 方法ClassLoadStarted Method 通知探查器正在加载某个类。Notifies the profiler that a class is being loaded.
ClassUnloadFinished 方法ClassUnloadFinished Method 通知探查器类已经完成卸载。Notifies the profiler that a class has finished unloading.
ClassUnloadStarted 方法ClassUnloadStarted Method 通知探查器正在卸载某个类。Notifies the profiler that a class is being unloaded.
COMClassicVTableCreated 方法COMClassicVTableCreated Method 通知探查器已创建指定 IID 和类的运行时可调用包装(RCW)。Notifies the profiler that a runtime callable wrapper (RCW) for the specified IID and class has been created.
COMClassicVTableDestroyed 方法COMClassicVTableDestroyed Method 通知探查器正在销毁某个 RCW。Notifies the profiler that an RCW is being destroyed.
ExceptionCatcherEnter 方法ExceptionCatcherEnter Method 通知探查器控制正在传递到适当的 catch 块。Notifies the profiler that control is being passed to the appropriate catch block.
ExceptionCatcherLeave 方法ExceptionCatcherLeave Method 通知探查器控制正在传递到适当的 catch 块。Notifies the profiler that control is being passed out of the appropriate catch block.
ExceptionCLRCatcherExecute 方法ExceptionCLRCatcherExecute Method 在 .NET Framework 版本2.0 中已过时。Obsolete in the .NET Framework version 2.0.
ExceptionCLRCatcherFound 方法ExceptionCLRCatcherFound Method 在 .NET Framework 2.0 中已过时。Obsolete in the .NET Framework 2.0.
ExceptionOSHandlerEnter 方法ExceptionOSHandlerEnter Method 未实现。Not implemented. 需要非托管异常信息的探查器必须通过其他方式获取此信息。A profiler that needs unmanaged exception information must obtain this information through other means.
ExceptionOSHandlerLeave 方法ExceptionOSHandlerLeave Method 未实现。Not implemented. 需要非托管异常信息的探查器必须通过其他方式获取此信息。A profiler that needs unmanaged exception information must obtain this information through other means.
ExceptionSearchCatcherFound 方法ExceptionSearchCatcherFound Method 通知探查器,异常处理的搜索阶段已找到引发的异常的处理程序。Notifies the profiler that the search phase of exception handling has located a handler for the exception that was thrown.
ExceptionSearchFilterEnter 方法ExceptionSearchFilterEnter Method 通知探查器正在执行用户筛选器。Notifies the profiler that a user filter is being executed.
ExceptionSearchFilterLeave 方法ExceptionSearchFilterLeave Method 通知探查器用户筛选器刚刚执行完毕。Notifies the profiler that a user filter has just finished executing.
ExceptionSearchFunctionEnter 方法ExceptionSearchFunctionEnter Method 通知探查器异常处理的搜索阶段已输入一个函数。Notifies the profiler that the search phase of exception handling has entered a function.
ExceptionSearchFunctionLeave 方法ExceptionSearchFunctionLeave Method 通知探查器异常处理的搜索阶段已经完成了对函数的搜索。Notifies the profiler that the search phase of exception handling has finished searching a function.
ExceptionThrown 方法ExceptionThrown Method 通知探查器引发了异常。Notifies the profiler that an exception has been thrown.
ExceptionUnwindFinallyEnter 方法ExceptionUnwindFinallyEnter Method 通知探查器异常处理的展开阶段正在输入 finally 指定函数中包含的子句。Notifies the profiler that the unwind phase of exception handling is entering a finally clause contained in the specified function.
ExceptionUnwindFinallyLeave 方法ExceptionUnwindFinallyLeave Method 通知探查器异常处理的展开阶段已离开 finally 子句。Notifies the profiler that the unwind phase of exception handling has left a finally clause.
ExceptionUnwindFunctionEnter 方法ExceptionUnwindFunctionEnter Method 通知探查器异常处理的展开阶段已输入一个函数。Notifies the profiler that the unwind phase of exception handling has entered a function.
ExceptionUnwindFunctionLeave 方法ExceptionUnwindFunctionLeave Method 通知探查器异常处理的展开阶段已完成展开某个函数。Notifies the profiler that the unwind phase of exception handling has finished unwinding a function.
FunctionUnloadStarted 方法FunctionUnloadStarted Method 通知探查器运行时已开始卸载某个函数。Notifies the profiler that the runtime has started to unload a function.
Initialize 方法Initialize Method 调用以在新的 CLR 应用程序启动时初始化探查器。Called to initialize the profiler whenever a new CLR application is started.
JITCachedFunctionSearchFinished 方法JITCachedFunctionSearchFinished Method 通知探查器搜索已完成以前使用 Ngen.exe 编译的函数。Notifies the profiler that a search has finished for a function that was compiled previously using NGen.exe.
JITCachedFunctionSearchStarted 方法JITCachedFunctionSearchStarted Method 通知探查器已开始搜索先前使用 Ngen.exe 编译的函数。Notifies the profiler that a search has started for a function that was compiled previously using NGen.exe.
JITCompilationFinished 方法JITCompilationFinished Method 通知探查器 JIT 编译器已经完成了对函数的编译。Notifies the profiler that the JIT compiler has finished compiling a function.
JITCompilationStarted 方法JITCompilationStarted Method 通知探查器实时(JIT)编译器已开始编译函数。Notifies the profiler that the just-in-time (JIT) compiler has started to compile a function.
JITFunctionPitched 方法JITFunctionPitched Method 通知探查器已从内存中删除了已进行 JIT 编译的函数。Notifies the profiler that a function that has been JIT-compiled has been removed from memory.
JITInlining 方法JITInlining Method 通知探查器 JIT 编译器即将使用另一个函数插入一个函数。Notifies the profiler that the JIT compiler is about to insert a function in line with another function.
ManagedToUnmanagedTransition 方法ManagedToUnmanagedTransition Method 通知探查器已发生从托管代码到非托管代码的转换。Notifies the profiler that a transition from managed code to unmanaged code has occurred.
ModuleAttachedToAssembly 方法ModuleAttachedToAssembly Method 通知探查器模块正在附加到其父程序集。Notifies the profiler that a module is being attached to its parent assembly.
ModuleLoadFinished 方法ModuleLoadFinished Method 通知探查器模块已完成加载。Notifies the profiler that a module has finished loading.
ModuleLoadStarted 方法ModuleLoadStarted Method 通知探查器正在加载模块。Notifies the profiler that a module is being loaded.
ModuleUnloadFinished 方法ModuleUnloadFinished Method 通知探查器模块已完成卸载。Notifies the profiler that a module has finished unloading.
ModuleUnloadStarted 方法ModuleUnloadStarted Method 通知探查器正在卸载模块。Notifies the profiler that a module is being unloaded.
MovedReferences 方法MovedReferences Method 通知探查器有关垃圾回收期间移动的对象引用。Notifies the profiler about object references that were moved during garbage collection.
ObjectAllocated 方法ObjectAllocated Method 通知探查器已为对象分配堆中的内存。Notifies the profiler that memory within the heap has been allocated for an object.
ObjectReferences 方法ObjectReferences Method 通知探查器有关指定的对象引用的内存中的对象。Notifies the profiler about objects in memory referenced by the specified object.
ObjectsAllocatedByClass 方法ObjectsAllocatedByClass Method 通知探查器自上次垃圾回收后已创建的每个指定类的实例数。Notifies the profiler about the number of instances of each specified class that have been created since the previous garbage collection.
RemotingClientInvocationFinished 方法RemotingClientInvocationFinished Method 通知探查器远程处理调用已在客户端上完成运行。Notifies the profiler that a remoting call has run to completion on the client.
RemotingClientInvocationStarted 方法RemotingClientInvocationStarted Method 通知探查器已开始远程调用。Notifies the profiler that a remoting call has started.
RemotingClientReceivingReply 方法RemotingClientReceivingReply Method 通知探查器远程处理调用的服务器端部分已完成,并且客户端现在正在接收,并即将处理答复。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.
RemotingClientSendingMessage 方法RemotingClientSendingMessage Method 通知探查器客户端正在向服务器发送请求。Notifies the profiler that the client is sending a request to the server.
RemotingServerInvocationReturned 方法RemotingServerInvocationReturned Method 通知探查器进程已完成调用方法以响应远程方法调用请求。Notifies the profiler that the process has finished invoking a method in response to a remote method invocation request.
RemotingServerInvocationStarted 方法RemotingServerInvocationStarted Method 通知探查器进程正在调用方法以响应远程方法调用请求。Notifies the profiler that the process is invoking a method in response to a remote method invocation request.
RemotingServerReceivingMessage 方法RemotingServerReceivingMessage Method 通知探查器进程正在接收远程方法调用或激活请求。Notifies the profiler that the process is receiving a remote method invocation or activation request.
RemotingServerSendingReply 方法RemotingServerSendingReply Method 通知探查器进程已处理完远程方法调用请求,即将通过通道传输答复。Notifies the profiler that the process has finished processing a remote method invocation request and is about to transmit the reply through a channel.
RootReferences 方法RootReferences Method 在垃圾回收后通知探查器有关根引用的信息。Notifies the profiler with information about root references after garbage collection.
RuntimeResumeFinished 方法RuntimeResumeFinished Method 通知探查器运行时已恢复所有运行时线程并返回到正常操作。Notifies the profiler that the runtime has resumed all runtime threads and has returned to normal operation.
RuntimeResumeStarted 方法RuntimeResumeStarted Method 通知探查器运行时正在恢复所有运行时线程。Notifies the profiler that the runtime is resuming all run-time threads.
RuntimeSuspendAborted 方法RuntimeSuspendAborted Method 通知探查器运行时已中止所发生的运行时挂起。Notifies the profiler that the runtime has aborted the run-time suspension that was occurring.
RuntimeSuspendFinished 方法RuntimeSuspendFinished Method 通知探查器运行时已完成所有运行时线程的挂起。Notifies the profiler that the runtime has completed suspension of all run-time threads.
RuntimeSuspendStarted 方法RuntimeSuspendStarted Method 通知探查器运行时将要挂起所有运行时线程。Notifies the profiler that the runtime is about to suspend all run-time threads.
RuntimeThreadResumed 方法RuntimeThreadResumed Method 通知探查器指定的线程在挂起后已恢复。Notifies the profiler that the specified thread has resumed after being suspended.
RuntimeThreadSuspended 方法RuntimeThreadSuspended Method 通知探查器指定的线程已或即将挂起。Notifies the profiler that the specified thread has been, or is about to be, suspended.
Shutdown 方法Shutdown Method 通知探查器应用程序正在关闭。Notifies the profiler that the application is shutting down.
ThreadAssignedToOSThread 方法ThreadAssignedToOSThread Method 通知探查器使用特定操作系统(OS)线程实现了托管线程。Notifies the profiler that a managed thread is being implemented using a particular operating system (OS) thread.
ThreadCreated 方法ThreadCreated Method 通知探查器已创建一个线程。Notifies the profiler that a thread has been created.
ThreadDestroyed 方法ThreadDestroyed Method 通知探查器线程已销毁。Notifies the profiler that a thread has been destroyed.
UnmanagedToManagedTransition 方法UnmanagedToManagedTransition Method 通知探查器已发生从非托管代码到托管代码的转换。Notifies the profiler that a transition from unmanaged code to managed code has occurred.

注解Remarks

CLR 调用 ICorProfilerCallback (或ICorProfilerCallback2)接口中的方法,在事件发生时通知探查器。The CLR calls a method in the ICorProfilerCallback (or ICorProfilerCallback2) interface to notify the profiler when an event, to which the profiler has subscribed, occurs. 这是 CLR 与代码探查器进行通信时所使用的主回调接口。This is the primary callback interface through which the CLR communicates with the code profiler.

代码探查器必须实现接口的方法 ICorProfilerCallbackA code profiler must implement the methods of the ICorProfilerCallback interface. 对于 .NET Framework 版本2.0 或更高版本,探查器还必须实现 ICorProfilerCallback2 方法。For the .NET Framework version 2.0 or later, the profiler must also implement the ICorProfilerCallback2 methods. 每个方法实现都必须返回值为 "S_OK" 的 HRESULT,否则失败时 E_FAIL。Each method implementation must return an HRESULT that has a value of S_OK on success or E_FAIL on failure. 目前,CLR 将忽略每个回调返回的 HRESULT ( ICorProfilerCallback:: ObjectReferences除外)。Currently, the CLR ignores the HRESULT that is returned by each callback except ICorProfilerCallback::ObjectReferences.

在 Microsoft Windows 注册表中,代码探查器必须注册其用于实现和接口的组件对象模型(COM)对象 ICorProfilerCallback ICorProfilerCallback2In the Microsoft Windows registry, a code profiler must register its Component Object Model (COM) object that implements the ICorProfilerCallback and ICorProfilerCallback2 interfaces. 代码探查器通过调用ICorProfilerInfo:: SetEventMask订阅要接收通知的事件。A code profiler subscribes to the events for which it wants to receive notification by calling ICorProfilerInfo::SetEventMask. 通常在探查器的ICorProfilerCallback:: Initialize实现中完成此操作。This is usually done in the profiler's implementation of ICorProfilerCallback::Initialize. 然后,探查器可以在事件即将发生或刚刚发生在正在执行的运行时进程中时接收来自运行时的通知。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.

备注

探查器将注册一个 COM 对象。The profiler registers a single COM object. 如果探查器面向 .NET Framework 版本1.0 或1.1,则该 COM 对象只需实现的方法 ICorProfilerCallbackIf the profiler is targeting the .NET Framework version 1.0 or 1.1, that COM object needs to implement only the methods of ICorProfilerCallback. 如果目标 .NET Framework 版本2.0 或更高版本,则 COM 对象还必须实现的方法 ICorProfilerCallback2If it is targeting .NET Framework version 2.0 or later, the COM object must also implement the methods of ICorProfilerCallback2.

要求Requirements

平台: 请参阅系统要求Platforms: See System Requirements.

头文件: CorProf.idl、CorProf.hHeader: CorProf.idl, CorProf.h

库: CorGuids.libLibrary: CorGuids.lib

.NET Framework 版本:自 1.0 之后可用Available since 1.0.NET Framework Versions: 自 1.0 之后可用Available since 1.0

另请参阅See also