Compartilhar via


ICorProfilerInfo2 Interface

Provides methods that code profilers use to communicate with the common language runtime (CLR) to control event monitoring and request information. The ICorProfilerInfo2 interface is an extension of the ICorProfilerInfo interface. That is, it provides new methods supported in the .NET Framework version 2.0 and later versions.

interface ICorProfilerInfo2 : ICorProfilerInfo
{
    HRESULT DoStackSnapshot(
        [in] ThreadID thread,
        [in] StackSnapshotCallback *callback,
        [in] ULONG32 infoFlags,
        [in] void *clientData,
        [in, size_is(contextSize), length_is(contextSize)] BYTE context[],
        [in] ULONG32 contextSize);

    HRESULT SetEnterLeaveFunctionHooks2(
        [in] FunctionEnter2    *pFuncEnter,
        [in] FunctionLeave2    *pFuncLeave,
        [in] FunctionTailcall2 *pFuncTailcall);

    HRESULT GetFunctionInfo2(
        [in] FunctionID funcId,
        [in] COR_PRF_FRAME_INFO frameInfo,
        [out] ClassID *pClassId,
        [out] ModuleID *pModuleId,
        [out] mdToken *pToken,
        [in] ULONG32 cTypeArgs,
        [out] ULONG32 *pcTypeArgs,
        [out] ClassID typeArgs[]);

    HRESULT GetStringLayout(
        [out] ULONG *pBufferLengthOffset,
        [out] ULONG *pStringLengthOffset,
        [out] ULONG *pBufferOffset);

    HRESULT GetClassLayout(
        [in]  ClassID classID,
        [in, out] COR_FIELD_OFFSET rFieldOffset[],
        [in] ULONG cFieldOffset,
        [out] ULONG *pcFieldOffset,
        [out] ULONG *pulClassSize);

    HRESULT GetClassIDInfo2(
        [in] ClassID classId,
        [out] ModuleID *pModuleId,
        [out] mdTypeDef *pTypeDefToken,
        [out] ClassID *pParentClassId,
        [in] ULONG32 cNumTypeArgs,
        [out] ULONG32 *pcNumTypeArgs,
        [out] ClassID typeArgs[]);

    HRESULT GetCodeInfo2(
        [in] FunctionID functionID,
        [in] ULONG32 cCodeInfos,
        [out] ULONG32 *pcCodeInfos,
        [out, size_is(cCodeInfos), length_is(*pcCodeInfos)]
                COR_PRF_CODE_INFO codeInfos[]);

        HRESULT GetClassFromTokenAndTypeArgs(
        [in] ModuleID moduleID,
        [in] mdTypeDef typeDef,
        [in] ULONG32 cTypeArgs,
        [in, size_is(cTypeArgs)] ClassID typeArgs[],
        [out] ClassID* pClassID);

    HRESULT GetFunctionFromTokenAndTypeArgs(
        [in] ModuleID moduleID,
        [in] mdMethodDef funcDef,
        [in] ClassID classId,
        [in] ULONG32 cTypeArgs,
        [in, size_is(cTypeArgs)] ClassID typeArgs[],
        [out] FunctionID* pFunctionID);

    HRESULT EnumModuleFrozenObjects(
        [in] ModuleID moduleID,
        [out] ICorProfilerObjectEnum** ppEnum);

    HRESULT GetArrayObjectInfo(
        [in] ObjectID objectId,
        [in] ULONG32 cDimensions,
        [out, size_is(cDimensions), length_is(cDimensions)] ULONG32 pDimensionSizes[],
        [out, size_is(cDimensions), length_is(cDimensions)] int pDimensionLowerBounds[],
        [out] BYTE **ppData);

    HRESULT GetBoxClassLayout(
        [in] ClassID classId,
        [out] ULONG32 *pBufferOffset);

    HRESULT GetThreadAppDomain(
        [in] ThreadID threadId,
        [out] AppDomainID *pAppDomainId);

    HRESULT GetRVAStaticAddress(
        [in] ClassID classId,
        [in] mdFieldDef fieldToken,
        [out] void **ppAddress);

    HRESULT GetAppDomainStaticAddress(
        [in] ClassID classId,
        [in] mdFieldDef fieldToken,
        [in] AppDomainID appDomainId,
        [out] void **ppAddress);

    HRESULT GetThreadStaticAddress(
        [in] ClassID classId,
        [in] mdFieldDef fieldToken,
        [in] ThreadID threadId,
        [out] void **ppAddress);

    HRESULT GetContextStaticAddress(
        [in] ClassID classId,
        [in] mdFieldDef fieldToken,
        [in] ContextID contextId,
        [out] void **ppAddress);

    HRESULT GetStaticFieldInfo(
        [in] ClassID classId,
        [in] mdFieldDef fieldToken,
        [out] COR_PRF_STATIC_TYPE *pFieldInfo);

    HRESULT GetGenerationBounds(
        [in] ULONG cObjectRanges,
        [out] ULONG *pcObjectRanges,
        [out, size_is(cObjectRanges), length_is(*pcObjectRanges)] COR_PRF_GC_GENERATION_RANGE ranges[]);

    HRESULT GetObjectGeneration(
        [in] ObjectID objectId,
        [out] COR_PRF_GC_GENERATION_RANGE *range);

    HRESULT GetNotifiedExceptionClauseInfo(
        [out] COR_PRF_EX_CLAUSE_INFO *pinfo);
}

Methods

Method

Description

ICorProfilerInfo2::DoStackSnapshot Method

Walks the stack of the specified thread to report managed call frames to the profiler.

ICorProfilerInfo2::EnumModuleFrozenObjects Method

Gets an enumerator that allows iteration over the frozen objects in the specified module.

ICorProfilerInfo2::GetAppDomainStaticAddress Method

Gets the address of the specified application domain-static field that is in the scope of the specified application domain.

ICorProfilerInfo2::GetArrayObjectInfo Method

Gets detailed information about an array object.

ICorProfilerInfo2::GetBoxClassLayout Method

Gets information about the class layout for a specified value type that is boxed.

ICorProfilerInfo2::GetClassFromTokenAndTypeArgs Method

Gets the ClassID of a type by using the specified metadata token and the ClassID values of any type arguments.

ICorProfilerInfo2::GetClassIDInfo2 Method

Gets the parent module of the specified generic class, the metadata token for the class, the ClassID of its parent class, and the ClassID for each type argument, if present, of the class.

ICorProfilerInfo2::GetClassLayout Method

Gets information about the layout, in memory, of the fields defined by the specified class. That is, this method gets the offsets of the class's fields.

ICorProfilerInfo2::GetCodeInfo2 Method

Gets the extents of native code associated with the specified FunctionID.

ICorProfilerInfo2::GetContextStaticAddress Method

Gets the address of the specified context-static field that is in the scope of the specified context.

ICorProfilerInfo2::GetFunctionFromTokenAndTypeArgs Method

Gets the FunctionID of a function by using the specified metadata token, containing class, and ClassID values of any type arguments.

ICorProfilerInfo2::GetFunctionInfo2 Method

Gets the parent class, the metadata token, and the ClassID of each type argument, if present, of a function.

ICorProfilerInfo2::GetGenerationBounds Method

Gets the memory regions (the segments of the heap) that make up the generations of the garbage-collected heap.

ICorProfilerInfo2::GetNotifiedExceptionClauseInfo Method

Gets the native address and frame information for the exception clause (catch/finally/filter) that is about to be run or has just been run.

ICorProfilerInfo2::GetObjectGeneration Method

Gets the segment of the heap that contains the specified object.

ICorProfilerInfo2::GetRVAStaticAddress Method

Gets the address of the specified relative virtual address (RVA)-static field.

ICorProfilerInfo2::GetStaticFieldInfo Method

Gets the scope in which the specified field is static.

ICorProfilerInfo2::GetStringLayout Method

Gets information about the layout of a string object.

ICorProfilerInfo2::GetThreadAppDomain Method

Gets the ID of the application domain in which the specified thread is currently executing code.

ICorProfilerInfo2::GetThreadStaticAddress Method

Gets the address of the specified thread-static field that is in the scope of the specified thread.

ICorProfilerInfo2::SetEnterLeaveFunctionHooks2 Method

Specifies profiler-implemented functions to be called on "enter", "leave", and "tailcall" hooks of managed functions.

Remarks

A profiler calls a method in the ICorProfilerInfo2 interface to communicate with the CLR to control event monitoring and request information.

The methods of the ICorProfilerInfo2 interface are implemented by the CLR using the free-threaded model. Each method returns an HRESULT to indicate success or failure. For a list of possible return codes, see the CorError.h file.

The CLR passes an ICorProfilerInfo2 interface to each code profiler during initialization, using the profiler's implementation of ICorProfilerCallback::Initialize. A code profiler can then call methods of the ICorProfilerInfo2 interface to get information about managed code being executed under the control of the CLR.

Requirements

Platforms: Windows 2000, Windows XP, Windows Server 2003 family

Header: CorProf.idl

Library: CorGuids.lib

.NET Framework Version: 2.0

See Also

Concepts

Profiling Interfaces

ICorProfilerInfo Interface