/* 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;
{ RT_TIMING_JIT_RPLPOINTS ,RT_TIMING_JIT_TOTAL , "replacement point generation" },
{ RT_TIMING_JIT_CODEGEN ,RT_TIMING_JIT_TOTAL , "codegen" },
{ RT_TIMING_JIT_TOTAL ,-1 , "total compile time" },
+ { -1 ,-1 , "" },
{ RT_TIMING_LINK_RESOLVE ,RT_TIMING_LINK_TOTAL, "link: resolve superclass/superinterfaces"},
{ RT_TIMING_LINK_C_VFTBL ,RT_TIMING_LINK_TOTAL, "link: compute vftbl length"},
{ RT_TIMING_LINK_EXCEPTS ,RT_TIMING_LINK_TOTAL, "link: resolve exception classes"},
{ RT_TIMING_LINK_SUBCLASS ,RT_TIMING_LINK_TOTAL, "link: re-calculate subclass indices"},
{ RT_TIMING_LINK_TOTAL ,-1 , "total link time" },
-
- { 0, NULL }
+ { -1 ,-1 , "" },
+
+ { RT_TIMING_LOAD_CHECKS ,RT_TIMING_LOAD_TOTAL, "load: initial checks"},
+ { RT_TIMING_LOAD_NDPOOL ,RT_TIMING_LOAD_TOTAL, "load: new descriptor pool"},
+ { RT_TIMING_LOAD_CPOOL ,RT_TIMING_LOAD_TOTAL, "load: load constant pool"},
+ { RT_TIMING_LOAD_SETUP ,RT_TIMING_LOAD_TOTAL, "load: class setup"},
+ { RT_TIMING_LOAD_FIELDS ,RT_TIMING_LOAD_TOTAL, "load: load fields"},
+ { RT_TIMING_LOAD_METHODS ,RT_TIMING_LOAD_TOTAL, "load: load methods"},
+ { RT_TIMING_LOAD_CLASSREFS ,RT_TIMING_LOAD_TOTAL, "load: create classrefs"},
+ { RT_TIMING_LOAD_DESCS ,RT_TIMING_LOAD_TOTAL, "load: allocate descriptors"},
+ { RT_TIMING_LOAD_SETREFS ,RT_TIMING_LOAD_TOTAL, "load: set classrefs"},
+ { RT_TIMING_LOAD_PARSEFDS ,RT_TIMING_LOAD_TOTAL, "load: parse field descriptors"},
+ { RT_TIMING_LOAD_PARSEMDS ,RT_TIMING_LOAD_TOTAL, "load: parse method descriptors"},
+ { RT_TIMING_LOAD_PARSECP ,RT_TIMING_LOAD_TOTAL, "load: parse descriptors in constant pool"},
+ { RT_TIMING_LOAD_VERIFY ,RT_TIMING_LOAD_TOTAL, "load: verifier checks"},
+ { RT_TIMING_LOAD_ATTRS ,RT_TIMING_LOAD_TOTAL, "load: load attributes"},
+ { RT_TIMING_LOAD_TOTAL ,-1 , "total load time (from classbuffer)"},
+ { -1 ,-1 , "" },
+
+ { 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 };
}
}
-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;
struct rt_timing_stat *stats;
double total;
- stats = rt_timing_stat_defs;
- while (stats->name) {
+ for (stats = rt_timing_stat_defs; stats->name; ++stats) {
+ if (stats->index < 0) {
+ fprintf(file,"%s\n",stats->name);
+ continue;
+ }
+
if (stats->totalindex >= 0) {
total = rt_timing_sum[stats->totalindex];
fprintf(file,"%12lld usec %3.0f%% %s\n",
rt_timing_sum[stats->index],
stats->name);
}
- stats++;
}
}