GNU header update.
[cacao.git] / src / vm / statistics.c
index feeabcd1ade7b881d138b5c68f2c592aaa0bdf4a..6e4651e274ba4b118a69df018b49757a14eac7be 100644 (file)
@@ -1,10 +1,9 @@
 /* statistics.c - global varables for statistics
 
-   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
-   Institut f. Computersprachen, TU Wien
-   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser, M. Probst,
-   S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich,
-   J. Wenninger
+   Copyright (C) 1996-2005 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
 
    This file is part of CACAO.
 
@@ -27,7 +26,7 @@
 
    Authors: Christian Thalinger
 
-   $Id: statistics.c 1418 2004-10-19 14:11:58Z carolyn $
+   $Id: statistics.c 1735 2004-12-07 14:33:27Z twisti $
 
 */
 
@@ -52,6 +51,13 @@ static s8 compilingstarttime = 0;
 static s8 compilingstoptime = 0;
 static s4 compilingtime_recursion = 0;
 
+s4 memoryusage = 0;
+s4 maxmemusage = 0;
+s4 maxdumpsize = 0;
+
+s4 globalallocateddumpsize = 0;
+s4 globaluseddumpsize = 0;
+
 int count_class_infos = 0;              /* variables for measurements         */
 int count_const_pool_len = 0;
 int count_vftbl_len = 0;
@@ -447,6 +453,28 @@ void print_stats()
 }
 
 
+/* mem_usagelog ****************************************************************
+
+   prints some memory related infos
+
+*******************************************************************************/
+
+void mem_usagelog(bool givewarnings)
+{
+       if ((memoryusage != 0) && givewarnings) {
+               dolog("Allocated memory not returned: %d", (s4) memoryusage);
+       }
+
+       if ((globalallocateddumpsize != 0) && givewarnings) {
+               dolog("Dump memory not returned: %d", (s4) globalallocateddumpsize);
+       }
+
+       dolog("Random/Dump - max. memory usage: %dkB/%dkB", 
+                 (s4) ((maxmemusage + 1023) / 1024),
+                 (s4) ((maxdumpsize + 1023) / 1024));
+}
+
+
 /*
  * These are local overrides for various environment variables in Emacs.
  * Please do not remove this and leave it at the end of the file, where