This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc 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: Counting amount of memory allocated?


> > 1. Does this sound like a reasonable approach to take?  Is there any
> >    easier way to get the information that I'm looking for?
>
> Use valgrind.

Thanks, I already do, but only for debugging (and it works wonderfully,
btw).  I'm trying to set up an automated system to collect time and heap
profiles that runs all of the time (the heap profiling only happens when
compiling our program in debug mode though, which is common for
development).  An example of the output generated is:

....
   ---User Time---   --System Time--   --User+System--   ---Wall Time---  ---Mem---  --- Name ---
   0.6800 ( 50.0%)   0.0000 (  0.0%)   0.6800 ( 49.3%)   0.7023 ( 50.3%)     696312  Top-down Data Structure Analysis
   0.3000 ( 22.1%)   0.0000 (  0.0%)   0.3000 ( 21.7%)   0.2994 ( 21.4%)     215128  Bottom-up Data Structure Analysis
   0.2500 ( 18.4%)   0.0200 (100.0%)   0.2700 ( 19.6%)   0.2652 ( 19.0%)          0  Module Printer
   0.1100 (  8.1%)   0.0000 (  0.0%)   0.1100 (  8.0%)   0.1134 (  8.1%)     126944  Local Data Structure Analysis
   0.0200 (  1.5%)   0.0000 (  0.0%)   0.0200 (  1.4%)   0.0086 (  0.6%)      17112  Dominator Set Construction
   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0000 (  0.0%)   0.0081 (  0.6%)          0  Module Verifier
   1.3600 (100.0%)   0.0200 (100.0%)   1.3800 (100.0%)   1.3970 (100.0%)    1055496  TOTAL

The actual timing numbers don't mean anything because this is a debug
build with lots of assertions, but it should give you some idea of what
I'm trying to accomplish.

The heap size numbers are computed using mallinfo, as suggested by Roland
McGrath.  They are sampled to determine the amount of memory used to
represent the analysis results for the various analyses run.  The only
thing I remain concerned about is whether using STL containers will
artificially inflate the numbers that I'm seeing.  If I use STL maps, for
example, aren't the tree nodes pool allocated?

-Chris

-- 
http://llvm.cs.uiuc.edu/
http://www.nondot.org/~sabre/Projects/




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