From 97f8e107d09af551d059ead080cf352d47675157 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Tue, 23 Jun 2015 14:52:41 +0300 Subject: [PATCH] Add profiling callback events to indicate start/end of reclaim phase * alloc.c (GC_finish_collection): Send GC_EVENT_RECLAIM_START and GC_EVENT_RECLAIM_END to indicate objects marking phase start/end. * include/gc.h (GC_EventType): Add GC_EVENT_RECLAIM_START/END. --- alloc.c | 4 ++++ include/gc.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/alloc.c b/alloc.c index b22fd7dd..9eb1c06e 100644 --- a/alloc.c +++ b/alloc.c @@ -916,6 +916,8 @@ STATIC void GC_finish_collection(void) if (GC_print_stats) GET_TIME(start_time); # endif + if (GC_on_collection_event) + GC_on_collection_event(GC_EVENT_RECLAIM_START); # ifndef GC_GET_HEAP_USAGE_NOT_NEEDED if (GC_bytes_found > 0) @@ -1021,6 +1023,8 @@ STATIC void GC_finish_collection(void) IF_USE_MUNMAP(GC_unmap_old()); + if (GC_on_collection_event) + GC_on_collection_event(GC_EVENT_RECLAIM_END); # ifndef SMALL_CONFIG if (GC_print_stats) { GET_TIME(done_time); diff --git a/include/gc.h b/include/gc.h index 80f8e63a..2916ae98 100644 --- a/include/gc.h +++ b/include/gc.h @@ -138,6 +138,8 @@ typedef enum { GC_EVENT_START /* COLLECTION */, GC_EVENT_MARK_START, GC_EVENT_MARK_END, + GC_EVENT_RECLAIM_START, + GC_EVENT_RECLAIM_END, GC_EVENT_END /* COLLECTION */, GC_EVENT_PRE_STOP_WORLD /* STOPWORLD_BEGIN */, GC_EVENT_POST_STOP_WORLD /* STOPWORLD_END */, -- 2.40.0