Author: njn Date: 2007-10-04 06:45:01 +0100 (Thu, 04 Oct 2007) New Revision: 6939
Log: Various comment, formatting, etc, changes. No functional changes. Modified: branches/MASSIF2/massif/ms_main.c Modified: branches/MASSIF2/massif/ms_main.c =================================================================== --- branches/MASSIF2/massif/ms_main.c 2007-10-04 05:34:56 UTC (rev 6938) +++ branches/MASSIF2/massif/ms_main.c 2007-10-04 05:45:01 UTC (rev 6939) @@ -31,7 +31,6 @@ // XXX: //--------------------------------------------------------------------------- // Todo: -// - make --time-unit=B include heap-admin bytes // - Add ability to draw multiple graphs, eg. heap-only, stack-only, total. // Give each graph a title. // - do peak-taking. @@ -854,8 +853,8 @@ } // otherwise NULL Snapshot; +static UInt next_snapshot_i = 0; // Index of where next snapshot will go. static Snapshot snapshots[MAX_N_SNAPSHOTS]; -static UInt next_snapshot_i = 0; // Points to where next snapshot will go. static Bool is_snapshot_in_use(Snapshot* snapshot) { @@ -937,8 +936,9 @@ ); } -// Weed out half the snapshots; we choose those that represent the smallest -// time-spans, because that loses the least information. +// Cull half the snapshots; we choose those that represent the smallest +// time-spans, because that gives us the most even distribution of snapshots +// over time. (It's possible to lose interesting spikes, however.) // // Algorithm for N snapshots: We find the snapshot representing the smallest // timeframe, and remove it. We repeat this until (N/2) snapshots are gone. @@ -1123,7 +1123,7 @@ snapshot->stacks_szB += sigstacks_szB; // Add signal stacks, too } - // Finish writing snapshot ------------------------------------------ + // Rest of snapshot ------------------------------------------------- snapshot->time = time; snapshot->total_szB = snapshot->heap_szB + snapshot->heap_admin_szB + snapshot->stacks_szB; @@ -1313,11 +1313,11 @@ } static __inline__ -void* renew_block ( ThreadId tid, void* p_old, SizeT new_size ) +void* renew_block ( ThreadId tid, void* p_old, SizeT new_szB ) { HP_Chunk* hc; void* p_new; - SizeT old_size; + SizeT old_szB; XPt *old_where, *new_where; // Update statistics @@ -1329,20 +1329,20 @@ return NULL; // must have been a bogus realloc() } - old_size = hc->szB; + old_szB = hc->szB; // Update heap stats - update_heap_stats(new_size - old_size, /*n_heap_blocks_delta*/0); + update_heap_stats(new_szB - old_szB, /*n_heap_blocks_delta*/0); - if (new_size <= old_size) { + if (new_szB <= old_szB) { // new size is smaller or same; block not moved p_new = p_old; } else { // new size is bigger; make new block, copy shared contents, free old - p_new = VG_(cli_malloc)(VG_(clo_alignment), new_size); + p_new = VG_(cli_malloc)(VG_(clo_alignment), new_szB); if (p_new) { - VG_(memcpy)(p_new, p_old, old_size); + VG_(memcpy)(p_new, p_old, old_szB); VG_(cli_free)(p_old); } } @@ -1353,13 +1353,13 @@ // Update HP_Chunk hc->data = (Addr)p_new; - hc->szB = new_size; + hc->szB = new_szB; hc->where = new_where; // Update XPt curr_szB fields if (clo_heap) { - update_XCon(old_where, -old_size); - update_XCon(new_where, new_size); + update_XCon(old_where, -old_szB); + update_XCon(new_where, new_szB); } } @@ -1668,7 +1668,7 @@ } } -static void write_detailed_snapshots(void) +static void write_snapshots_to_file(void) { Int i, fd; SysRes sres; @@ -1729,7 +1729,7 @@ static void ms_fini(Int exit_status) { // Output. - write_detailed_snapshots(); + write_snapshots_to_file(); // Stats tl_assert(n_xpts > 0); // always have alloc_xpt ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Valgrind-developers mailing list Valgrind-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/valgrind-developers