* src/vmcore/rt-timing.h: Added gc rt-timing defines.
authormichi <none@none>
Fri, 2 Mar 2007 22:47:11 +0000 (22:47 +0000)
committermichi <none@none>
Fri, 2 Mar 2007 22:47:11 +0000 (22:47 +0000)
* src/vmcore/rt-timing.c [ENABLE_GC_CACAO]: Added gc rt-timing entries.
* src/mm/cacao-gc/gc.c: Added realtime-timing.

* src/mm/cacao-gc/heap.h: Removed unused global variables.

--HG--
branch : exact-gc

src/mm/cacao-gc/gc.c
src/mm/cacao-gc/heap.h
src/vmcore/rt-timing.c
src/vmcore/rt-timing.h

index 37659bcab4671f68cff2ab7fc244020355351a52..e9c0714ae5604163fa16ad95ba7bc964b6f2366e 100644 (file)
@@ -52,6 +52,7 @@
 #include "toolbox/logging.h"
 #include "vm/finalizer.h"
 #include "vm/vm.h"
+#include "vmcore/rt-timing.h"
 
 
 /* Global Variables ***********************************************************/
@@ -92,10 +93,6 @@ void gc_init(u4 heapmaxsize, u4 heapstartsize)
 
        heap_current_size = heapstartsize;
        heap_maximal_size = heapmaxsize;
-
-       /* TODO: remove these */
-       heap_free_size = heap_current_size;
-       heap_used_size = 0;
 }
 
 
@@ -116,10 +113,15 @@ void gc_collect(s4 level)
 {
        rootset_t    *rs;
        s4            dumpsize;
+#if defined(ENABLE_RT_TIMING)
+       struct timespec time_start, time_suspend, time_rootset, time_mark, time_compact, time_end;
+#endif
 
        /* remember start of dump memory area */
        dumpsize = dump_size();
 
+       RT_TIMING_GET_TIME(time_start);
+
        /* finalizer is not notified, unless marking tells us to do so */
        gc_notify_finalizer = false;
 
@@ -132,10 +134,14 @@ void gc_collect(s4 level)
 
        /* TODO: stop-the-world here!!! */
 
+       RT_TIMING_GET_TIME(time_suspend);
+
        /* find the global and local rootsets */
        rs = rootset_readout();
        GC_LOG( rootset_print(rs); );
 
+       RT_TIMING_GET_TIME(time_rootset);
+
        /* check for reentrancy here */
        if (gc_running) {
                dolog("GC: REENTRANCY DETECTED, aborting ...");
@@ -151,6 +157,8 @@ void gc_collect(s4 level)
        mark_me(rs);
        /*GC_LOG( heap_dump_region(heap_region_main, true); );*/
 
+       RT_TIMING_GET_TIME(time_mark);
+
        /* compact the heap */
        compact_me(rs, heap_region_main);
        /*GC_LOG( heap_dump_region(heap_region_main, false); );
@@ -161,6 +169,8 @@ void gc_collect(s4 level)
        region_invalidate(heap_region_main);
 #endif
 
+       RT_TIMING_GET_TIME(time_compact);
+
 #else
 
        /* copy the heap to new region */
@@ -199,6 +209,15 @@ void gc_collect(s4 level)
        /* REMEBER: keep this below the finalizer notification */
        gc_running = false;
 
+       RT_TIMING_GET_TIME(time_end);
+
+       RT_TIMING_TIME_DIFF(time_start  , time_suspend, RT_TIMING_GC_SUSPEND);
+       RT_TIMING_TIME_DIFF(time_suspend, time_rootset, RT_TIMING_GC_ROOTSET1)
+       RT_TIMING_TIME_DIFF(time_rootset, time_mark   , RT_TIMING_GC_MARK);
+       RT_TIMING_TIME_DIFF(time_mark   , time_compact, RT_TIMING_GC_COMPACT);
+       RT_TIMING_TIME_DIFF(time_compact, time_end    , RT_TIMING_GC_ROOTSET2);
+       RT_TIMING_TIME_DIFF(time_start  , time_end    , RT_TIMING_GC_TOTAL);
+
 gc_collect_abort:
     /* free dump memory area */
     dump_release(dumpsize);
@@ -247,8 +266,8 @@ void gc_invoke_finalizers(void)
 /* Informational getter functions *********************************************/
 
 s8 gc_get_heap_size(void)     { return heap_current_size; }
-s8 gc_get_free_bytes(void)    { return heap_free_size; }
-s8 gc_get_total_bytes(void)   { return heap_used_size; }
+s8 gc_get_free_bytes(void)    { return heap_region_main->free; }
+s8 gc_get_total_bytes(void)   { return heap_region_main->size - heap_region_main->free; }
 s8 gc_get_max_heap_size(void) { return heap_maximal_size; }
 
 
index cd341265d1c20db412227289f6f5d8b598880ec0..66a1e4c134e122e19499c743da34d2ff02973f33 100644 (file)
 #endif
 
 
-/*extern void *heap_base;
-extern void *heap_ptr;*/
 extern s4 heap_current_size;
 extern s4 heap_maximal_size;
-extern s4 heap_free_size;
-extern s4 heap_used_size;
 extern regioninfo_t *heap_region_sys;
 extern regioninfo_t *heap_region_main;
 
index 1cb99a168fd855ce4f394cffda5b36a2905c2179..bb2b554678ed28eb92fe1783533da2c5d09b0f18 100644 (file)
@@ -110,6 +110,16 @@ static struct rt_timing_stat rt_timing_stat_defs[] = {
        { RT_TIMING_NEW_ARRAY       ,-1                       , "builtin_newarray time" },
     { -1                        ,-1                       , "" },
 
+#if defined(ENABLE_GC_CACAO)
+       { RT_TIMING_GC_SUSPEND      ,RT_TIMING_GC_TOTAL       , "gc: suspending threads" },
+       { RT_TIMING_GC_ROOTSET1     ,RT_TIMING_GC_TOTAL       , "gc: rootset finding" },
+       { RT_TIMING_GC_MARK         ,RT_TIMING_GC_TOTAL       , "gc: marking phase" },
+       { RT_TIMING_GC_COMPACT      ,RT_TIMING_GC_TOTAL       , "gc: compaction phase" },
+       { RT_TIMING_GC_ROOTSET2     ,RT_TIMING_GC_TOTAL       , "gc: rootset writeback" },
+       { RT_TIMING_GC_TOTAL        ,-1                       , "total garbage collection time" },
+       { -1                        ,-1                       , "" },
+#endif
+
     { 0                         ,-1                       , NULL }
 };
 
index 2585315ac9c8affa351576c07b9fcc51afcd8323..e69b0dec5620056aeb0c7695c857c980f4454587 100644 (file)
 #define RT_TIMING_NEW_OBJECT       46
 #define RT_TIMING_NEW_ARRAY        47
 
-#define RT_TIMING_N                48
+#define RT_TIMING_GC_SUSPEND       48
+#define RT_TIMING_GC_ROOTSET1      49
+#define RT_TIMING_GC_MARK          50
+#define RT_TIMING_GC_COMPACT       51
+#define RT_TIMING_GC_ROOTSET2      52
+#define RT_TIMING_GC_TOTAL         53
+
+#define RT_TIMING_N                54
 
 void rt_timing_gettime(struct timespec *ts);