]> granicus.if.org Git - gc/commitdiff
Add profiling callback events to indicate start/end of reclaim phase
authorIvan Maidanski <ivmai@mail.ru>
Tue, 23 Jun 2015 11:52:41 +0000 (14:52 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 23 Jun 2015 11:52:41 +0000 (14:52 +0300)
* 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
include/gc.h

diff --git a/alloc.c b/alloc.c
index b22fd7dd05497a7f847c2676d04f78b347f4d3c1..9eb1c06e51641f3e341dcab8bd4bcdf3cbd4269b 100644 (file)
--- 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);
index 80f8e63a4d376850ab34abeb4d4ff31a110166b8..2916ae98d5ee3d9d1a4e2500364fbd9a0cc3a6ca 100644 (file)
@@ -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 */,