diff options
author | Yauk <33248368+Yauk@users.noreply.github.com> | 2021-07-11 01:23:25 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-11 01:23:25 +0300 |
commit | fce412be7779966533b94ba879e98e4eecbd94fc (patch) | |
tree | 0125c7e3d0ba36cd240ec9ba6d254b9845b1a616 /src/coreclr/inc | |
parent | 960e7b352d5f4166193b2ca35c2f627ce0b60332 (diff) |
Support filtering ObjectAllocated callback for pinned object heap allocation only (#55448)
* Prototype allocation profiler
* Add callback for pinned objects
* Fix the build issue caused by corprof.idl change
* Improve the test
* Misc changes for the tests
Co-authored-by: Andrew Au <andrewau@microsoft.com>
Co-authored-by: Yauk Jia <yaujia@microsoft.com>
Diffstat (limited to 'src/coreclr/inc')
-rw-r--r-- | src/coreclr/inc/corprof.idl | 3 | ||||
-rw-r--r-- | src/coreclr/inc/profilepriv.inl | 15 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/coreclr/inc/corprof.idl b/src/coreclr/inc/corprof.idl index 8fc965a84f6..d1c58f96cf9 100644 --- a/src/coreclr/inc/corprof.idl +++ b/src/coreclr/inc/corprof.idl @@ -667,6 +667,9 @@ typedef enum COR_PRF_HIGH_MONITOR_EVENT_PIPE = 0x00000080, + // Enables the pinned object allocation monitoring. + COR_PRF_HIGH_MONITOR_PINNEDOBJECT_ALLOCATED = 0x00000100, + COR_PRF_HIGH_ALLOWABLE_AFTER_ATTACH = COR_PRF_HIGH_IN_MEMORY_SYMBOLS_UPDATED | COR_PRF_HIGH_MONITOR_DYNAMIC_FUNCTION_UNLOADS | COR_PRF_HIGH_BASIC_GC | diff --git a/src/coreclr/inc/profilepriv.inl b/src/coreclr/inc/profilepriv.inl index 08ba58f5623..e99591c5ffd 100644 --- a/src/coreclr/inc/profilepriv.inl +++ b/src/coreclr/inc/profilepriv.inl @@ -1860,6 +1860,21 @@ inline BOOL CORProfilerTrackLargeAllocations() (&g_profControlBlock)->globalEventMask.IsEventMaskHighSet(COR_PRF_HIGH_MONITOR_LARGEOBJECT_ALLOCATED)); } +inline BOOL CORProfilerTrackPinnedAllocations() +{ + CONTRACTL + { + NOTHROW; + GC_NOTRIGGER; + CANNOT_TAKE_LOCK; + } + CONTRACTL_END; + + return + (CORProfilerPresent() && + (&g_profControlBlock)->globalEventMask.IsEventMaskHighSet(COR_PRF_HIGH_MONITOR_PINNEDOBJECT_ALLOCATED)); +} + inline BOOL CORProfilerEnableRejit() { CONTRACTL |