diff options
-rw-r--r-- | src/gc/gc.cpp | 64 | ||||
-rw-r--r-- | src/gc/gcevents.h | 20 | ||||
-rw-r--r-- | src/gc/gcinterface.ee.h | 51 | ||||
-rw-r--r-- | src/gc/gcinterface.h | 6 | ||||
-rw-r--r-- | src/gc/handletable.cpp | 11 | ||||
-rw-r--r-- | src/vm/gctoclreventsink.cpp | 123 | ||||
-rw-r--r-- | src/vm/gctoclreventsink.h | 34 |
7 files changed, 270 insertions, 39 deletions
diff --git a/src/gc/gc.cpp b/src/gc/gc.cpp index 445812cd40..706c805db5 100644 --- a/src/gc/gc.cpp +++ b/src/gc/gc.cpp @@ -3000,23 +3000,23 @@ void gc_history_global::print() void gc_heap::fire_per_heap_hist_event (gc_history_per_heap* current_gc_data_per_heap, int heap_num) { maxgen_size_increase* maxgen_size_info = &(current_gc_data_per_heap->maxgen_size_info); - FireEtwGCPerHeapHistory_V3(GetClrInstanceId(), - (uint8_t*)(maxgen_size_info->free_list_allocated), - (uint8_t*)(maxgen_size_info->free_list_rejected), - (uint8_t*)(maxgen_size_info->end_seg_allocated), - (uint8_t*)(maxgen_size_info->condemned_allocated), - (uint8_t*)(maxgen_size_info->pinned_allocated), - (uint8_t*)(maxgen_size_info->pinned_allocated_advance), - maxgen_size_info->running_free_list_efficiency, - current_gc_data_per_heap->gen_to_condemn_reasons.get_reasons0(), - current_gc_data_per_heap->gen_to_condemn_reasons.get_reasons1(), - current_gc_data_per_heap->mechanisms[gc_heap_compact], - current_gc_data_per_heap->mechanisms[gc_heap_expand], - current_gc_data_per_heap->heap_index, - (uint8_t*)(current_gc_data_per_heap->extra_gen0_committed), - (max_generation + 2), - sizeof (gc_generation_data), - &(current_gc_data_per_heap->gen_data[0])); + FIRE_EVENT(GCPerHeapHistory_V3, + (void *)(maxgen_size_info->free_list_allocated), + (void *)(maxgen_size_info->free_list_rejected), + (void *)(maxgen_size_info->end_seg_allocated), + (void *)(maxgen_size_info->condemned_allocated), + (void *)(maxgen_size_info->pinned_allocated), + (void *)(maxgen_size_info->pinned_allocated_advance), + maxgen_size_info->running_free_list_efficiency, + current_gc_data_per_heap->gen_to_condemn_reasons.get_reasons0(), + current_gc_data_per_heap->gen_to_condemn_reasons.get_reasons1(), + current_gc_data_per_heap->mechanisms[gc_heap_compact], + current_gc_data_per_heap->mechanisms[gc_heap_expand], + current_gc_data_per_heap->heap_index, + (void *)(current_gc_data_per_heap->extra_gen0_committed), + (max_generation + 2), + (uint32_t)(sizeof (gc_generation_data)), + (void *)&(current_gc_data_per_heap->gen_data[0])); current_gc_data_per_heap->print(); current_gc_data_per_heap->gen_to_condemn_reasons.print (heap_num); @@ -9750,11 +9750,11 @@ void fire_alloc_wait_event (alloc_wait_reason awr, BOOL begin_p) { if (begin_p) { - FireEtwBGCAllocWaitBegin (awr, GetClrInstanceId()); + FIRE_EVENT(BGCAllocWaitBegin, awr); } else { - FireEtwBGCAllocWaitEnd (awr, GetClrInstanceId()); + FIRE_EVENT(BGCAllocWaitEnd, awr); } } } @@ -11750,7 +11750,7 @@ void gc_heap::send_full_gc_notification (int gen_num, BOOL due_to_alloc_p) if (!full_gc_approach_event_set) { assert (full_gc_approach_event.IsValid()); - FireEtwGCFullNotify_V1 (gen_num, due_to_alloc_p, GetClrInstanceId()); + FIRE_EVENT(GCFullNotify_V1, gen_num, due_to_alloc_p); full_gc_end_event.Reset(); full_gc_approach_event.Set(); @@ -15234,12 +15234,10 @@ void gc_heap::init_background_gc () #endif //BACKGROUND_GC -#define fire_bgc_event(x) { FireEtw##x(GetClrInstanceId()); } - inline void fire_drain_mark_list_event (size_t mark_list_objects) { - FireEtwBGCDrainMark (mark_list_objects, GetClrInstanceId()); + FIRE_EVENT(BGCDrainMark, mark_list_objects); } inline @@ -15247,7 +15245,7 @@ void fire_revisit_event (size_t dirtied_pages, size_t marked_objects, BOOL large_objects_p) { - FireEtwBGCRevisit (dirtied_pages, marked_objects, large_objects_p, GetClrInstanceId()); + FIRE_EVENT(BGCRevisit, dirtied_pages, marked_objects, large_objects_p); } inline @@ -15256,9 +15254,7 @@ void fire_overflow_event (uint8_t* overflow_min, size_t marked_objects, int large_objects_p) { - FireEtwBGCOverflow ((uint64_t)overflow_min, (uint64_t)overflow_max, - marked_objects, large_objects_p, - GetClrInstanceId()); + FIRE_EVENT(BGCOverflow, (uint64_t)overflow_min, (uint64_t)overflow_max, marked_objects, large_objects_p); } void gc_heap::concurrent_print_time_delta (const char* msg) @@ -15383,7 +15379,7 @@ void gc_heap::gc1() time_bgc_last = GetHighPrecisionTimeStamp(); #endif //TRACE_GC - fire_bgc_event (BGCBegin); + FIRE_EVENT(BGCBegin); concurrent_print_time_delta ("BGC"); @@ -25664,7 +25660,7 @@ void gc_heap::background_mark_phase () //concurrent_print_time_delta ("copying stack roots"); concurrent_print_time_delta ("CS"); - fire_bgc_event (BGC1stNonConEnd); + FIRE_EVENT(BGC1stNonConEnd); expanded_in_fgc = FALSE; saved_overflow_ephemeral_seg = 0; @@ -25859,7 +25855,7 @@ void gc_heap::background_mark_phase () concurrent_print_time_delta ("CRov"); // Stop all threads, crawl all stacks and revisit changed pages. - fire_bgc_event (BGC1stConEnd); + FIRE_EVENT(BGC1stConEnd); dprintf (2, ("Stopping the EE")); @@ -25903,7 +25899,7 @@ void gc_heap::background_mark_phase () //concurrent_print_time_delta ("concurrent marking ended"); concurrent_print_time_delta ("CR"); - fire_bgc_event (BGC2ndNonConBegin); + FIRE_EVENT(BGC2ndNonConBegin); mark_absorb_new_alloc(); @@ -31305,7 +31301,7 @@ void gc_heap::background_sweep() generation_allocation_segment (gen_to_reset) = heap_segment_rw (generation_start_segment (gen_to_reset)); } - fire_bgc_event (BGC2ndNonConEnd); + FIRE_EVENT(BGC2ndNonConEnd); current_bgc_state = bgc_sweep_soh; verify_soh_segment_list(); @@ -31351,7 +31347,7 @@ void gc_heap::background_sweep() restart_EE (); } - fire_bgc_event (BGC2ndConBegin); + FIRE_EVENT(BGC2ndConBegin); background_ephemeral_sweep(); @@ -31577,7 +31573,7 @@ void gc_heap::background_sweep() generation_free_list_space (generation_of (max_generation + 1)), generation_free_obj_space (generation_of (max_generation + 1)))); - fire_bgc_event (BGC2ndConEnd); + FIRE_EVENT(BGC2ndConEnd); concurrent_print_time_delta ("background sweep"); heap_segment* reset_seg = heap_segment_rw (generation_start_segment (generation_of (max_generation))); diff --git a/src/gc/gcevents.h b/src/gc/gcevents.h index 94087d7171..974348a967 100644 --- a/src/gc/gcevents.h +++ b/src/gc/gcevents.h @@ -9,5 +9,25 @@ #define DYNAMIC_EVENT(name, level, keyword, ...) #endif // DYNAMIC_EVENT +KNOWN_EVENT(SetGCHandle, GCEventProvider_Default, GCEventLevel_Information, GCEventKeyword_GCHandle) +KNOWN_EVENT(DestroyGCHandle, GCEventProvider_Default, GCEventLevel_Information, GCEventKeyword_GCHandle) +KNOWN_EVENT(GCPerHeapHistory_V3, GCEventProvider_Default, GCEventLevel_Information, GCEventKeyword_GCPrivate) + +KNOWN_EVENT(BGCBegin, GCEventProvider_Private, GCEventLevel_Information, GCEventKeyword_GCPrivate) +KNOWN_EVENT(BGC1stNonConEnd, GCEventProvider_Private, GCEventLevel_Information, GCEventKeyword_GCPrivate) +KNOWN_EVENT(BGC1stConEnd, GCEventProvider_Private, GCEventLevel_Information, GCEventKeyword_GCPrivate) +KNOWN_EVENT(BGC2ndNonConBegin, GCEventProvider_Private, GCEventLevel_Information, GCEventKeyword_GCPrivate) +KNOWN_EVENT(BGC2ndNonConEnd, GCEventProvider_Private, GCEventLevel_Information, GCEventKeyword_GCPrivate) +KNOWN_EVENT(BGC2ndConBegin, GCEventProvider_Private, GCEventLevel_Information, GCEventKeyword_GCPrivate) +KNOWN_EVENT(BGC2ndConEnd, GCEventProvider_Private, GCEventLevel_Information, GCEventKeyword_GCPrivate) +KNOWN_EVENT(BGCDrainMark, GCEventProvider_Private, GCEventLevel_Information, GCEventKeyword_GCPrivate) +KNOWN_EVENT(BGCRevisit, GCEventProvider_Private, GCEventLevel_Information, GCEventKeyword_GCPrivate) +KNOWN_EVENT(BGCOverflow, GCEventProvider_Private, GCEventLevel_Information, GCEventKeyword_GCPrivate) +KNOWN_EVENT(BGCAllocWaitBegin, GCEventProvider_Private, GCEventLevel_Information, GCEventKeyword_GCPrivate) +KNOWN_EVENT(BGCAllocWaitEnd, GCEventProvider_Private, GCEventLevel_Information, GCEventKeyword_GCPrivate) +KNOWN_EVENT(GCFullNotify_V1, GCEventProvider_Private, GCEventLevel_Information, GCEventKeyword_GCPrivate) +KNOWN_EVENT(PrvSetGCHandle, GCEventProvider_Private, GCEventLevel_Information, GCEventKeyword_GCHandlePrivate) +KNOWN_EVENT(PrvDestroyGCHandle, GCEventProvider_Private, GCEventLevel_Information, GCEventKeyword_GCHandlePrivate) + #undef KNOWN_EVENT #undef DYNAMIC_EVENT diff --git a/src/gc/gcinterface.ee.h b/src/gc/gcinterface.ee.h index 657e16ebb1..a153c1d0f1 100644 --- a/src/gc/gcinterface.ee.h +++ b/src/gc/gcinterface.ee.h @@ -25,6 +25,57 @@ public: const char* eventName, void* payload, uint32_t payloadSize) = 0; + virtual + void FireGCPerHeapHistory_V3(void *freeListAllocated, + void *freeListRejected, + void *endOfSegAllocated, + void *condemnedAllocated, + void *pinnedAllocated, + void *pinnedAllocatedAdvance, + uint32_t runningFreeListEfficiency, + uint32_t condemnReasons0, + uint32_t condemnReasons1, + uint32_t compactMechanisms, + uint32_t expandMechanisms, + uint32_t heapIndex, + void *extraGen0Commit, + uint32_t count, + uint32_t valuesLen, + void *values) = 0; + virtual + void FireBGCBegin() = 0; + virtual + void FireBGC1stNonConEnd() = 0; + virtual + void FireBGC1stConEnd() = 0; + virtual + void FireBGC2ndNonConBegin() = 0; + virtual + void FireBGC2ndNonConEnd() = 0; + virtual + void FireBGC2ndConBegin() = 0; + virtual + void FireBGC2ndConEnd() = 0; + virtual + void FireBGCDrainMark(uint64_t objects) = 0; + virtual + void FireBGCRevisit(uint64_t pages, uint64_t objects, uint32_t isLarge) = 0; + virtual + void FireBGCOverflow(uint64_t min, uint64_t max, uint64_t objects, uint32_t isLarge) = 0; + virtual + void FireBGCAllocWaitBegin(uint32_t reason) = 0; + virtual + void FireBGCAllocWaitEnd(uint32_t reason) = 0; + virtual + void FireGCFullNotify_V1(uint32_t genNumber, uint32_t isAlloc) = 0; + virtual + void FireSetGCHandle(void *handleID, void *objectID, uint32_t kind, uint32_t generation, uint64_t appDomainID) = 0; + virtual + void FirePrvSetGCHandle(void *handleID, void *objectID, uint32_t kind, uint32_t generation, uint64_t appDomainID) = 0; + virtual + void FireDestroyGCHandle(void *handleID) = 0; + virtual + void FirePrvDestroyGCHandle(void *handleID) = 0; }; // This interface provides the interface that the GC will use to speak to the rest diff --git a/src/gc/gcinterface.h b/src/gc/gcinterface.h index 26e7c096d2..2b983857a1 100644 --- a/src/gc/gcinterface.h +++ b/src/gc/gcinterface.h @@ -224,7 +224,11 @@ enum GCEventKeyword { GCEventKeyword_None = 0x0, GCEventKeyword_GC = 0x1, + // Duplicate on purpose, GCPrivate is the same keyword as GC, + // with a different provider + GCEventKeyword_GCPrivate = 0x1, GCEventKeyword_GCHandle = 0x2, + GCEventKeyword_GCHandlePrivate = 0x4000, GCEventKeyword_GCHeapDump = 0x100000, GCEventKeyword_GCSampledObjectAllocationHigh = 0x200000, GCEventKeyword_GCHeapSurvivalAndMovement = 0x400000, @@ -232,7 +236,9 @@ enum GCEventKeyword GCEventKeyword_GCHeapAndTypeNames = 0x1000000, GCEventKeyword_GCSampledObjectAllocationLow = 0x2000000, GCEventKeyword_All = GCEventKeyword_GC + | GCEventKeyword_GCPrivate | GCEventKeyword_GCHandle + | GCEventKeyword_GCHandlePrivate | GCEventKeyword_GCHeapDump | GCEventKeyword_GCSampledObjectAllocationHigh | GCEventKeyword_GCHeapDump diff --git a/src/gc/handletable.cpp b/src/gc/handletable.cpp index 416363c7bc..4d42dda3b5 100644 --- a/src/gc/handletable.cpp +++ b/src/gc/handletable.cpp @@ -16,6 +16,7 @@ #include "gcenv.h" #include "gc.h" +#include "gceventstatus.h" #include "objecthandle.h" #include "handletablepriv.h" @@ -443,8 +444,8 @@ void HndDestroyHandle(HHANDLETABLE hTable, uint32_t uType, OBJECTHANDLE handle) STRESS_LOG2(LF_GC, LL_INFO1000, "DestroyHandle: *%p->%p\n", handle, *(_UNCHECKED_OBJECTREF *)handle); - FireEtwDestroyGCHandle((void*) handle, GetClrInstanceId()); - FireEtwPrvDestroyGCHandle((void*) handle, GetClrInstanceId()); + FIRE_EVENT(DestroyGCHandle, (void *)handle); + FIRE_EVENT(PrvDestroyGCHandle, (void *)handle); // sanity check handle we are being asked to free _ASSERTE(handle); @@ -601,8 +602,8 @@ void HndLogSetEvent(OBJECTHANDLE handle, _UNCHECKED_OBJECTREF value) ADIndex appDomainIndex = HndGetHandleADIndex(handle); AppDomain* pAppDomain = SystemDomain::GetAppDomainAtIndex(appDomainIndex); uint32_t generation = value != 0 ? g_theGCHeap->WhichGeneration(value) : 0; - FireEtwSetGCHandle((void*) handle, value, hndType, generation, (int64_t) pAppDomain, GetClrInstanceId()); - FireEtwPrvSetGCHandle((void*) handle, value, hndType, generation, (int64_t) pAppDomain, GetClrInstanceId()); + FIRE_EVENT(SetGCHandle, (void *)handle, (void *)value, hndType, generation, (uint64_t)pAppDomain); + FIRE_EVENT(PrvSetGCHandle, (void *) handle, (void *)value, hndType, generation, (uint64_t)pAppDomain); // Also fire the things pinned by Async pinned handles if (hndType == HNDTYPE_ASYNCPINNED) @@ -626,7 +627,7 @@ void HndLogSetEvent(OBJECTHANDLE handle, _UNCHECKED_OBJECTREF value) { ClosureCapture* captured = reinterpret_cast<ClosureCapture*>(ctx); uint32_t generation = to != nullptr ? g_theGCHeap->WhichGeneration(to) : 0; - FireEtwSetGCHandle(captured->overlapped, to, HNDTYPE_PINNED, generation, (int64_t) captured->pAppDomain, GetClrInstanceId()); + FIRE_EVENT(SetGCHandle, (void *)captured->overlapped, (void *)to, HNDTYPE_PINNED, generation, (uint64_t)captured->pAppDomain); }); } } diff --git a/src/vm/gctoclreventsink.cpp b/src/vm/gctoclreventsink.cpp index 001dafe4d0..3842babd90 100644 --- a/src/vm/gctoclreventsink.cpp +++ b/src/vm/gctoclreventsink.cpp @@ -21,3 +21,126 @@ void GCToCLREventSink::FireDynamicEvent(const char* eventName, void* payload, ui FireEtwGCDynamicEvent(wideEventName, payloadSize, (const BYTE*)payload, GetClrInstanceId()); } + +void GCToCLREventSink::FireGCPerHeapHistory_V3(void *freeListAllocated, + void *freeListRejected, + void *endOfSegAllocated, + void *condemnedAllocated, + void *pinnedAllocated, + void *pinnedAllocatedAdvance, + uint32_t runningFreeListEfficiency, + uint32_t condemnReasons0, + uint32_t condemnReasons1, + uint32_t compactMechanisms, + uint32_t expandMechanisms, + uint32_t heapIndex, + void *extraGen0Commit, + uint32_t count, + uint32_t valuesLen, + void *values) +{ + FireEtwGCPerHeapHistory_V3(GetClrInstanceId(), + freeListAllocated, + freeListRejected, + endOfSegAllocated, + condemnedAllocated, + pinnedAllocated, + pinnedAllocatedAdvance, + runningFreeListEfficiency, + condemnReasons0, + condemnReasons1, + compactMechanisms, + expandMechanisms, + heapIndex, + extraGen0Commit, + count, + valuesLen, + values); +} + + + +void GCToCLREventSink::FireBGCBegin() +{ + FireEtwBGCBegin(GetClrInstanceId()); +} + +void GCToCLREventSink::FireBGC1stNonConEnd() +{ + FireEtwBGC1stNonConEnd(GetClrInstanceId()); +} + +void GCToCLREventSink::FireBGC1stConEnd() +{ + FireEtwBGC1stConEnd(GetClrInstanceId()); +} + +void GCToCLREventSink::FireBGC2ndNonConBegin() +{ + FireEtwBGC2ndNonConBegin(GetClrInstanceId()); +} + +void GCToCLREventSink::FireBGC2ndNonConEnd() +{ + FireEtwBGC2ndNonConEnd(GetClrInstanceId()); +} + +void GCToCLREventSink::FireBGC2ndConBegin() +{ + FireEtwBGC2ndConBegin(GetClrInstanceId()); +} + +void GCToCLREventSink::FireBGC2ndConEnd() +{ + FireEtwBGC2ndConEnd(GetClrInstanceId()); +} + +void GCToCLREventSink::FireBGCDrainMark(uint64_t objects) +{ + FireEtwBGCDrainMark(objects, GetClrInstanceId()); +} + +void GCToCLREventSink::FireBGCRevisit(uint64_t pages, uint64_t objects, uint32_t isLarge) +{ + FireEtwBGCRevisit(pages, objects, isLarge, GetClrInstanceId()); +} + +void GCToCLREventSink::FireBGCOverflow(uint64_t min, uint64_t max, uint64_t objects, uint32_t isLarge) +{ + FireEtwBGCOverflow(min, max, objects, isLarge, GetClrInstanceId()); +} + +void GCToCLREventSink::FireBGCAllocWaitBegin(uint32_t reason) +{ + FireEtwBGCAllocWaitBegin(reason, GetClrInstanceId()); +} + +void GCToCLREventSink::FireBGCAllocWaitEnd(uint32_t reason) +{ + FireEtwBGCAllocWaitEnd(reason, GetClrInstanceId()); +} + +void GCToCLREventSink::FireGCFullNotify_V1(uint32_t genNumber, uint32_t isAlloc) +{ + FireEtwGCFullNotify_V1(genNumber, isAlloc, GetClrInstanceId()); +} + +void GCToCLREventSink::FireSetGCHandle(void *handleID, void *objectID, uint32_t kind, uint32_t generation, uint64_t appDomainID) +{ + FireEtwSetGCHandle(handleID, objectID, kind, generation, appDomainID, GetClrInstanceId()); +} + +void GCToCLREventSink::FirePrvSetGCHandle(void *handleID, void *objectID, uint32_t kind, uint32_t generation, uint64_t appDomainID) +{ + FireEtwPrvSetGCHandle(handleID, objectID, kind, generation, appDomainID, GetClrInstanceId()); +} + +void GCToCLREventSink::FireDestroyGCHandle(void *handleID) +{ + FireEtwDestroyGCHandle(handleID, GetClrInstanceId()); +} + +void GCToCLREventSink::FirePrvDestroyGCHandle(void *handleID) +{ + FireEtwPrvDestroyGCHandle(handleID, GetClrInstanceId()); +} diff --git a/src/vm/gctoclreventsink.h b/src/vm/gctoclreventsink.h index 87e66592c4..ca3a219f30 100644 --- a/src/vm/gctoclreventsink.h +++ b/src/vm/gctoclreventsink.h @@ -11,6 +11,40 @@ class GCToCLREventSink : public IGCToCLREventSink { public: void FireDynamicEvent(const char* eventName, void* payload, uint32_t payloadSize); + + void FireGCPerHeapHistory_V3(void *freeListAllocated, + void *freeListRejected, + void *endOfSegAllocated, + void *condemnedAllocated, + void *pinnedAllocated, + void *pinnedAllocatedAdvance, + uint32_t runningFreeListEfficiency, + uint32_t condemnReasons0, + uint32_t condemnReasons1, + uint32_t compactMechanisms, + uint32_t expandMechanisms, + uint32_t heapIndex, + void *extraGen0Commit, + uint32_t count, + uint32_t valuesLen, + void *values); + void FireBGCBegin(); + void FireBGC1stNonConEnd(); + void FireBGC1stConEnd(); + void FireBGC2ndNonConBegin(); + void FireBGC2ndNonConEnd(); + void FireBGC2ndConBegin(); + void FireBGC2ndConEnd(); + void FireBGCDrainMark(uint64_t objects); + void FireBGCRevisit(uint64_t pages, uint64_t objects, uint32_t isLarge); + void FireBGCOverflow(uint64_t min, uint64_t max, uint64_t objects, uint32_t isLarge); + void FireBGCAllocWaitBegin(uint32_t reason); + void FireBGCAllocWaitEnd(uint32_t reason); + void FireGCFullNotify_V1(uint32_t genNumber, uint32_t isAlloc); + void FireSetGCHandle(void *handleID, void *objectID, uint32_t kind, uint32_t generation, uint64_t appDomainID); + void FirePrvSetGCHandle(void *handleID, void *objectID, uint32_t kind, uint32_t generation, uint64_t appDomainID); + void FireDestroyGCHandle(void *handleID); + void FirePrvDestroyGCHandle(void *handleID); }; extern GCToCLREventSink g_gcToClrEventSink; |