OSDN Git Service

2004-06-07 Dhruv Matani <dhruvbird@gmx.net>
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 7 Jun 2004 21:56:16 +0000 (21:56 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 7 Jun 2004 21:56:16 +0000 (21:56 +0000)
    Paolo Carlini  <pcarlini@suse.de>

* testsuite/testsuite_performance.h
(resource_counter::allocated_memory): Make it return the right
number of bytes requested by the allocators/application. This is
the sbrk+mmaped memory.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@82725 138bc75d-0d04-0410-961f-82ee72b054a4

libstdc++-v3/ChangeLog
libstdc++-v3/testsuite/testsuite_performance.h

index 06c30f7..8e210ce 100644 (file)
@@ -1,3 +1,11 @@
+2004-06-07  Dhruv Matani  <dhruvbird@gmx.net>
+           Paolo Carlini  <pcarlini@suse.de>
+
+       * testsuite/testsuite_performance.h
+       (resource_counter::allocated_memory): Make it return the right
+       number of bytes requested by the allocators/application. This is
+       the sbrk+mmaped memory.
+
 2004-06-02  Gabriel Dos Reis  <gdr@integrable-solutions.net>
 
        * include/std/std_complex.h (log): Tidy.
index 56b02bc..a0d0c29 100644 (file)
 #elif defined (__FreeBSD__)
 extern "C"
 {
-  struct mallinfo { int uordblks; };
-  struct mallinfo mallinfo(void)
-    { struct mallinfo m = { (((size_t) sbrk (0) + 1023) / 1024) }; return m; }
+  struct mallinfo
+  {
+    int uordblks;
+    int hblkhd;
+  };
+
+  struct mallinfo
+  mallinfo(void)
+  {
+    struct mallinfo m = { (((size_t) sbrk (0) + 1023) / 1024), 0 };
+    return m;
+  }
 }
 #else
 extern "C"
 {
-  struct mallinfo { int uordblks; };
-  struct mallinfo empty = { 0 };
-  struct mallinfo mallinfo(void) { return empty; }
+  struct mallinfo
+  {
+    int uordblks;
+    int hblkhd;
+  };
+
+  struct mallinfo empty = { 0, 0 };
+
+  struct mallinfo
+  mallinfo(void)
+  { return empty; }
 }
 #endif
 
@@ -101,9 +118,9 @@ namespace __gnu_test
 
   class resource_counter
   {
-    int                who;
-    rusage     rusage_begin;
-    rusage     rusage_end;
+    int                 who;
+    rusage             rusage_begin;
+    rusage             rusage_end;
     struct mallinfo    allocation_begin;
     struct mallinfo    allocation_end;
 
@@ -139,7 +156,8 @@ namespace __gnu_test
 
     int
     allocated_memory() const
-    { return allocation_end.uordblks - allocation_begin.uordblks; }
+    { return ((allocation_end.uordblks - allocation_begin.uordblks)
+             + (allocation_end.hblkhd - allocation_begin.hblkhd)); }
     
     long 
     hard_page_fault() const