Share via


ICorProfilerInfo2::GetCodeInfo2 Method

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

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

Parameters

  • functionID
    [in] The ID of the function with which the native code is associated.

  • cCodeInfos
    [in] The size of the codeInfos array.

  • pcCodeInfos
    [out] A pointer to the total number of COR_PRF_CODE_INFO structures available.

  • codeInfos
    [out] A caller-provided buffer. After the method returns, it will contain an array of COR_PRF_CODE_INFO structures, each of which describes a block of native code.

Remarks

The extents are sorted in order of increasing Microsoft intermediate language (MSIL) offset.

After GetCodeInfo2 returns, you must verify that the codeInfos buffer was large enough to contain all the COR_PRF_CODE_INFO structures. To do this, compare the value of cCodeInfos with the value of the cchName parameter. If cCodeInfos divided by the size of a COR_PRF_CODE_INFO structure is smaller than pcCodeInfos, allocate a larger codeInfos buffer, update cCodeInfos with the new, larger size, and call GetCodeInfo2 again.

Alternatively, you can first call GetCodeInfo2 with a zero-length codeInfos buffer to obtain the correct buffer size. You can then set the codeInfos buffer size to the value returned in pcCodeInfos, multiplied by the size of a COR_PRF_CODE_INFO structure, and call GetCodeInfo2 again.

For more information about these two approaches, see Profiling API Method Conventions.

Requirements

Platforms: See .NET Framework System Requirements.

Header: CorProf.idl, CorProf.h

Library: CorGuids.lib

.NET Framework Versions: 4, 3.5 SP1, 3.5, 3.0 SP1, 3.0, 2.0 SP1, 2.0

See Also

Reference

ICorProfilerInfo Interface

ICorProfilerInfo2 Interface

Other Resources

Profiling Interfaces

Profiling (Unmanaged API Reference)