This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: testsuite_performance.h => allocated memory correct.


Dhruv Matani wrote:

This patch ensures that the requested memory is shown correctly in the
performance test-cases. Earlier, only the sbrk memory was being
considered, so for the default dmalloc on x86-Linux, the mmapped memory
would never be considered.

Ok. The below is what I have tested and will commit.


Thanks,
Paolo.

/////////////
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.
diff -prN libstdc++-v3-orig/testsuite/testsuite_performance.h libstdc++-v3/testsuite/testsuite_performance.h
*** libstdc++-v3-orig/testsuite/testsuite_performance.h	Fri Jan 30 09:24:26 2004
--- libstdc++-v3/testsuite/testsuite_performance.h	Mon Jun  7 22:13:40 2004
***************
*** 43,58 ****
  #elif defined (__FreeBSD__)
  extern "C"
  {
!   struct mallinfo { int uordblks; };
!   struct mallinfo mallinfo(void)
!     { struct mallinfo m = { (((size_t) sbrk (0) + 1023) / 1024) }; return m; }
  }
  #else
  extern "C"
  {
!   struct mallinfo { int uordblks; };
!   struct mallinfo empty = { 0 };
!   struct mallinfo mallinfo(void) { return empty; }
  }
  #endif
  
--- 43,75 ----
  #elif defined (__FreeBSD__)
  extern "C"
  {
!   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;
!     int hblkhd;
!   };
! 
!   struct mallinfo empty = { 0, 0 };
! 
!   struct mallinfo
!   mallinfo(void)
!   { return empty; }
  }
  #endif
  
*************** namespace __gnu_test
*** 101,109 ****
  
    class resource_counter
    {
!     int		who;
!     rusage	rusage_begin;
!     rusage	rusage_end;
      struct mallinfo  	allocation_begin;
      struct mallinfo  	allocation_end;
  
--- 118,126 ----
  
    class resource_counter
    {
!     int                 who;
!     rusage	        rusage_begin;
!     rusage	        rusage_end;
      struct mallinfo  	allocation_begin;
      struct mallinfo  	allocation_end;
  
*************** namespace __gnu_test
*** 139,145 ****
  
      int
      allocated_memory() const
!     { return allocation_end.uordblks - allocation_begin.uordblks; }
      
      long 
      hard_page_fault() const
--- 156,163 ----
  
      int
      allocated_memory() const
!     { return ((allocation_end.uordblks - allocation_begin.uordblks)
! 	      + (allocation_end.hblkhd - allocation_begin.hblkhd)); }
      
      long 
      hard_page_fault() const

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]