次の方法で共有


ICorProfilerInfo Interface

Provides methods for use by code profilers to communicate with the common language runtime (CLR) to control event monitoring and request information.

Note

Each method in the ICorProfilerInfo interface returns an HRESULT to indicate success or failure. See CorError.h for a list of possible return codes.

interface ICorProfilerInfo : IUnknown
{
    HRESULT GetClassFromObject(
        [in]  ObjectID objectId,
        [out] ClassID *pClassId);

    HRESULT GetClassFromToken(
        [in]  ModuleID  moduleId,
        [in]  mdTypeDef typeDef,
        [out] ClassID   *pClassId);
        
    HRESULT GetCodeInfo(
        [in]  FunctionID functionId,
        [out] LPCBYTE    *pStart,
        [out] ULONG      *pcSize);
        
    HRESULT GetEventMask(
        [out] DWORD *pdwEvents);

    HRESULT GetFunctionFromIP(
        [in]  LPCBYTE    ip,
        [out] FunctionID *pFunctionId);

    HRESULT GetFunctionFromToken(
        [in]  ModuleID   moduleId,
        [in]  mdToken    token,
        [out] FunctionID *pFunctionId);

    HRESULT GetHandleFromThread(
        [in]  ThreadID threadId,
        [out] HANDLE  *phThread);

    HRESULT GetObjectSize(
        [in]  ObjectID objectId,
        [out] ULONG  *pcSize);
      
    HRESULT IsArrayClass(
        [in]  ClassID        classId,
        [out] CorElementType *pBaseElemType,
        [out] ClassID        *pBaseClassId,
        [out] ULONG          *pcRank);

    HRESULT GetThreadInfo(
        [in]  ThreadID threadId,
        [out] DWORD    *pdwWin32ThreadId);

    HRESULT GetCurrentThreadID(
        [out] ThreadID *pThreadId);

    HRESULT GetClassIDInfo(
        [in]  ClassID   classId,
        [out] ModuleID  *pModuleId,
        [out] mdTypeDef *pTypeDefToken);

    HRESULT GetFunctionInfo(
        [in]  FunctionID functionId,
        [out] ClassID    *pClassId,
        [out] ModuleID   *pModuleId,
        [out] mdToken    *pToken);

    HRESULT SetEventMask(
        [in] DWORD dwEvents);
    
    HRESULT SetEnterLeaveFunctionHooks(
        [in] FunctionEnter    *pFuncEnter,
        [in] FunctionLeave    *pFuncLeave,
        [in] FunctionTailcall *pFuncTailcall);

    HRESULT SetFunctionIDMapper(
        [in] FunctionIDMapper *pFunc);
    
    HRESULT GetTokenAndMetaDataFromFunction(
        [in]  FunctionID functionId,
        [in]  REFIID     riid,
        [out] IUnknown   **ppImport,
        [out] mdToken    *pToken);
      
    HRESULT GetModuleInfo(
        [in]  ModuleID   moduleId,
        [out] LPCBYTE    *ppBaseLoadAddress,
        [in]  ULONG      cchName,
        [out] ULONG      *pcchName,
        [out, size_is(cchName), length_is(*pcchName)]
              WCHAR      szName[] ,
        [out] AssemblyID *pAssemblyId);
        
    HRESULT GetModuleMetaData(
        [in]  ModuleID moduleId,
                [in]  DWORD    dwOpenFlags,
        [in]  REFIID   riid,
                [out] IUnknown **ppOut);
      
    HRESULT GetILFunctionBody(
        [in]  ModuleID    moduleId,
        [in]  mdMethodDef methodId,
        [out] LPCBYTE     *ppMethodHeader,
        [out] ULONG       *pcbMethodSize);

    HRESULT GetILFunctionBodyAllocator(
        [in]  ModuleID      moduleId,
        [out] IMethodMalloc **ppMalloc);
    
    HRESULT SetILFunctionBody(
        [in] ModuleID    moduleId,
        [in] mdMethodDef methodid,
        [in] LPCBYTE     pbNewILMethodHeader);

    HRESULT GetAppDomainInfo(
        [in]  AppDomainID appDomainId,
        [in]  ULONG       cchName,
        [out] ULONG       *pcchName,
        [out, size_is(cchName), length_is(*pcchName)]
              WCHAR       szName[] ,
        [out] ProcessID   *pProcessId);

    HRESULT GetAssemblyInfo(
        [in]  AssemblyID  assemblyId,
        [in]  ULONG       cchName,
        [out] ULONG       *pcchName,
        [out, size_is(cchName), length_is(*pcchName)]
              WCHAR       szName[] ,
        [out] AppDomainID *pAppDomainId,
        [out] ModuleID    *pModuleId);
      
    HRESULT SetFunctionReJIT(
        [in] FunctionID functionId);

    HRESULT ForceGC();
        
    HRESULT SetILInstrumentedCodeMap(
        [in]                         FunctionID functionId,
        [in]                         BOOL       fStartJit,
        [in]                         ULONG      cILMapEntries,
        [in, size_is(cILMapEntries)] COR_IL_MAP rgILMapEntries[] );
      
    HRESULT GetInprocInspectionInterface(
        [out] IUnknown **ppicd);

    HRESULT GetInprocInspectionIThisThread(
        [out] IUnknown **ppicd);

    HRESULT GetThreadContext(
        [in]  ThreadID  threadId,
        [out] ContextID *pContextId);
    
    HRESULT BeginInprocDebugging(
        [in]  BOOL   fThisThreadOnly,
        [out] DWORD *pdwProfilerContext);
      
    HRESULT EndInprocDebugging(
        [in]  DWORD dwProfilerContext);
      
    HRESULT GetILToNativeMapping(
        [in] FunctionID functionId,
        [in] ULONG32 cMap,
        [out] ULONG32 *pcMap,
        [out, size_is(cMap), length_is(*pcMap)]
            COR_DEBUG_IL_TO_NATIVE_MAP map[]);
}

Methods

Method Description

ICorProfilerInfo::BeginInprocDebugging Method

Initializes in-process debugging support. This method is obsolete in the .NET Framework version 2.0.

ICorProfilerInfo::EndInprocDebugging Method

Shuts down an in-process debugging session. This method is obsolete in the .NET Framework version 2.0.

ICorProfilerInfo::ForceGC Method

Forces garbage collection to occur within the runtime.

ICorProfilerInfo::GetAppDomainInfo Method

Gets information about the specified application domain.

ICorProfilerInfo::GetAssemblyInfo Method

Gets information about the specified assembly.

ICorProfilerInfo::GetClassFromObject Method

Gets the ClassID of an

object, given its ObjectID.

ICorProfilerInfo::GetClassFromToken Method

Gets the ID of the class, given the metadata token. This method is obsolete in the .NET Framework version 2.0. Use the ICorProfilerInfo2::GetClassFromTokenAndTypeArgs Method method instead.

ICorProfilerInfo::GetClassIDInfo Method

Gets the parent module and the metadata token for the specified class.

ICorProfilerInfo::GetCodeInfo Method

Gets the extent of native code associated with the specified function ID. This method is obsolete. Use the ICorProfilerInfo2::GetCodeInfo2 Method method instead.

ICorProfilerInfo::GetCurrentThreadID Method

Gets the ID of the current thread, if it is a managed thread.

ICorProfilerInfo::GetEventMask Method

Gets the current event categories for which the profiler wants to receive event notifications from the CLR.

ICorProfilerInfo::GetFunctionFromIP Method

Maps a managed code instruction pointer to a FunctionID.

ICorProfilerInfo::GetFunctionFromToken Method

Gets the ID of a function. This method is obsolete in the .NET Framework version 2.0. Use the ICorProfilerInfo2::GetFunctionFromTokenAndTypeArgs Method method instead.

ICorProfilerInfo::GetFunctionInfo Method

Gets the parent class and metadata token for the specified function.

ICorProfilerInfo::GetHandleFromThread Method

Maps the ID of a thread to a Win32 thread handle.

ICorProfilerInfo::GetILFunctionBody Method

Gets a pointer to the body of a method in Microsoft intermediate language (MSIL) code, starting at its header.

ICorProfilerInfo::GetILFunctionBodyAllocator Method

Gets an interface that provides a method to allocate memory to be used for swapping out the body of a method in MSIL code.

ICorProfilerInfo::GetILToNativeMapping Method

Gets a map from MSIL offsets to native offsets for the code contained in the specified function.

ICorProfilerInfo::GetInprocInspectionInterface Method

Gets an object that can be queried for an ICorDebugProcess Interface interface. This method is obsolete in the .NET Framework version 2.0.

ICorProfilerInfo::GetInprocInspectionIThisThread Method

Gets an object that can be queried for the ICorDebugThread Interface interface. This method is obsolete in the .NET Framework version 2.0.

ICorProfilerInfo::GetModuleInfo Method

Gets information about the specified module.

ICorProfilerInfo::GetModuleMetaData Method

Gets a metadata interface instance that maps to the specified module.

ICorProfilerInfo::GetObjectSize Method

Gets the size of a specified object.

ICorProfilerInfo::GetThreadContext Method

Gets the context identity currently associated with the specified thread.

ICorProfilerInfo::GetThreadInfo Method

Gets the current Win32 thread identity for the specified thread.

ICorProfilerInfo::GetTokenAndMetadataFromFunction Method

Gets the metadata token and an instance of the metadata interface that can be used against the token for the specified function.

ICorProfilerInfo::IsArrayClass Method

Determines whether the specified class is an array class.

ICorProfilerInfo::SetEnterLeaveFunctionHooks Method

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

ICorProfilerInfo::SetEventMask Method

Sets a value that specifies the types of events for which the profiler wants to receive notification from the CLR.

ICorProfilerInfo::SetFunctionIDMapper Method

Specifies the profiler-implemented function that will be called to map FunctionID values to alternative values, which are passed to the profiler's function entry/exit hooks.

ICorProfilerInfo::SetFunctionReJIT Method

Not implemented. Do not use.

ICorProfilerInfo::SetILFunctionBody Method

Replaces the body of the specified function in the specified module.

ICorProfilerInfo::SetILInstrumentedCodeMap Method

Specifies how the offsets of a specified function's original MSIL map to the new offsets of the function's profiler-modified MSIL.

Remarks

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

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

The CLR passes, via the profiler's implementation of ICorProfilerCallback::Initialize Method, an ICorProfilerInfo interface to each code profiler during initialization. A code profiler can then call methods of the ICorProfilerInfo 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

Reference

ICorProfilerInfo2 Interface

Other Resources

Profiling Interfaces