共用方式為


ICorProfilerInfo2

更新:2007 年 11 月

提供方法讓程式碼剖析工具用來與 Common Language Runtime (CLR) 通訊,以控制事件監視及要求資訊。ICorProfilerInfo2 介面是 ICorProfilerInfo 介面的擴充。也就是說,它提供了 .NET Framework 2.0 版和更新版本所支援的新方法。

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);
}

方法

方法

說明

ICorProfilerInfo2::DoStackSnapshot 方法

查核指定之執行緒的堆疊行程,以便向分析工具報告 Managed 呼叫框架。

ICorProfilerInfo2::EnumModuleFrozenObjects 方法

取得列舉值,其允許指定之模組中凍結物件的反覆運算。

ICorProfilerInfo2::GetAppDomainStaticAddress 方法

取得指定之應用程式定義域範圍中指定之應用程式定義域靜態欄位的位址。

ICorProfilerInfo2::GetArrayObjectInfo 方法

取得與陣列物件有關的詳細資訊。

ICorProfilerInfo2::GetBoxClassLayout 方法

取得指定之 Boxed 實值型別的類別配置資訊。

ICorProfilerInfo2::GetClassFromTokenAndTypeArgs 方法

使用指定的中繼資料語彙基元和任何型別引數的 ClassID 值,取得某型別的 ClassID

ICorProfilerInfo2::GetClassIDInfo2 方法

取得指定之泛型類別的父模組、此類別的中繼資料語彙基元、其父類別的 ClassID,以及此類別的每個型別引數 (如果有的話) 之 ClassID

ICorProfilerInfo2::GetClassLayout 方法

取得指定之類別所定義的欄位配置 (記憶體中) 相關資訊。也就是說,這個方法會取得此類別欄位的位移。

ICorProfilerInfo2::GetCodeInfo2 方法

取得與指定的 FunctionID 關聯的機器碼延伸。

ICorProfilerInfo2::GetContextStaticAddress 方法

取得指定之內容範圍中指定之內容靜態欄位的位址。

ICorProfilerInfo2::GetFunctionFromTokenAndTypeArgs 方法

使用指定的中繼資料語彙基元、包含的類別和任何型別引數的 ClassID 值,取得某函式的 FunctionID

ICorProfilerInfo2::GetFunctionInfo2 方法

取得函式的每個型別引數 (若存在的話) 之父類別、中繼資料語彙基元和 ClassID

ICorProfilerInfo2::GetGenerationBounds 方法

取得構成記憶體回收堆積之層代的記憶體區域 (堆積區段)。

ICorProfilerInfo2::GetNotifiedExceptionClauseInfo 方法

取得即將執行或剛才執行之例外狀況子句 (catch/finally/filter) 的原生位址和框架資訊。

ICorProfilerInfo2::GetObjectGeneration 方法

取得包含指定之物件的堆積區段。

ICorProfilerInfo2::GetRVAStaticAddress 方法

取得指定之相對虛擬位址 (RVA) 靜態欄位的位址。

ICorProfilerInfo2::GetStaticFieldInfo 方法

取得指定的欄位在其中為靜態的範圍。

ICorProfilerInfo2::GetStringLayout 方法

取得字串物件的配置資訊。

ICorProfilerInfo2::GetThreadAppDomain 方法

取得指定的執行緒目前在其中執行程式碼的應用程式定義域 ID。

ICorProfilerInfo2::GetThreadStaticAddress 方法

取得指定之執行緒範圍中指定之執行緒靜態欄位的位址。

ICorProfilerInfo2::SetEnterLeaveFunctionHooks2 方法

指定要在 Managed 函式之 "enter"、"leave" 和 "tailcall" 攔截程序上呼叫的分析工具實作函式。

備註

分析工具會呼叫 ICorProfilerInfo2 介面中的方法與 CLR 通訊,以控制事件監視及要求資訊。

ICorProfilerInfo2 介面的方法由 CLR 透過無限制執行緒模型實作。每個方法都會傳回 HRESULT 以表示成功或失敗。如需可能的傳回碼 (Return Code) 清單,請參閱 CorError.h 檔案。

CLR 會在初始化期間使用分析工具的 ICorProfilerCallback::Initialize 實作,將 ICorProfilerInfo2 介面傳遞至每個程式碼分析工具。程式碼剖析工具就可以呼叫 ICorProfilerInfo2 介面的方法,以取得在 CLR 控制下執行的 Managed 程式碼相關資訊。

需求

**平台:**請參閱 .NET Framework 系統需求

**標頭:**CorProf.idl

**程式庫:**CorGuids.lib

**.NET Framework 版本:**3.5 SP1、3.5、3.0 SP1、3.0、2.0 SP1、2.0

請參閱

參考

ICorProfilerInfo

其他資源

分析介面