Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYauk <33248368+Yauk@users.noreply.github.com>2021-07-11 01:23:25 +0300
committerGitHub <noreply@github.com>2021-07-11 01:23:25 +0300
commitfce412be7779966533b94ba879e98e4eecbd94fc (patch)
tree0125c7e3d0ba36cd240ec9ba6d254b9845b1a616 /src/coreclr/vm
parent960e7b352d5f4166193b2ca35c2f627ce0b60332 (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.inl8
-rw-r--r--src/coreclr/vm/gchelpers.cpp3
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);