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]

testsuite_performance.h => allocated memory correct.


Hello,
	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. Maybe it's an error in the c-library, or in
my thinking, but this sort of a thing should not happen.

Currently, malloc calls mmap for memory >= 128k-bytes, but this value is
not reflected in the malloc statistics. Instead it goes into the mmap
stats. So, either malloc should not call mmap, or the mmap memory calls
internally by malloc should reflect in the memory stats.

Another non-related issue: I as a user would be more interested in the
number of pages/memory actually used by the app., and not the amount it
has requested, because virtual memory makes the 2nd parameter absolutely
useless, and with the demand commit systems like Linux, the memory is
not committed until it is touched, so even if I request 1GB, and touch
only 40-bytes in the first page, then the 4kb usage should be reported,
and not the 1GB that we currently report.

Is there any way of displaying the committed memory instead of the
requested memory?




-- 
        -Dhruv Matani.
http://www.geocities.com/dhruvbird/

Proud to be a Vegetarian.
http://www.vegetarianstarterkit.com/
http://www.vegkids.com/vegkids/index.html

*** testsuite_performance.h	2004-01-30 13:54:26.000000000 +0530
--- /home/dhruv/projects/new_libstdc++-v3/testsuite_performance.h	2004-05-31 09:37:05.000000000 +0530
*************** namespace __gnu_test
*** 139,145 ****
  
      int
      allocated_memory() const
!     { return allocation_end.uordblks - allocation_begin.uordblks; }
      
      long 
      hard_page_fault() const
--- 139,149 ----
  
      int
      allocated_memory() const
!     {
!       return 
! 	(allocation_end.uordblks - allocation_begin.uordblks)
! 	+ (allocation_end.hblkhd - allocation_begin.hblkhd);
!     }
      
      long 
      hard_page_fault() const

Attachment: ChangeLog
Description: Text document


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