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/vm | |
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/vm')
-rw-r--r-- | src/coreclr/vm/eeprofinterfaces.inl | 8 | ||||
-rw-r--r-- | src/coreclr/vm/gchelpers.cpp | 3 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/coreclr/vm/eeprofinterfaces.inl b/src/coreclr/vm/eeprofinterfaces.inl index 250b3700f80..da6e9788329 100644 --- a/src/coreclr/vm/eeprofinterfaces.inl +++ b/src/coreclr/vm/eeprofinterfaces.inl @@ -31,5 +31,13 @@ FORCEINLINE BOOL TrackLargeAllocations() #endif // PROFILING_SUPPORTED } +FORCEINLINE BOOL TrackPinnedAllocations() +{ +#ifdef PROFILING_SUPPORTED + return CORProfilerTrackPinnedAllocations(); +#else + return FALSE; +#endif // PROFILING_SUPPORTED +} #endif diff --git a/src/coreclr/vm/gchelpers.cpp b/src/coreclr/vm/gchelpers.cpp index 0cecfc624a7..01ffd5305d9 100644 --- a/src/coreclr/vm/gchelpers.cpp +++ b/src/coreclr/vm/gchelpers.cpp @@ -324,7 +324,8 @@ void PublishObjectAndNotify(TObj* &orObject, GC_ALLOC_FLAGS flags) // Notify the profiler of the allocation // do this after initializing bounds so callback has size information if (TrackAllocations() || - (TrackLargeAllocations() && flags & GC_ALLOC_LARGE_OBJECT_HEAP)) + (TrackLargeAllocations() && flags & GC_ALLOC_LARGE_OBJECT_HEAP) || + (TrackPinnedAllocations() && flags & GC_ALLOC_PINNED_OBJECT_HEAP)) { OBJECTREF objref = ObjectToOBJECTREF((Object*)orObject); GCPROTECT_BEGIN(objref); |