summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>2003-06-24 19:38:36 +0000
committerbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>2003-06-24 19:38:36 +0000
commit2357a7dfc248b2fdeaae58754dafbb3c545b26e5 (patch)
tree95c59266182db618efadc792c8578d12f329d151
parent64acc591ca678cc54fd26c3f284ec3ed03e21e73 (diff)
downloadppe42-gcc-2357a7dfc248b2fdeaae58754dafbb3c545b26e5.tar.gz
ppe42-gcc-2357a7dfc248b2fdeaae58754dafbb3c545b26e5.zip
2003-06-24 Benjamin Kosnik <bkoz@redhat.com>
Ulrich Drepper <drepper@redhat.com> * testsuite/testsuite_performance.h: Tweak mallinfo. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@68436 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--libstdc++-v3/ChangeLog5
-rw-r--r--libstdc++-v3/testsuite/testsuite_performance.h31
2 files changed, 22 insertions, 14 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index bf9cd5cb2ba..f0024acf3c6 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,8 @@
+2003-06-24 Benjamin Kosnik <bkoz@redhat.com>
+ Ulrich Drepper <drepper@redhat.com>
+
+ * testsuite/testsuite_performance.h: Tweak mallinfo.
+
2003-06-24 Paolo Carlini <pcarlini@unitus.it>
Nathan C. Myers <ncm-nospam@cantrip.org>
diff --git a/libstdc++-v3/testsuite/testsuite_performance.h b/libstdc++-v3/testsuite/testsuite_performance.h
index 9aea7574458..1ad02518fd0 100644
--- a/libstdc++-v3/testsuite/testsuite_performance.h
+++ b/libstdc++-v3/testsuite/testsuite_performance.h
@@ -33,15 +33,22 @@
#include <sys/times.h>
#include <sys/resource.h>
-#ifdef __FreeBSD__
-#include <stdlib.h>
-#else
-#include <malloc.h>
-#endif
+#include <cstdlib>
#include <string>
#include <fstream>
#include <iomanip>
+#ifdef __linux__
+#include <malloc.h>
+#else
+extern "C"
+{
+ struct mallinfo { int uordblks; };
+ struct mallinfo empty = { 0 };
+ struct mallinfo mallinfo(void) { return empty; }
+}
+#endif
+
namespace __gnu_cxx_test
{
class time_counter
@@ -85,11 +92,6 @@ namespace __gnu_cxx_test
{ return tms_end.tms_stime - tms_begin.tms_stime; }
};
-#ifdef __FreeBSD__
- struct mallinfo { int arena; };
- int mallinfo (void) { return 0; }
-#endif
-
class resource_counter
{
int who;
@@ -116,7 +118,8 @@ namespace __gnu_cxx_test
{
if (getrusage(who, &rusage_begin) != 0 )
memset(&rusage_begin, 0, sizeof(rusage_begin));
- // allocation_begin = mallinfo();
+ malloc(0); // Needed for some implementations.
+ allocation_begin = mallinfo();
}
void
@@ -124,12 +127,12 @@ namespace __gnu_cxx_test
{
if (getrusage(who, &rusage_end) != 0 )
memset(&rusage_end, 0, sizeof(rusage_end));
- // allocation_end = mallinfo();
+ allocation_end = mallinfo();
}
int
allocated_memory() const
- { return allocation_end.arena - allocation_begin.arena; }
+ { return allocation_end.uordblks - allocation_begin.uordblks; }
long
hard_page_fault() const
@@ -181,7 +184,7 @@ namespace __gnu_cxx_test
out << std::setw(4) << t.real_time() << "r" << space;
out << std::setw(4) << t.user_time() << "u" << space;
out << std::setw(4) << t.system_time() << "s" << space;
- // out << std::setw(4) << r.allocated_memory() << "mem" << space;
+ out << std::setw(4) << r.allocated_memory() << "mem" << space;
out << std::setw(4) << r.hard_page_fault() << "pf" << space;
out << std::endl;
OpenPOWER on IntegriCloud