From 345b912f506bad61fcd703b6aa405a3a94f01024 Mon Sep 17 00:00:00 2001 From: Dhruv Matani Date: Mon, 7 Jun 2004 21:56:16 +0000 Subject: [PATCH] 2004-06-07 Dhruv Matani Paolo Carlini * 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. Co-Authored-By: Paolo Carlini From-SVN: r82725 --- libstdc++-v3/ChangeLog | 8 ++++ .../testsuite/testsuite_performance.h | 38 ++++++++++++++----- 2 files changed, 36 insertions(+), 10 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 06c30f7a99a..8e210ce852f 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,11 @@ +2004-06-07 Dhruv Matani + Paolo Carlini + + * 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 * include/std/std_complex.h (log): Tidy. diff --git a/libstdc++-v3/testsuite/testsuite_performance.h b/libstdc++-v3/testsuite/testsuite_performance.h index 56b02bc64d8..a0d0c2991d9 100644 --- a/libstdc++-v3/testsuite/testsuite_performance.h +++ b/libstdc++-v3/testsuite/testsuite_performance.h @@ -43,16 +43,33 @@ #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 -- 2.30.2