|
From: <sv...@va...> - 2007-10-05 07:24:16
|
Author: njn
Date: 2007-10-05 08:24:18 +0100 (Fri, 05 Oct 2007)
New Revision: 6955
Log:
Removed redundant .total_szB field from Snapshot. It can be computed from
other fields in Snapshot. Also remove the similarly redundant "mem_total_B"
lines from the output file format, which makes them more compact.
Modified:
branches/MASSIF2/massif/ms_main.c
branches/MASSIF2/massif/ms_print
Modified: branches/MASSIF2/massif/ms_main.c
===================================================================
--- branches/MASSIF2/massif/ms_main.c 2007-10-05 05:16:33 UTC (rev 6954)
+++ branches/MASSIF2/massif/ms_main.c 2007-10-05 07:24:18 UTC (rev 6955)
@@ -348,6 +348,7 @@
VG_BOOL_CLO(arg, "--heap", clo_heap)
else VG_BOOL_CLO(arg, "--stacks", clo_stacks)
+ // XXX: currently allows negative heap admin sizes! Abort if negative.
else VG_NUM_CLO (arg, "--heap-admin", clo_heap_admin)
else VG_BNUM_CLO(arg, "--depth", clo_depth, 1, MAX_DEPTH)
@@ -839,8 +840,6 @@
struct {
SnapshotKind kind;
Time time;
- // XXX: total_szB is redundant! remove it
- SizeT total_szB; // Size of all allocations at that snapshot time.
SizeT heap_szB;
SizeT heap_admin_szB;
SizeT stacks_szB;
@@ -856,7 +855,6 @@
if (Unused == snapshot->kind) {
// If snapshot is unused, check all the fields are unset.
tl_assert(snapshot->time == UNUSED_SNAPSHOT_TIME);
- tl_assert(snapshot->total_szB == 0);
tl_assert(snapshot->heap_admin_szB == 0);
tl_assert(snapshot->heap_szB == 0);
tl_assert(snapshot->stacks_szB == 0);
@@ -875,8 +873,6 @@
static void sanity_check_snapshot(Snapshot* snapshot)
{
- tl_assert(snapshot->total_szB ==
- snapshot->heap_admin_szB + snapshot->heap_szB + snapshot->stacks_szB);
if (snapshot->alloc_xpt) {
sanity_check_XTree(snapshot->alloc_xpt, /*parent*/NULL);
}
@@ -901,7 +897,6 @@
sanity_check_snapshot(snapshot);
snapshot->kind = Unused;
snapshot->time = UNUSED_SNAPSHOT_TIME;
- snapshot->total_szB = 0;
snapshot->heap_admin_szB = 0;
snapshot->heap_szB = 0;
snapshot->stacks_szB = 0;
@@ -1131,8 +1126,6 @@
// Rest of snapshot.
snapshot->kind = kind;
snapshot->time = time;
- snapshot->total_szB =
- snapshot->heap_szB + snapshot->heap_admin_szB + snapshot->stacks_szB;
sanity_check_snapshot(snapshot);
n_real_snapshots++;
@@ -1697,7 +1690,6 @@
FP("snapshot=%d\n", snapshot_n);
FP("#-----------\n");
FP("time=%lld\n", snapshot->time);
- FP("mem_total_B=%lu\n", snapshot->total_szB);
FP("mem_heap_B=%lu\n", snapshot->heap_szB);
FP("mem_heap_admin_B=%lu\n", snapshot->heap_admin_szB);
FP("mem_stacks_B=%lu\n", snapshot->stacks_szB);
@@ -1706,12 +1698,14 @@
// Detailed snapshot -- print heap tree.
Int depth_str_len = clo_depth + 3;
Char* depth_str = VG_(malloc)(sizeof(Char) * depth_str_len);
+ SizeT snapshot_total_szB =
+ snapshot->heap_szB + snapshot->heap_admin_szB + snapshot->stacks_szB;
depth_str[0] = '\0'; // Initialise depth_str to "".
FP("heap_tree=...\n");
pp_snapshot_XPt(fd, snapshot->alloc_xpt, 0, depth_str,
depth_str_len, snapshot->heap_szB,
- snapshot->total_szB);
+ snapshot_total_szB);
VG_(free)(depth_str);
Modified: branches/MASSIF2/massif/ms_print
===================================================================
--- branches/MASSIF2/massif/ms_print 2007-10-05 05:16:33 UTC (rev 6954)
+++ branches/MASSIF2/massif/ms_print 2007-10-05 07:24:18 UTC (rev 6955)
@@ -387,10 +387,10 @@
while (defined $line) {
my $snapshot_num = equals_num_line($line, "snapshot");
my $time = equals_num_line(get_line(), "time");
- my $mem_total_B = equals_num_line(get_line(), "mem_total_B");
my $mem_heap_B = equals_num_line(get_line(), "mem_heap_B");
my $mem_heap_admin_B = equals_num_line(get_line(), "mem_heap_admin_B");
my $mem_stacks_B = equals_num_line(get_line(), "mem_stacks_B");
+ my $mem_total_B = $mem_heap_B + $mem_heap_admin_B + $mem_stacks_B;
my $heap_tree = equals_num_line(get_line(), "heap_tree");
# Print the snapshot data to $tmp_file.
@@ -427,7 +427,6 @@
} else {
die("Line $.: expected 'empty' or '...' after 'heap_tree='\n");
}
-
}
close(INPUTFILE);
|