From 85319015e69b83c0418a219c3de1ffe8da09ceaa Mon Sep 17 00:00:00 2001 From: Andrew Au Date: Sat, 22 May 2021 16:35:05 -0700 Subject: [PATCH 1/5] Prototype allocation profiler --- src/tests/profiler/gc/gcallocate.cs | 32 +++++++++++++++ src/tests/profiler/gc/gcallocate.csproj | 23 +++++++++++ src/tests/profiler/native/CMakeLists.txt | 1 + src/tests/profiler/native/classfactory.cpp | 2 + .../gcallocateprofiler/gcallocateprofiler.cpp | 40 +++++++++++++++++++ .../gcallocateprofiler/gcallocateprofiler.h | 21 ++++++++++ 6 files changed, 119 insertions(+) create mode 100644 src/tests/profiler/gc/gcallocate.cs create mode 100644 src/tests/profiler/gc/gcallocate.csproj create mode 100644 src/tests/profiler/native/gcallocateprofiler/gcallocateprofiler.cpp create mode 100644 src/tests/profiler/native/gcallocateprofiler/gcallocateprofiler.h diff --git a/src/tests/profiler/gc/gcallocate.cs b/src/tests/profiler/gc/gcallocate.cs new file mode 100644 index 00000000000000..fd339d194ba7c7 --- /dev/null +++ b/src/tests/profiler/gc/gcallocate.cs @@ -0,0 +1,32 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Threading; + +namespace Profiler.Tests +{ + class GCAllocateTests + { + static readonly Guid GcAllocateEventsProfilerGuid = new Guid("55b9554d-6115-45a2-be1e-c80f7fa35369"); + + public static int RunTest(String[] args) + { + int[] large = new int[100000]; + Console.WriteLine("Test Passed"); + return 100; + } + + public static int Main(string[] args) + { + if (args.Length > 0 && args[0].Equals("RunTest", StringComparison.OrdinalIgnoreCase)) + { + return RunTest(args); + } + + return ProfilerTestRunner.Run(profileePath: System.Reflection.Assembly.GetExecutingAssembly().Location, + testName: "GCCallbacksAllocate", + profilerClsid: GcAllocateEventsProfilerGuid); + } + } +} diff --git a/src/tests/profiler/gc/gcallocate.csproj b/src/tests/profiler/gc/gcallocate.csproj new file mode 100644 index 00000000000000..b2fbdc913b04a2 --- /dev/null +++ b/src/tests/profiler/gc/gcallocate.csproj @@ -0,0 +1,23 @@ + + + .NETCoreApp + exe + BuildAndRun + true + 0 + true + + true + + true + + + + + + + + diff --git a/src/tests/profiler/native/CMakeLists.txt b/src/tests/profiler/native/CMakeLists.txt index 9a0561c3e6d5ba..e068fdc1ea3cbd 100644 --- a/src/tests/profiler/native/CMakeLists.txt +++ b/src/tests/profiler/native/CMakeLists.txt @@ -7,6 +7,7 @@ set(SOURCES eventpipeprofiler/eventpipereadingprofiler.cpp eventpipeprofiler/eventpipewritingprofiler.cpp eventpipeprofiler/eventpipemetadatareader.cpp + gcallocateprofiler/gcallocateprofiler.cpp gcbasicprofiler/gcbasicprofiler.cpp gcprofiler/gcprofiler.cpp getappdomainstaticaddress/getappdomainstaticaddress.cpp diff --git a/src/tests/profiler/native/classfactory.cpp b/src/tests/profiler/native/classfactory.cpp index b41f6ba7bc9eff..fe999926de5b70 100644 --- a/src/tests/profiler/native/classfactory.cpp +++ b/src/tests/profiler/native/classfactory.cpp @@ -6,6 +6,7 @@ #include "eventpipeprofiler/eventpipereadingprofiler.h" #include "eventpipeprofiler/eventpipewritingprofiler.h" #include "getappdomainstaticaddress/getappdomainstaticaddress.h" +#include "gcallocateprofiler/gcallocateprofiler.h" #include "gcbasicprofiler/gcbasicprofiler.h" #include "gcprofiler/gcprofiler.h" #include "metadatagetdispenser/metadatagetdispenser.h" @@ -61,6 +62,7 @@ HRESULT STDMETHODCALLTYPE ClassFactory::CreateInstance(IUnknown *pUnkOuter, REFI //A little simplistic, we create an instance of every profiler, then return the one whose CLSID matches Profiler* profilers[] = { + new GCAllocateProfiler(), new GCBasicProfiler(), new ReJITProfiler(), new EventPipeReadingProfiler(), diff --git a/src/tests/profiler/native/gcallocateprofiler/gcallocateprofiler.cpp b/src/tests/profiler/native/gcallocateprofiler/gcallocateprofiler.cpp new file mode 100644 index 00000000000000..f6177b6ea93573 --- /dev/null +++ b/src/tests/profiler/native/gcallocateprofiler/gcallocateprofiler.cpp @@ -0,0 +1,40 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#include "gcallocateprofiler.h" + +GUID GCAllocateProfiler::GetClsid() +{ + // {55b9554d-6115-45a2-be1e-c80f7fa35369} + GUID clsid = { 0x55b9554d, 0x6115, 0x45a2,{ 0xbe, 0x1e, 0xc8, 0x0f, 0x7f, 0xa3, 0x53, 0x69 } }; + return clsid; +} + +HRESULT GCAllocateProfiler::Initialize(IUnknown* pICorProfilerInfoUnk) +{ + Profiler::Initialize(pICorProfilerInfoUnk); + + HRESULT hr = S_OK; + if (FAILED(hr = pCorProfilerInfo->SetEventMask2(COR_PRF_ENABLE_OBJECT_ALLOCATED, COR_PRF_HIGH_MONITOR_LARGEOBJECT_ALLOCATED))) + { + printf("FAIL: ICorProfilerInfo::SetEventMask2() failed hr=0x%x", hr); + return hr; + } + + return S_OK; +} + +HRESULT STDMETHODCALLTYPE GCAllocateProfiler::ObjectAllocated(ObjectID objectId, ClassID classId) +{ + assert (false); + return S_OK; +} + +HRESULT GCAllocateProfiler::Shutdown() +{ + Profiler::Shutdown(); + printf("PROFILER TEST PASSES\n"); + fflush(stdout); + + return S_OK; +} diff --git a/src/tests/profiler/native/gcallocateprofiler/gcallocateprofiler.h b/src/tests/profiler/native/gcallocateprofiler/gcallocateprofiler.h new file mode 100644 index 00000000000000..2af4cef848b45a --- /dev/null +++ b/src/tests/profiler/native/gcallocateprofiler/gcallocateprofiler.h @@ -0,0 +1,21 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#pragma once + +#include "../profiler.h" + +class GCAllocateProfiler : public Profiler +{ +public: + GCAllocateProfiler() : Profiler() + { + } + + virtual GUID GetClsid(); + virtual HRESULT STDMETHODCALLTYPE Initialize(IUnknown* pICorProfilerInfoUnk); + virtual HRESULT STDMETHODCALLTYPE ObjectAllocated(ObjectID objectId, ClassID classId); + virtual HRESULT STDMETHODCALLTYPE Shutdown(); + +private: +}; From e04eb104571aa72b7360a0ecb75b899d5df79cd5 Mon Sep 17 00:00:00 2001 From: Yauk Jia Date: Thu, 1 Jul 2021 12:15:14 -0700 Subject: [PATCH 2/5] Add callback for pinned objects --- src/coreclr/inc/corprof.idl | 3 +++ src/coreclr/inc/profilepriv.inl | 15 +++++++++++++++ src/coreclr/vm/eeprofinterfaces.inl | 8 ++++++++ src/coreclr/vm/gchelpers.cpp | 3 ++- .../gcallocateprofiler/gcallocateprofiler.cpp | 2 +- 5 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/coreclr/inc/corprof.idl b/src/coreclr/inc/corprof.idl index 8fc965a84f6b59..d1c58f96cf97c5 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 08ba58f5623f1c..0361af5e05e7d3 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)->dwEventMaskHigh & COR_PRF_HIGH_MONITOR_PINNEDOBJECT_ALLOCATED)); +} + inline BOOL CORProfilerEnableRejit() { CONTRACTL diff --git a/src/coreclr/vm/eeprofinterfaces.inl b/src/coreclr/vm/eeprofinterfaces.inl index 250b3700f801a9..da6e9788329683 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 0cecfc624a7445..01ffd5305d9f09 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); diff --git a/src/tests/profiler/native/gcallocateprofiler/gcallocateprofiler.cpp b/src/tests/profiler/native/gcallocateprofiler/gcallocateprofiler.cpp index f6177b6ea93573..b4ab9a772874a9 100644 --- a/src/tests/profiler/native/gcallocateprofiler/gcallocateprofiler.cpp +++ b/src/tests/profiler/native/gcallocateprofiler/gcallocateprofiler.cpp @@ -15,7 +15,7 @@ HRESULT GCAllocateProfiler::Initialize(IUnknown* pICorProfilerInfoUnk) Profiler::Initialize(pICorProfilerInfoUnk); HRESULT hr = S_OK; - if (FAILED(hr = pCorProfilerInfo->SetEventMask2(COR_PRF_ENABLE_OBJECT_ALLOCATED, COR_PRF_HIGH_MONITOR_LARGEOBJECT_ALLOCATED))) + if (FAILED(hr = pCorProfilerInfo->SetEventMask2(COR_PRF_ENABLE_OBJECT_ALLOCATED, COR_PRF_HIGH_MONITOR_LARGEOBJECT_ALLOCATED | COR_PRF_HIGH_MONITOR_PINNEDOBJECT_ALLOCATED))) { printf("FAIL: ICorProfilerInfo::SetEventMask2() failed hr=0x%x", hr); return hr; From 9f418f3adf38cf0f6b3e6eeaa712f955e7d36e57 Mon Sep 17 00:00:00 2001 From: Yauk Jia Date: Fri, 2 Jul 2021 00:55:02 -0700 Subject: [PATCH 3/5] Fix the build issue caused by corprof.idl change --- src/coreclr/pal/prebuilt/inc/corprof.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/coreclr/pal/prebuilt/inc/corprof.h b/src/coreclr/pal/prebuilt/inc/corprof.h index 85ce86870bf8c0..e82623d0c09f0f 100644 --- a/src/coreclr/pal/prebuilt/inc/corprof.h +++ b/src/coreclr/pal/prebuilt/inc/corprof.h @@ -574,6 +574,7 @@ enum __MIDL___MIDL_itf_corprof_0000_0000_0006 COR_PRF_HIGH_REQUIRE_PROFILE_IMAGE = 0, COR_PRF_HIGH_MONITOR_LARGEOBJECT_ALLOCATED = 0x40, COR_PRF_HIGH_MONITOR_EVENT_PIPE = 0x80, + COR_PRF_HIGH_MONITOR_PINNEDOBJECT_ALLOCATED = 0x100, 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 ) | COR_PRF_HIGH_MONITOR_GC_MOVED_OBJECTS ) | COR_PRF_HIGH_MONITOR_LARGEOBJECT_ALLOCATED ) | COR_PRF_HIGH_MONITOR_EVENT_PIPE ) , COR_PRF_HIGH_ALLOWABLE_NOTIFICATION_PROFILER = ( ( ( ( ( ( COR_PRF_HIGH_IN_MEMORY_SYMBOLS_UPDATED | COR_PRF_HIGH_MONITOR_DYNAMIC_FUNCTION_UNLOADS ) | COR_PRF_HIGH_DISABLE_TIERED_COMPILATION ) | COR_PRF_HIGH_BASIC_GC ) | COR_PRF_HIGH_MONITOR_GC_MOVED_OBJECTS ) | COR_PRF_HIGH_MONITOR_LARGEOBJECT_ALLOCATED ) | COR_PRF_HIGH_MONITOR_EVENT_PIPE ) , COR_PRF_HIGH_MONITOR_IMMUTABLE = COR_PRF_HIGH_DISABLE_TIERED_COMPILATION From 6dc0a388d1512880259cbf8c61664394f4b1120f Mon Sep 17 00:00:00 2001 From: Yauk Jia Date: Thu, 8 Jul 2021 12:40:30 -0700 Subject: [PATCH 4/5] Improve the test --- src/tests/profiler/gc/gcallocate.cs | 1 + .../gcallocateprofiler/gcallocateprofiler.cpp | 20 +++++++++++++++++-- .../gcallocateprofiler/gcallocateprofiler.h | 9 ++++++--- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/tests/profiler/gc/gcallocate.cs b/src/tests/profiler/gc/gcallocate.cs index fd339d194ba7c7..b3fbfd9d29cfeb 100644 --- a/src/tests/profiler/gc/gcallocate.cs +++ b/src/tests/profiler/gc/gcallocate.cs @@ -13,6 +13,7 @@ class GCAllocateTests public static int RunTest(String[] args) { int[] large = new int[100000]; + int[] pinned = GC.AllocateArray(32, true); Console.WriteLine("Test Passed"); return 100; } diff --git a/src/tests/profiler/native/gcallocateprofiler/gcallocateprofiler.cpp b/src/tests/profiler/native/gcallocateprofiler/gcallocateprofiler.cpp index b4ab9a772874a9..b19c8cb5190a0c 100644 --- a/src/tests/profiler/native/gcallocateprofiler/gcallocateprofiler.cpp +++ b/src/tests/profiler/native/gcallocateprofiler/gcallocateprofiler.cpp @@ -26,14 +26,30 @@ HRESULT GCAllocateProfiler::Initialize(IUnknown* pICorProfilerInfoUnk) HRESULT STDMETHODCALLTYPE GCAllocateProfiler::ObjectAllocated(ObjectID objectId, ClassID classId) { - assert (false); + COR_PRF_GC_GENERATION_RANGE gen; + HRESULT hr = pCorProfilerInfo->GetObjectGeneration(objectId, &gen); + if (FAILED(hr)) + { + printf("GetObjectGeneration failed hr=0x%x\n", hr); + } + else if (gen.generation == COR_PRF_GC_PINNED_OBJECT_HEAP) + { + _gcPOHAllocations++; + } + else if (gen.generation == COR_PRF_GC_LARGE_OBJECT_HEAP) + { + _gcLOHAllocations++; + } + return S_OK; } HRESULT GCAllocateProfiler::Shutdown() { Profiler::Shutdown(); - printf("PROFILER TEST PASSES\n"); + assert(_gcPOHAllocations > 0); + assert(_gcLOHAllocations > 0); + printf("PROFILER TEST PASSES. PinnedObjectAllocations=%d, LargeObjectAllocations=%d.\n", (int)_gcPOHAllocations, (int)_gcLOHAllocations); fflush(stdout); return S_OK; diff --git a/src/tests/profiler/native/gcallocateprofiler/gcallocateprofiler.h b/src/tests/profiler/native/gcallocateprofiler/gcallocateprofiler.h index 2af4cef848b45a..afcc7a6fb148cb 100644 --- a/src/tests/profiler/native/gcallocateprofiler/gcallocateprofiler.h +++ b/src/tests/profiler/native/gcallocateprofiler/gcallocateprofiler.h @@ -8,9 +8,10 @@ class GCAllocateProfiler : public Profiler { public: - GCAllocateProfiler() : Profiler() - { - } + GCAllocateProfiler() : Profiler(), + _gcLOHAllocations(0), + _gcPOHAllocations(0) + {} virtual GUID GetClsid(); virtual HRESULT STDMETHODCALLTYPE Initialize(IUnknown* pICorProfilerInfoUnk); @@ -18,4 +19,6 @@ class GCAllocateProfiler : public Profiler virtual HRESULT STDMETHODCALLTYPE Shutdown(); private: + std::atomic _gcLOHAllocations; + std::atomic _gcPOHAllocations; }; From b3a07f1b2edf70b89804962e4fdc161680679ab2 Mon Sep 17 00:00:00 2001 From: Andrew Au Date: Fri, 9 Jul 2021 12:20:18 -0700 Subject: [PATCH 5/5] Misc changes for the tests --- src/coreclr/inc/profilepriv.inl | 2 +- .../gcallocateprofiler/gcallocateprofiler.cpp | 29 +++++++++++++++---- .../gcallocateprofiler/gcallocateprofiler.h | 4 ++- .../gcbasicprofiler/gcbasicprofiler.cpp | 4 +-- .../profiler/native/gcprofiler/gcprofiler.cpp | 2 +- 5 files changed, 30 insertions(+), 11 deletions(-) diff --git a/src/coreclr/inc/profilepriv.inl b/src/coreclr/inc/profilepriv.inl index 0361af5e05e7d3..e99591c5ffd18a 100644 --- a/src/coreclr/inc/profilepriv.inl +++ b/src/coreclr/inc/profilepriv.inl @@ -1872,7 +1872,7 @@ inline BOOL CORProfilerTrackPinnedAllocations() return (CORProfilerPresent() && - ((&g_profControlBlock)->dwEventMaskHigh & COR_PRF_HIGH_MONITOR_PINNEDOBJECT_ALLOCATED)); + (&g_profControlBlock)->globalEventMask.IsEventMaskHighSet(COR_PRF_HIGH_MONITOR_PINNEDOBJECT_ALLOCATED)); } inline BOOL CORProfilerEnableRejit() diff --git a/src/tests/profiler/native/gcallocateprofiler/gcallocateprofiler.cpp b/src/tests/profiler/native/gcallocateprofiler/gcallocateprofiler.cpp index b19c8cb5190a0c..20e029704301fc 100644 --- a/src/tests/profiler/native/gcallocateprofiler/gcallocateprofiler.cpp +++ b/src/tests/profiler/native/gcallocateprofiler/gcallocateprofiler.cpp @@ -15,7 +15,7 @@ HRESULT GCAllocateProfiler::Initialize(IUnknown* pICorProfilerInfoUnk) Profiler::Initialize(pICorProfilerInfoUnk); HRESULT hr = S_OK; - if (FAILED(hr = pCorProfilerInfo->SetEventMask2(COR_PRF_ENABLE_OBJECT_ALLOCATED, COR_PRF_HIGH_MONITOR_LARGEOBJECT_ALLOCATED | COR_PRF_HIGH_MONITOR_PINNEDOBJECT_ALLOCATED))) + if (FAILED(hr = pCorProfilerInfo->SetEventMask2(COR_PRF_ENABLE_OBJECT_ALLOCATED, COR_PRF_HIGH_BASIC_GC | COR_PRF_HIGH_MONITOR_LARGEOBJECT_ALLOCATED | COR_PRF_HIGH_MONITOR_PINNEDOBJECT_ALLOCATED))) { printf("FAIL: ICorProfilerInfo::SetEventMask2() failed hr=0x%x", hr); return hr; @@ -31,14 +31,20 @@ HRESULT STDMETHODCALLTYPE GCAllocateProfiler::ObjectAllocated(ObjectID objectId, if (FAILED(hr)) { printf("GetObjectGeneration failed hr=0x%x\n", hr); + _failures++; + } + else if (gen.generation == COR_PRF_GC_LARGE_OBJECT_HEAP) + { + _gcLOHAllocations++; } else if (gen.generation == COR_PRF_GC_PINNED_OBJECT_HEAP) { _gcPOHAllocations++; } - else if (gen.generation == COR_PRF_GC_LARGE_OBJECT_HEAP) + else { - _gcLOHAllocations++; + printf("Unexpected object allocation captured, gen.generation=0x%x\n", gen.generation); + _failures++; } return S_OK; @@ -47,9 +53,20 @@ HRESULT STDMETHODCALLTYPE GCAllocateProfiler::ObjectAllocated(ObjectID objectId, HRESULT GCAllocateProfiler::Shutdown() { Profiler::Shutdown(); - assert(_gcPOHAllocations > 0); - assert(_gcLOHAllocations > 0); - printf("PROFILER TEST PASSES. PinnedObjectAllocations=%d, LargeObjectAllocations=%d.\n", (int)_gcPOHAllocations, (int)_gcLOHAllocations); + if (_gcPOHAllocations == 0) + { + printf("There is no POH allocations\n"); + } + else if (_gcLOHAllocations == 0) + { + printf("There is no LOH allocations\n"); + } + else if (_failures == 0) + { + printf("%d LOH objects allocated\n", (int)_gcLOHAllocations); + printf("%d POH objects allocated\n", (int)_gcPOHAllocations); + printf("PROFILER TEST PASSES\n"); + } fflush(stdout); return S_OK; diff --git a/src/tests/profiler/native/gcallocateprofiler/gcallocateprofiler.h b/src/tests/profiler/native/gcallocateprofiler/gcallocateprofiler.h index afcc7a6fb148cb..65fb3b16240e0a 100644 --- a/src/tests/profiler/native/gcallocateprofiler/gcallocateprofiler.h +++ b/src/tests/profiler/native/gcallocateprofiler/gcallocateprofiler.h @@ -10,7 +10,8 @@ class GCAllocateProfiler : public Profiler public: GCAllocateProfiler() : Profiler(), _gcLOHAllocations(0), - _gcPOHAllocations(0) + _gcPOHAllocations(0), + _failures(0) {} virtual GUID GetClsid(); @@ -21,4 +22,5 @@ class GCAllocateProfiler : public Profiler private: std::atomic _gcLOHAllocations; std::atomic _gcPOHAllocations; + std::atomic _failures; }; diff --git a/src/tests/profiler/native/gcbasicprofiler/gcbasicprofiler.cpp b/src/tests/profiler/native/gcbasicprofiler/gcbasicprofiler.cpp index a9f28011eb02bf..6d377e6d115beb 100644 --- a/src/tests/profiler/native/gcbasicprofiler/gcbasicprofiler.cpp +++ b/src/tests/profiler/native/gcbasicprofiler/gcbasicprofiler.cpp @@ -15,7 +15,7 @@ HRESULT GCBasicProfiler::Initialize(IUnknown* pICorProfilerInfoUnk) Profiler::Initialize(pICorProfilerInfoUnk); HRESULT hr = S_OK; - if (FAILED(hr = pCorProfilerInfo->SetEventMask2(0, 0x10))) + if (FAILED(hr = pCorProfilerInfo->SetEventMask2(0, COR_PRF_HIGH_BASIC_GC))) { _failures++; printf("FAIL: ICorProfilerInfo::SetEventMask2() failed hr=0x%x", hr); @@ -31,7 +31,7 @@ HRESULT GCBasicProfiler::Shutdown() if (_gcStarts == 0) { - printf("GCBasicProfiler::Shutdown: FAIL: Expected GarbaseCollectionStarted to be called\n"); + printf("GCBasicProfiler::Shutdown: FAIL: Expected GarbageCollectionStarted to be called\n"); } else if (_gcFinishes == 0) { diff --git a/src/tests/profiler/native/gcprofiler/gcprofiler.cpp b/src/tests/profiler/native/gcprofiler/gcprofiler.cpp index 0fa298f59f3b9d..42666a2d8eac82 100644 --- a/src/tests/profiler/native/gcprofiler/gcprofiler.cpp +++ b/src/tests/profiler/native/gcprofiler/gcprofiler.cpp @@ -31,7 +31,7 @@ HRESULT GCProfiler::Shutdown() if (_gcStarts == 0) { - printf("GCProfiler::Shutdown: FAIL: Expected GarbaseCollectionStarted to be called\n"); + printf("GCProfiler::Shutdown: FAIL: Expected GarbageCollectionStarted to be called\n"); } else if (_gcFinishes == 0) {