Fix typo.
[cacao.git] / src / vm / rt-timing.c
index 85215860fbed6640902eb1f24bf19780dc7410ea..04384f85307f1486adc1fc85a4cd97935ef9bde1 100644 (file)
@@ -1,9 +1,7 @@
 /* src/vm/rt-timing.c - POSIX real-time timing utilities
 
-   Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
-   C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
-   E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
-   J. Wenninger, Institut f. Computersprachen - TU Wien
+   Copyright (C) 1996-2005, 2006, 2007, 2008
+   CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
 
    This file is part of CACAO.
 
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   Contact: cacao@cacaojvm.org
-
-   Authors: Edwin Steiner
-
-   Changes:
-
-   $Id$
-
 */
 
 
 #include "config.h"
-#include "vm/types.h"
 
 #include <assert.h>
-#include <time.h>
 #include <errno.h>
+#include <stdlib.h>
+#include <time.h>
+
+#include "vm/types.h"
+
+#include "mm/memory.hpp"
 
-#include "vm/rt-timing.h"
-#include "mm/memory.h"
 #include "vm/global.h"
+#include "vm/rt-timing.h"
+
 
 struct rt_timing_stat {
        int index;
@@ -93,7 +87,47 @@ static struct rt_timing_stat rt_timing_stat_defs[] = {
        { RT_TIMING_LOAD_TOTAL      ,-1                  , "total load time (from classbuffer)"},
     { -1                        ,-1                  , "" },
 
-    { 0                         ,-1                  , NULL }
+       { RT_TIMING_LOAD_BOOT_LOOKUP,-1                       , "boot: lookup in classcache"},
+       { RT_TIMING_LOAD_BOOT_ARRAY ,RT_TIMING_LOAD_BOOT_TOTAL, "boot: load array classes"},
+       { RT_TIMING_LOAD_BOOT_SUCK  ,RT_TIMING_LOAD_BOOT_TOTAL, "boot: suck class files"},
+       { RT_TIMING_LOAD_BOOT_LOAD  ,RT_TIMING_LOAD_BOOT_TOTAL, "boot: load from class buffer"},
+       { RT_TIMING_LOAD_BOOT_CACHE ,RT_TIMING_LOAD_BOOT_TOTAL, "boot: store in classcache"},
+       { RT_TIMING_LOAD_BOOT_TOTAL ,-1                       , "total bootstrap loader time"},
+    { -1                        ,-1                       , "" },
+
+       { RT_TIMING_LOAD_CL_LOOKUP  ,-1                       , "classloader: lookup in classcache" },
+       { RT_TIMING_LOAD_CL_PREPARE ,-1                       , "classloader: prepare loader call" },
+       { RT_TIMING_LOAD_CL_JAVA    ,-1                       , "classloader: loader Java code" },
+       { RT_TIMING_LOAD_CL_CACHE   ,-1                       , "classloader: store in classcache" },
+    { -1                        ,-1                       , "" },
+
+       { RT_TIMING_NEW_OBJECT      ,-1                       , "builtin_new time" },
+       { RT_TIMING_NEW_ARRAY       ,-1                       , "builtin_newarray time" },
+    { -1                        ,-1                       , "" },
+
+       { RT_TIMING_GC_ALLOC        ,-1                       , "heap allocation time" },
+#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" },
+#endif
+       { -1                        ,-1                       , "" },
+
+#if defined(ENABLE_REPLACEMENT)
+       { RT_TIMING_REPLACE         ,-1                       , "replacement" },
+       { -1                        ,-1                       , "" },
+#endif
+
+       { RT_TIMING_1               ,-1                       , "temporary timer 1" },
+       { RT_TIMING_2               ,-1                       , "temporary timer 2" },
+       { RT_TIMING_3               ,-1                       , "temporary timer 3" },
+       { RT_TIMING_4               ,-1                       , "temporary timer 4" },
+       { -1                        ,-1                       , "" },
+
+    { 0                         ,-1                       , NULL }
 };
 
 static long long rt_timing_sum[RT_TIMING_N] = { 0 };
@@ -106,7 +140,7 @@ void rt_timing_gettime(struct timespec *ts)
        }
 }
 
-static long rt_timing_diff_usec(struct timespec *a,struct timespec *b)
+long rt_timing_diff_usec(struct timespec *a,struct timespec *b)
 {
        long diff;
        time_t atime;