Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation for ICorProfilerInfo13 methods and enumeration. #30131

Merged
merged 28 commits into from
Jul 29, 2022
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
5e0f3b4
Add documentation for ICorProfilerInfo13 methods and enumeration.
chrisnas Jul 7, 2022
4f992a4
Fix link errors
chrisnas Jul 8, 2022
0a2bda6
Update docs/framework/unmanaged-api/profiling/cor-prf-handle-type-enu…
chrisnas Jul 8, 2022
bfd2cd4
Update docs/framework/unmanaged-api/profiling/icorprofilerinfo13-crea…
chrisnas Jul 8, 2022
64108f3
Update docs/framework/unmanaged-api/profiling/icorprofilerinfo13-crea…
chrisnas Jul 8, 2022
dd47f65
Update docs/framework/unmanaged-api/profiling/icorprofilerinfo13-crea…
chrisnas Jul 8, 2022
a232b41
Update docs/framework/unmanaged-api/profiling/icorprofilerinfo13-crea…
chrisnas Jul 8, 2022
3534ea7
Update docs/framework/unmanaged-api/profiling/icorprofilerinfo13-crea…
chrisnas Jul 8, 2022
f88fd12
Update docs/framework/unmanaged-api/profiling/icorprofilerinfo13-crea…
chrisnas Jul 8, 2022
ec0486c
Update docs/framework/unmanaged-api/profiling/icorprofilerinfo13-dest…
chrisnas Jul 8, 2022
fe3327c
Update docs/framework/unmanaged-api/profiling/icorprofilerinfo13-dest…
chrisnas Jul 8, 2022
08efc15
Update docs/framework/unmanaged-api/profiling/icorprofilerinfo13-geto…
chrisnas Jul 8, 2022
407c7fe
Update docs/framework/unmanaged-api/profiling/icorprofilerinfo13-geto…
chrisnas Jul 8, 2022
b658000
Update docs/framework/unmanaged-api/profiling/icorprofilerinfo13-geto…
chrisnas Jul 8, 2022
cfd6ca4
Update docs/framework/unmanaged-api/profiling/icorprofilerinfo13-inte…
chrisnas Jul 8, 2022
f789fed
Update docs/framework/unmanaged-api/profiling/icorprofilerinfo13-inte…
chrisnas Jul 8, 2022
29b851c
Update docs/framework/unmanaged-api/profiling/icorprofilerinfo13-inte…
chrisnas Jul 8, 2022
7fd30e8
Update docs/framework/unmanaged-api/profiling/icorprofilerinfo13-inte…
chrisnas Jul 8, 2022
9c42bd1
Add the enumeration to the enumeration page and fix grammar
chrisnas Jul 8, 2022
0248124
Add missing file and fix indentation issue
chrisnas Jul 18, 2022
9b0bf58
Fix upper/lower case issue
chrisnas Jul 18, 2022
730030f
Update docs/framework/unmanaged-api/profiling/icorprofilerinfo13-crea…
chrisnas Jul 18, 2022
af28eb2
Update docs/framework/unmanaged-api/profiling/icorprofilerinfo13-crea…
chrisnas Jul 18, 2022
8c5ac52
Update docs/framework/unmanaged-api/profiling/profiling-interfaces.md
chrisnas Jul 18, 2022
ecfe9f4
Merge branch 'dotnet:main' into PR_add_ICorProfilerInfo13
chrisnas Jul 19, 2022
00f247c
Take review into account
chrisnas Jul 19, 2022
97c9cb7
Add empty lines
gewarren Jul 19, 2022
306a776
Update docs/framework/unmanaged-api/profiling/profiling-enumerations.md
gewarren Jul 19, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
description: "Learn more about: COR_PRF_HANDLE_TYPE Enumeration"
title: "COR_PRF_HANDLE_TYPE Enumeration"
ms.date: "03/19/2021"
api_name:
- "COR_PRF_HANDLE_TYPE"
api_location:
- "coreclr.dll"
- "corprof.idl"
api_type:
- "COM"
---
# COR_PRF_HANDLE_TYPE Enumeration

Describes the type of an object handle.

## Syntax

```cpp
typedef enum
{
COR_PRF_HANDLE_TYPE_WEAK = 0x1,
COR_PRF_HANDLE_TYPE_STRONG = 0x2,
COR_PRF_HANDLE_TYPE_PINNED = 0x3
} COR_PRF_HANDLE_TYPE;
```

## Members

|Member|Description|
|------------|-----------------|
|`COR_PRF_HANDLE_TYPE_WEAK`|The handle tracks an object as long as it is alive. It does not act as a root for the garbage collector.|
|`COR_PRF_HANDLE_TYPE_STRONG`|The handle acts as a normal object reference. The object will stay alive and be promoted during the next garbage collection.|
|`COR_PRF_HANDLE_TYPE_PINNED`|The handle acts as a strong handle with an added property to prevent the object from moving in memory during any garbage collection.|

## Remarks

The `COR_PRF_HANDLE_TYPE` enumeration is used by the [ICorProfilerInfo13::CreateHandle](icorprofilerinfo13-createhandle-method.md) method to indicate the type of handle being created.

## Requirements

**Platforms:** See [.NET Core supported operating systems](../../../core/install/windows.md?pivots=os-windows).
**Header:** CorProf.idl, CorProf.h
**.NET Versions:** [!INCLUDE[net_core](../../../../includes/net-core-70-md.md)]

## See also

- [Profiling Enumerations](profiling-enumerations.md)
- [ICorProfilerInfo13::CreateHandle](icorprofilerinfo13-createhandle-method.md)
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
description: "Learn more about: ICorProfilerInfo13::CreateHandle Method"
title: "ICorProfilerInfo13::CreateHandle Method"
ms.date: "03/19/2021"
api_name:
- "ICorProfilerInfo13.CreateHandle"
api_location:
- "coreclr.dll"
- "corprof.idl"
api_type:
- "COM"
---
# ICorProfilerInfo13::CreateHandle Method

Creates a handle that wraps a specified object.

## Syntax

```cpp
HRESULT CreateHandle(
[in] ObjectID object,
[in] COR_PRF_HANDLE_TYPE type,
[out] ObjectHandleID* pHandle);
```

## Parameters

`object`
[in] The object reference to wrap with a handle.

`type`
[in] The type of handle to create.

`pHandle`
[out] A caller-provided pointer that will point to the handle created to wrap the specified `object`.

## Remarks

Following are the expected usages depending on the specified `COR_PRF_HANDLE_TYPE` value:
- COR_PRF_HANDLE_TYPE_WEAK: Monitors if an object stays in memory over time. If the wrapped object has been collected, [ICorProfilerInfo13::GetObjectIDFromHandle](icorprofilerinfo13-getobjectidfromhandle-method.md) will return a null `ObjectID` for its wrapping weak handle.
- `COR_PRF_HANDLE_TYPE_STRONG`: Enforces that an object survives garbage collections even though no other object references it.
- `COR_PRF_HANDLE_TYPE_PINNED`: Same as a strong handle but also ensures that the object stays at the same address in memory during garbage collections.

To ensure that the `object` reference is valid, this method has to be called from a `ICorProfilerCallback` method such as [ICorProfilerCallback::ObjectAllocated](icorprofilercallback-objectallocated-method.md). You cannot call `CreateHandle` from an EventPipe asynchronous listener. The object received via an event payload might have been disposed or moved in memory if a garbage collection occurred between the time the event was emitted and when it was received.

Do not forget to call [ICorProfilerInfo13::DestroyHandle](icorprofilerinfo13-destroyhandle-method.md) once a created handle is no longer needed.
It is recommended to have less than 4096 handles allocated at the same time to avoid impacting the performance of the garbage collector.

## Requirements

**Platforms:** See [.NET Core supported operating systems](../../../core/install/windows.md?pivots=os-windows).
**Header:** CorProf.idl, CorProf.h
**.NET Versions:** [!INCLUDE[net_core](../../../../includes/net-core-70-md.md)]

## See also

- [Profiling Interfaces](profiling-interfaces.md)
- [ICorProfilerInfo13 Interface](icorprofilerinfo13-interface.md)
- [COR_PRF_HANDLE_TYPE Enumeration](cor-prf-handle-type-enumeration.md)
- [DestroyHandle Method](icorprofilerinfo13-destroyhandle-method.md)
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
description: "Learn more about: ICorProfilerInfo13::DestroyHandle Method"
title: "ICorProfilerInfo13::DestroyHandle Method"
ms.date: "03/19/2021"
api_name:
- "ICorProfilerInfo13.DestroyHandle"
api_location:
- "coreclr.dll"
- "corprof.idl"
api_type:
- "COM"
---
# ICorProfilerInfo13::DestroyHandle Method

Destroys a handle that wraps an object.

## Syntax

```cpp
HRESULT DestroyHandle([in] ObjectHandleID handle);
```

## Parameters

`handle`
[in] The handle returned by `CreateHandle`.

## Remarks

Once destroyed, a handle can no longer be used.

## Requirements

**Platforms:** See [.NET Core supported operating systems](../../../core/install/windows.md?pivots=os-windows).
**Header:** CorProf.idl, CorProf.h
**.NET Versions:** [!INCLUDE[net_core](../../../../includes/net-core-70-md.md)]

## See also

- [Profiling Interfaces](profiling-interfaces.md)
- [ICorProfilerInfo13 Interface](ICorProfilerInfo13-interface.md)
- [CreateHandle Method](icorprofilerinfo13-createhandle-method.md)
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
description: "Learn more about: ICorProfilerInfo13::GetObjectIDFromHandle Method"
title: "ICorProfilerInfo13::GetObjectIDFromHandle Method"
ms.date: "03/19/2021"
api_name:
- "ICorProfilerInfo13.GetObjectIDFromHandle"
api_location:
- "coreclr.dll"
- "corprof.idl"
api_type:
- "COM"
---
# ICorProfilerInfo13::GetObjectIDFromHandle Method

Returns the object wrapped by a specified handle.

## Syntax

```cpp
HRESULT GetObjectIDFromHandle(
[in] ObjectHandleID handle,
[out] ObjectID* pObject);
```

## Parameters

`handle`
[in] The handle wrapping an object.

`pObject`
[out] A caller-provided pointer that will point to the object wrapped by the specified `handle`.

## Remarks

If `*pObject` is null, the object wrapped by this handle is no longer alive and has been collected.

## Requirements

**Platforms:** See [.NET Core supported operating systems](../../../core/install/windows.md?pivots=os-windows).
**Header:** CorProf.idl, CorProf.h
**.NET Versions:** [!INCLUDE[net_core](../../../../includes/net-core-70-md.md)]

## See also

- [Profiling Interfaces](profiling-interfaces.md)
- [ICorProfilerInfo13 Interface](icorprofilerinfo13-interface.md)
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
description: "Learn more about: ICorProfilerInfo13 Interface"
title: "ICorProfilerInfo13 Interface"
ms.date: "03/19/2021"
api_name:
- "ICorProfilerInfo13"
api_location:
- "coreclr.dll"
- "corprof.idl"
api_type:
- "COM"
---
# ICorProfilerInfo13 Interface

A subclass of [ICorProfilerInfo12](icorprofilerinfo12-interface.md) that provides methods to manage weak, strong, and pinned handles that wrap objects.

## Methods

|Method|Description|
|------------|-----------------|
|[CreateHandle Method](icorprofilerinfo13-createhandle-method.md)|Creates a weak, strong, or pinned handle wrapping an object.|
|[DestroyHandle Method](icorprofilerinfo13-destroyhandle-method.md)|Destroys a handle.|
|[GetObjectIDFromHandle Method](icorprofilerinfo13-getobjectidfromhandle-method.md)|Gets the object wrapped by a handle.|

## Requirements

**Platforms:** See [.NET Core supported operating systems](../../../core/install/windows.md?pivots=os-windows).
**Header:** CorProf.idl, CorProf.h
**.NET Versions:** [!INCLUDE[net_core](../../../../includes/net-core-70-md.md)]

## See also

- [Profiling Interfaces](profiling-interfaces.md)
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ Contains values that indicate how the [ICorProfilerInfo10::RequestReJITWithInlin

[COR_PRF_EVENTPIPE_LEVEL](cor-prf-eventpipe-level-enumeration.md)
Indicates the level of an EventPipe event.


[COR_PRF_HANDLE_TYPE](cor-prf-handle-type-enumeration.md)
Indicates the type of a handle in the [ICorProfilerInfo13::CreateHandle](icorprofilerinfo13-createhandle-method.md) API.

## Related Sections

[Profiling Overview](profiling-overview.md)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,12 @@ Provides methods to modify function IL, query information from the runtime, and
[ICorProfilerInfo11 Interface](icorprofilerinfo11-interface.md)
Provides methods to get and set environment variables in the process.

[ICorProfilerInf12 Interface](icorprofilerinfo12-interface.md)
[ICorProfilerInfo12 Interface](icorprofilerinfo12-interface.md)
Provides methods to create EventPipe sessions, events, and providers.

[ICorProfilerInfo13 Interface](icorprofilerinfo13-interface.md)
provides methods to manage weak, strong and pinned handles wrapping objects.

[ICorProfilerModuleEnum Interface](icorprofilermoduleenum-interface.md)
Provides methods to sequentially iterate through a collection of modules loaded by the application or the profiler.

Expand Down
11 changes: 11 additions & 0 deletions docs/framework/unmanaged-api/profiling/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,15 @@ items:
href: icorprofilerinfo12-eventpipestopsession-method.md
- name: EventPipeWriteEvent Method
href: icorprofilerinfo12-eventpipewriteevent-method.md
- name: ICorProfilerInfo13 Interface
href: icorprofilerinfo13-interface.md
items:
- name: CreateHandle Method
href: icorprofilerinfo13-createhandle-method.md
- name: DestroyHandle Method
href: icorprofilerinfo13-destroyhandle-method.md
- name: GetObjectIDFromHandle Method
href: icorprofilerinfo13-getobjectidfromhandle-method.md
- name: ICorProfilerModuleEnum Interface
href: icorprofilermoduleenum-interface.md
items:
Expand Down Expand Up @@ -629,6 +638,8 @@ items:
href: cor-prf-eventpipe-level-enumeration.md
- name: COR_PRF_EVENTPIPE_PARAM_TYPE Enumeration
href: cor-prf-eventpipe-param-type-enumeration.md
- name: COR_PRF_HANDLE_TYPE Enumeration
href: cor-prf-handle-type-enumeration.md
- name: Profiling Structures
href: profiling-structures.md
items:
Expand Down