Moved stat functions from memory.*.
authortwisti <none@none>
Fri, 5 Nov 2004 09:52:49 +0000 (09:52 +0000)
committertwisti <none@none>
Fri, 5 Nov 2004 09:52:49 +0000 (09:52 +0000)
src/vm/statistics.c
src/vm/statistics.h
statistics.c
statistics.h

index feeabcd1ade7b881d138b5c68f2c592aaa0bdf4a..9ce305fdb8d2d87bedfe01d3ded7a1cfa011b87e 100644 (file)
@@ -27,7 +27,7 @@
 
    Authors: Christian Thalinger
 
-   $Id: statistics.c 1418 2004-10-19 14:11:58Z carolyn $
+   $Id: statistics.c 1438 2004-11-05 09:52:49Z twisti $
 
 */
 
@@ -52,6 +52,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 +454,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
index 70e2bb6ed7d66174a290684e28b8d3c083c6397e..0cb7d67f4f73d68e117d5f2c2d351e72bde34019 100644 (file)
@@ -27,7 +27,7 @@
 
    Authors: Christian Thalinger
 
-   $Id: statistics.h 1416 2004-10-19 12:07:18Z carolyn $
+   $Id: statistics.h 1438 2004-11-05 09:52:49Z twisti $
 
 */
 
 
 /* global variables */
 
+extern s4 memoryusage;
+extern s4 maxmemusage;
+extern s4 maxdumpsize;
+
+extern s4 globalallocateddumpsize;
+extern s4 globaluseddumpsize;
+
 extern int count_class_infos;           /* variables for measurements         */
 extern int count_const_pool_len;
 extern int count_vftbl_len;
@@ -113,6 +120,8 @@ void compilingtime_stop();
 void print_times();
 void print_stats();
 
+void mem_usagelog(bool givewarnings);
 #endif /* _STATISTICS_H */
 
 
index feeabcd1ade7b881d138b5c68f2c592aaa0bdf4a..9ce305fdb8d2d87bedfe01d3ded7a1cfa011b87e 100644 (file)
@@ -27,7 +27,7 @@
 
    Authors: Christian Thalinger
 
-   $Id: statistics.c 1418 2004-10-19 14:11:58Z carolyn $
+   $Id: statistics.c 1438 2004-11-05 09:52:49Z twisti $
 
 */
 
@@ -52,6 +52,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 +454,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
index 70e2bb6ed7d66174a290684e28b8d3c083c6397e..0cb7d67f4f73d68e117d5f2c2d351e72bde34019 100644 (file)
@@ -27,7 +27,7 @@
 
    Authors: Christian Thalinger
 
-   $Id: statistics.h 1416 2004-10-19 12:07:18Z carolyn $
+   $Id: statistics.h 1438 2004-11-05 09:52:49Z twisti $
 
 */
 
 
 /* global variables */
 
+extern s4 memoryusage;
+extern s4 maxmemusage;
+extern s4 maxdumpsize;
+
+extern s4 globalallocateddumpsize;
+extern s4 globaluseddumpsize;
+
 extern int count_class_infos;           /* variables for measurements         */
 extern int count_const_pool_len;
 extern int count_vftbl_len;
@@ -113,6 +120,8 @@ void compilingtime_stop();
 void print_times();
 void print_stats();
 
+void mem_usagelog(bool givewarnings);
 #endif /* _STATISTICS_H */