|
From: Nicholas N. <nj...@ca...> - 2004-02-23 15:41:43
|
CVS commit by nethercote:
Changed bug_reports_to.
M +1 -1 ms_main.c 1.2
--- valgrind/massif/ms_main.c #1.1:1.2
@@ -1178,5 +1178,5 @@ void SK_(pre_clo_init)()
VG_(details_description) ("a space profiler");
VG_(details_copyright_author)("Copyright (C) 2003, Nicholas Nethercote");
- VG_(details_bug_reports_to) ("nj...@ca...");
+ VG_(details_bug_reports_to) (VG_BUGS_TO);
// Needs
|
|
From: Jeremy F. <je...@go...> - 2004-03-04 22:48:28
|
CVS commit by fitzhardinge:
List memalign as an allocator.
M +7 -1 ms_main.c 1.3
--- valgrind/massif/ms_main.c #1.2:1.3
@@ -255,5 +255,5 @@ static UInt n_heap_blocks = 0;
// First six filled in, rest should be zeroed. argc/argv-style vector.
-static UInt n_alloc_fns = 8;
+static UInt n_alloc_fns = 9;
static Char* alloc_fns[MAX_ALLOC_FNS] = {
"malloc",
@@ -265,4 +265,5 @@ static Char* alloc_fns[MAX_ALLOC_FNS] =
"realloc",
"my_malloc", // from vg_libpthread.c
+ "memalign",
};
@@ -781,4 +782,9 @@ void* SK_(calloc) ( Int m, Int size )
}
+void *SK_(memalign)( Int align, Int n )
+{
+ return new_block( n, align, False );
+}
+
void SK_(free) ( void* p )
{
|
|
From: Julian S. <js...@ac...> - 2004-03-07 10:31:13
|
CVS commit by jseward:
Be slightly less verbose at -v.
M +1 -1 ms_main.c 1.4
--- valgrind/massif/ms_main.c #1.3:1.4
@@ -1059,5 +1059,5 @@ static void hp_census(void)
census->xtree_snapshots[i] =
VG_(calloc)(xtree_size+1, sizeof(XPtSnapshot));
- if (VG_(clo_verbosity) > 1)
+ if (0 && VG_(clo_verbosity) > 1)
VG_(printf)("calloc: %d (%d B)\n", xtree_size+1,
(xtree_size+1) * sizeof(XPtSnapshot));
|
|
From: Nicholas N. <nj...@ca...> - 2004-03-16 19:41:20
|
CVS commit by nethercote:
Remove Massif's version number now that it's part of the main distro.
M +1 -1 ms_main.c 1.5
--- valgrind/massif/ms_main.c #1.4:1.5
@@ -1181,5 +1181,5 @@ void SK_(pre_clo_init)()
{
VG_(details_name) ("Massif");
- VG_(details_version) ("0.0.3");
+ VG_(details_version) (NULL);
VG_(details_description) ("a space profiler");
VG_(details_copyright_author)("Copyright (C) 2003, Nicholas Nethercote");
|
|
From: Nicholas N. <nj...@ca...> - 2004-04-27 09:51:56
|
CVS commit by nethercote:
Fix for bug 79355: fix up bogus assertion that was failing when
stack_snapshot() returned 0xffffffff as one of its eip values.
M +3 -1 ms_main.c 1.6
--- valgrind/massif/ms_main.c #1.5:1.6
@@ -391,5 +391,7 @@ static XPt* new_XPt(Addr eip, XPt* paren
xpt->parent = parent;
- sk_assert(parent == NULL || 0xffffffff != parent->eip);
+
+ // Check parent is not a bottom-XPt
+ sk_assert(parent == NULL || 0 != parent->max_children);
xpt->n_children = 0;
|
|
From: Nicholas N. <nj...@ca...> - 2004-05-11 09:17:55
|
CVS commit by nethercote:
Update copyright
M +1 -1 ms_main.c 1.7
--- valgrind/massif/ms_main.c #1.6:1.7
@@ -8,5 +8,5 @@
usage of programs.
- Copyright (C) 2003 Nicholas Nethercote
+ Copyright (C) 2003-2004 Nicholas Nethercote
nj...@ca...
|
|
From: Nicholas N. <nj...@ca...> - 2004-05-11 09:21:14
|
CVS commit by nethercote:
Teach Massif about the 'nothrow' versions of new and new[].
M +4 -2 ms_main.c 1.8
--- valgrind/massif/ms_main.c #1.7:1.8
@@ -254,10 +254,12 @@ static UInt n_heap_blocks = 0;
#define MAX_ALLOC_FNS 32 // includes the builtin ones
-// First six filled in, rest should be zeroed. argc/argv-style vector.
-static UInt n_alloc_fns = 9;
+// First few filled in, rest should be zeroed. Zero-terminated vector.
+static UInt n_alloc_fns = 11;
static Char* alloc_fns[MAX_ALLOC_FNS] = {
"malloc",
"operator new(unsigned)",
"operator new[](unsigned)",
+ "operator new(unsigned, std::nothrow_t const&)"
+ "operator new[](unsigned, std::nothrow_t const&)"
"__builtin_new",
"__builtin_vec_new",
|
|
From: Nicholas N. <nj...@ca...> - 2004-05-11 16:37:26
|
CVS commit by nethercote:
Fix patch from this morning -- missing commas, erk
M +2 -2 ms_main.c 1.9
--- valgrind/massif/ms_main.c #1.8:1.9
@@ -260,6 +260,6 @@ static Char* alloc_fns[MAX_ALLOC_FNS] =
"operator new(unsigned)",
"operator new[](unsigned)",
- "operator new(unsigned, std::nothrow_t const&)"
- "operator new[](unsigned, std::nothrow_t const&)"
+ "operator new(unsigned, std::nothrow_t const&)",
+ "operator new[](unsigned, std::nothrow_t const&)",
"__builtin_new",
"__builtin_vec_new",
|
|
From: Nicholas N. <nj...@ca...> - 2004-08-30 19:15:35
|
CVS commit by nethercote:
Avoid divisions by zero. This fixes bug 78765.
Also renamed two of the XPt fields so that things are clearer.
M +93 -73 ms_main.c 1.14
--- valgrind/massif/ms_main.c #1.13:1.14
@@ -101,11 +101,11 @@ struct _XPt {
// which contexts to include at each census point.
// !!! top-XPTs only !!!
- ULong spacetime;
+ ULong approx_ST;
- // spacetime2 is an exact space.time calculation done at the end, and
+ // exact_ST_dbld is an exact space.time calculation done at the end, and
// used in the results.
// Note that it is *doubled*, to avoid rounding errors.
// !!! not used for 'alloc_xpt' !!!
- ULong spacetime2;
+ ULong exact_ST_dbld;
// n_children and max_children are integers; a very big program might
@@ -121,5 +121,5 @@ struct _XPt {
// in the snapshot. The snapshot contains all the XTree's XPts, not in a
// tree structure, but flattened into an array. This flat snapshot is used
-// at the end for computing spacetime2 for each XPt.
+// at the end for computing exact_ST_dbld for each XPt.
//
// Graph resolution, x-axis: no point having more than about 200 census
@@ -370,6 +370,6 @@ static XPt* new_XPt(Addr eip, XPt* paren
xpt->curr_space = 0;
- xpt->spacetime = 0;
- xpt->spacetime2 = 0;
+ xpt->approx_ST = 0;
+ xpt->exact_ST_dbld = 0;
xpt->parent = parent;
@@ -439,6 +439,6 @@ static XPt* get_XCon( ThreadId tid, Bool
// XPt we return is (now and forever) a bottom-XPt. If the returned XPt
// wasn't a bottom-XPt (now or later) it would cause problems later (eg.
- // the parent's spacetime wouldn't be equal to the total of the
- // childrens' spacetimes).
+ // the parent's approx_ST wouldn't be equal [or almost equal] to the
+ // total of the childrens' approx_STs).
eips[ n_eips++ ] = 0xffffffff;
@@ -537,16 +537,16 @@ static void update_XCon(XPt* xpt, Int sp
// Actually want a reverse sort, biggest to smallest
-static Int XPt_cmp_spacetime(void* n1, void* n2)
+static Int XPt_cmp_approx_ST(void* n1, void* n2)
{
XPt* xpt1 = *(XPt**)n1;
XPt* xpt2 = *(XPt**)n2;
- return (xpt1->spacetime < xpt2->spacetime ? 1 : -1);
+ return (xpt1->approx_ST < xpt2->approx_ST ? 1 : -1);
}
-static Int XPt_cmp_spacetime2(void* n1, void* n2)
+static Int XPt_cmp_exact_ST_dbld(void* n1, void* n2)
{
XPt* xpt1 = *(XPt**)n1;
XPt* xpt2 = *(XPt**)n2;
- return (xpt1->spacetime2 < xpt2->spacetime2 ? 1 : -1);
+ return (xpt1->exact_ST_dbld < xpt2->exact_ST_dbld ? 1 : -1);
}
@@ -859,10 +859,10 @@ static UInt get_xtree_size(XPt* xpt, UIn
UInt i;
-// VG_(printf)("%4d ", xpt->curr_space);
+ // If no memory allocated at all, nothing interesting to record.
+ if (alloc_xpt->curr_space == 0) return 0;
- // If this one has size zero, all the children will be size zero too, so
- // nothing interesting to record.
-// if (0 != xpt->curr_space || 0 == ix) {
- if (xpt->curr_space / (double)alloc_xpt->curr_space > 0.002 || 0 == ix) {
+ // Ignore sub-XTrees that account for a miniscule fraction of current
+ // allocated space.
+ if (xpt->curr_space / (double)alloc_xpt->curr_space > 0.002) {
ix++;
@@ -879,12 +879,13 @@ UInt do_space_snapshot(XPt xpt[], XTreeS
UInt i;
- // Snapshot this XPt, if non-zero space, or the first one
-// if (0 != xpt->curr_space || 0 == ix) {
- if (xpt->curr_space / (double)alloc_xpt->curr_space > 0.002 || 0 == ix) {
+ // Structure of this function mirrors that of get_xtree_size().
+
+ if (alloc_xpt->curr_space == 0) return 0;
+
+ if (xpt->curr_space / (double)alloc_xpt->curr_space > 0.002) {
xtree_snapshot[ix].xpt = xpt;
xtree_snapshot[ix].space = xpt->curr_space;
ix++;
- // Snapshot all (non-zero) descendent XPts
for (i = 0; i < xpt->n_children; i++)
ix = do_space_snapshot(xpt->children[i], xtree_snapshot, ix);
@@ -1008,13 +1009,13 @@ static void hp_census(void)
: MAX_SNAPSHOTS); // max out
- // Update .spacetime field (approximatively) for all top-XPts.
+ // Update .approx_ST field (approximatively) for all top-XPts.
// We *do not* do it for any non-top-XPTs.
for (i = 0; i < alloc_xpt->n_children; i++) {
XPt* top_XPt = alloc_xpt->children[i];
- top_XPt->spacetime += top_XPt->curr_space * ms_time_since_prev;
+ top_XPt->approx_ST += top_XPt->curr_space * ms_time_since_prev;
}
- // Sort top-XPts by spacetime2 field.
+ // Sort top-XPts by approx_ST field.
VG_(ssort)(alloc_xpt->children, alloc_xpt->n_children, sizeof(XPt*),
- XPt_cmp_spacetime);
+ XPt_cmp_approx_ST);
VGP_PUSHCC(VgpCensusHeap);
@@ -1024,13 +1025,19 @@ static void hp_census(void)
// Nb: the xtree_size count/snapshot buffer allocation, and the actual
// snapshot, take similar amounts of time (measured with the
- // millesecond counter).
+ // millisecond counter).
for (i = 0; i < K; i++) {
UInt xtree_size, xtree_size2;
-// VG_(printf)("%7u ", alloc_xpt->children[i]->spacetime);
- // Count how many XPts are in the XTree; make array of that size
- // (+1 for zero termination, which calloc() does for us).
+// VG_(printf)("%7u ", alloc_xpt->children[i]->approx_ST);
+ // Count how many XPts are in the XTree
VGP_PUSHCC(VgpCensusTreeSize);
xtree_size = get_xtree_size( alloc_xpt->children[i], 0 );
VGP_POPCC(VgpCensusTreeSize);
+
+ // If no XPts counted (ie. alloc_xpt.curr_space==0 or XTree
+ // insignificant) then don't take any more snapshots.
+ if (0 == xtree_size) break;
+
+ // Make array of the appropriate size (+1 for zero termination,
+ // which calloc() does for us).
census->xtree_snapshots[i] =
VG_(calloc)(xtree_size+1, sizeof(XPtSnapshot));
@@ -1042,5 +1049,5 @@ static void hp_census(void)
// XTree into the snapshot array, along with pointers to the XPts.
// (Except for ones with curr_space==0, which wouldn't contribute
- // to the final spacetime2 calculation anyway; excluding them
+ // to the final exact_ST_dbld calculation anyway; excluding them
// saves a lot of memory and up to 40% time with big --depth valus.
VGP_PUSHCC(VgpCensusSnapshot);
@@ -1180,5 +1187,5 @@ void SK_(pre_clo_init)()
VGP_(register_profile_event)(VgpCensusTreeSize, "census-treesize");
VGP_(register_profile_event)(VgpUpdateXCon, "update-XCon");
- VGP_(register_profile_event)(VgpCalcSpacetime2, "calc-spacetime2");
+ VGP_(register_profile_event)(VgpCalcSpacetime2, "calc-exact_ST_dbld");
VGP_(register_profile_event)(VgpPrintHp, "print-hp");
VGP_(register_profile_event)(VgpPrintXPts, "print-XPts");
@@ -1214,6 +1221,6 @@ UCodeBlock* SK_(instrument)(UCodeBlock*
/*------------------------------------------------------------*/
-// Although we've been calculating spacetime along the way, because the
-// earlier calculations were done at a finer timescale, the .spacetime field
+// Although we've been calculating space-time along the way, because the
+// earlier calculations were done at a finer timescale, the .approx_ST field
// might not agree with what hp2ps sees, because we've thrown away some of
// the information. So recompute it at the scale that hp2ps sees, so we can
@@ -1222,5 +1229,5 @@ UCodeBlock* SK_(instrument)(UCodeBlock*
// that get printed in the .hp file, so it's cheap.
//
-// The spacetime calculation:
+// The approx_ST calculation:
// ( a[0]*d(0,1) + a[1]*(d(0,1) + d(1,2)) + ... + a[N-1]*d(N-2,N-1) ) / 2
// where
@@ -1237,9 +1244,9 @@ UCodeBlock* SK_(instrument)(UCodeBlock*
// census time is easy.
//
-// Each heap calculation gets added to its context's spacetime2 field.
+// Each heap calculation gets added to its context's exact_ST_dbld field.
// The ULong* values are all running totals, hence the use of "+=" everywhere.
// This does the calculations for a single census.
-static void calc_spacetime2b(Census* census, UInt d_t1_t2,
+static void calc_exact_ST_dbld2(Census* census, UInt d_t1_t2,
ULong* twice_heap_ST,
ULong* twice_heap_admin_ST,
@@ -1252,12 +1259,13 @@ static void calc_spacetime2b(Census* cen
if (clo_heap) {
for (i = 0; NULL != census->xtree_snapshots[i]; i++) {
- // Compute total heap spacetime2 for the entire XTree using only the
- // top-XPt (the first XPt in xtree_snapshot).
+ // Compute total heap exact_ST_dbld for the entire XTree using only
+ // the top-XPt (the first XPt in xtree_snapshot).
*twice_heap_ST += d_t1_t2 * census->xtree_snapshots[i][0].space;
- // Increment spacetime2 for every XPt in xtree_snapshot (inc. top one)
+ // Increment exact_ST_dbld for every XPt in xtree_snapshot (inc.
+ // top one)
for (j = 0; NULL != census->xtree_snapshots[i][j].xpt; j++) {
xpt_snapshot = & census->xtree_snapshots[i][j];
- xpt_snapshot->xpt->spacetime2 += d_t1_t2 * xpt_snapshot->space;
+ xpt_snapshot->xpt->exact_ST_dbld += d_t1_t2 * xpt_snapshot->space;
}
}
@@ -1275,5 +1283,5 @@ static void calc_spacetime2b(Census* cen
// This does the calculations for all censi.
-static void calc_spacetime2(ULong* heap2, ULong* heap_admin2, ULong* stack2)
+static void calc_exact_ST_dbld(ULong* heap2, ULong* heap_admin2, ULong* stack2)
{
UInt i, N = curr_census;
@@ -1288,13 +1296,13 @@ static void calc_spacetime2(ULong* heap2
return;
- calc_spacetime2b( &censi[0], censi[1].ms_time - censi[0].ms_time,
+ calc_exact_ST_dbld2( &censi[0], censi[1].ms_time - censi[0].ms_time,
heap2, heap_admin2, stack2 );
for (i = 1; i <= N-2; i++) {
- calc_spacetime2b( & censi[i], censi[i+1].ms_time - censi[i-1].ms_time,
+ calc_exact_ST_dbld2( & censi[i], censi[i+1].ms_time - censi[i-1].ms_time,
heap2, heap_admin2, stack2 );
}
- calc_spacetime2b( & censi[N-1], censi[N-1].ms_time - censi[N-2].ms_time,
+ calc_exact_ST_dbld2( & censi[N-1], censi[N-1].ms_time - censi[N-2].ms_time,
heap2, heap_admin2, stack2 );
// Now get rid of the halves. May lose a 0.5 on each, doesn't matter.
@@ -1499,4 +1507,5 @@ static Char* make_perc(ULong spacetime,
UInt p = 10;
+ sk_assert(0 != total_spacetime);
percentify(spacetime * 100 * p / total_spacetime, p, 5, mbuf);
return mbuf;
@@ -1561,27 +1570,33 @@ static void pp_all_XPts2(Int fd, Queue*
Char* depth = ( is_HTML ? "<code>--depth</code>" : "--depth" );
+ if (total_spacetime == 0) {
+ SPRINTF(buf, "(No heap memory allocated)\n");
+ return;
+ }
+
+
SPRINTF(buf, "== %d ===========================%s\n", L, maybe_br);
while (NULL != (xpt = (XPt*)dequeue(q))) {
- // Check that non-top-level XPts have a zero .spacetime field.
- if (xpt->parent != alloc_xpt) sk_assert( 0 == xpt->spacetime );
+ // Check that non-top-level XPts have a zero .approx_ST field.
+ if (xpt->parent != alloc_xpt) sk_assert( 0 == xpt->approx_ST );
- // Check that the sum of all children .spacetime2s equals parent's
- // (unless alloc_xpt, when it should == 0).
+ // Check that the sum of all children .exact_ST_dbld fields equals
+ // parent's (unless alloc_xpt, when it should == 0).
if (alloc_xpt == xpt) {
- sk_assert(0 == xpt->spacetime2);
+ sk_assert(0 == xpt->exact_ST_dbld);
} else {
sum = 0;
for (i = 0; i < xpt->n_children; i++) {
- sum += xpt->children[i]->spacetime2;
+ sum += xpt->children[i]->exact_ST_dbld;
}
- //sk_assert(sum == xpt->spacetime2);
+ //sk_assert(sum == xpt->exact_ST_dbld);
// It's possible that not all the children were included in the
- // spacetime2 calculations. Hopefully almost all of them were, and
+ // exact_ST_dbld calculations. Hopefully almost all of them were, and
// all the important ones.
-// sk_assert(sum <= xpt->spacetime2);
-// sk_assert(sum * 1.05 > xpt->spacetime2 );
-// if (sum != xpt->spacetime2) {
-// VG_(printf)("%ld, %ld\n", sum, xpt->spacetime2);
+// sk_assert(sum <= xpt->exact_ST_dbld);
+// sk_assert(sum * 1.05 > xpt->exact_ST_dbld );
+// if (sum != xpt->exact_ST_dbld) {
+// VG_(printf)("%ld, %ld\n", sum, xpt->exact_ST_dbld);
// }
}
@@ -1592,6 +1607,6 @@ static void pp_all_XPts2(Int fd, Queue*
make_perc(heap_spacetime, total_spacetime), maybe_br);
} else {
- // Remember: spacetime2 is space.time *doubled*
- perc = make_perc(xpt->spacetime2 / 2, total_spacetime);
+ // Remember: exact_ST_dbld is space.time *doubled*
+ perc = make_perc(xpt->exact_ST_dbld / 2, total_spacetime);
if (is_HTML) {
SPRINTF(buf, "<a name=\"b%x\"></a>"
@@ -1607,7 +1622,7 @@ static void pp_all_XPts2(Int fd, Queue*
}
- // Sort children by spacetime2
+ // Sort children by exact_ST_dbld
VG_(ssort)(xpt->children, xpt->n_children, sizeof(XPt*),
- XPt_cmp_spacetime2);
+ XPt_cmp_exact_ST_dbld);
SPRINTF(buf, "%s\nCalled from:%s\n", maybe_p, maybe_ul);
@@ -1616,5 +1631,5 @@ static void pp_all_XPts2(Int fd, Queue*
// Stop when <1% of total spacetime
- if (child->spacetime2 * 1000 / (total_spacetime * 2) < 5) {
+ if (child->exact_ST_dbld * 1000 / (total_spacetime * 2) < 5) {
UInt n_insig = xpt->n_children - i;
Char* s = ( n_insig == 1 ? "" : "s" );
@@ -1626,6 +1641,6 @@ static void pp_all_XPts2(Int fd, Queue*
}
- // Remember: spacetime2 is space.time *doubled*
- perc = make_perc(child->spacetime2 / 2, total_spacetime);
+ // Remember: exact_ST_dbld is space.time *doubled*
+ perc = make_perc(child->exact_ST_dbld / 2, total_spacetime);
eip_desc = VG_(describe_eip)(child->eip-1, buf2, BUF_LEN);
if (is_HTML) {
@@ -1738,17 +1754,21 @@ print_summary(ULong total_ST, ULong heap
if (clo_heap)
VG_(message)(Vg_UserMsg, "heap: %s",
- make_perc(heap_ST, total_ST) );
+ ( 0 == total_ST ? (Char*)"(n/a)"
+ : make_perc(heap_ST, total_ST) ) );
// Heap admin --------------------------------------------------------
if (clo_heap_admin)
VG_(message)(Vg_UserMsg, "heap admin: %s",
- make_perc(heap_admin_ST, total_ST));
+ ( 0 == total_ST ? (Char*)"(n/a)"
+ : make_perc(heap_admin_ST, total_ST) ) );
sk_assert( VG_(HT_count_nodes)(malloc_list) == n_heap_blocks );
// Stack(s) ----------------------------------------------------------
- if (clo_stacks)
+ if (clo_stacks) {
+ sk_assert(0 != total_ST);
VG_(message)(Vg_UserMsg, "stack(s): %s",
- make_perc(stack_ST, total_ST));
+ make_perc(stack_ST, total_ST) );
+ }
if (VG_(clo_verbosity) > 1) {
@@ -1784,5 +1804,5 @@ void SK_(fini)(Int exit_status)
// Redo spacetimes of significant contexts to match the .hp file.
- calc_spacetime2(&heap_ST, &heap_admin_ST, &stack_ST);
+ calc_exact_ST_dbld(&heap_ST, &heap_admin_ST, &stack_ST);
total_ST = heap_ST + heap_admin_ST + stack_ST;
write_hp_file ( );
|
|
From: Nicholas N. <nj...@ca...> - 2004-09-13 13:27:38
|
CVS commit by nethercote:
Don't inline large function
M +1 -1 ms_main.c 1.16
--- valgrind/massif/ms_main.c #1.15:1.16
@@ -664,5 +664,5 @@ void remove_HP_Chunk(HP_Chunk* hc, HP_Ch
static void hp_census(void);
-static __inline__
+static
void* new_block ( void* p, Int size, UInt align, Bool is_zeroed )
{
|
|
From: Nicholas N. <nj...@cs...> - 2005-03-10 02:41:03
|
CVS commit by nethercote:
Don't print debug info.
M +0 -1 ms_main.c 1.25
--- valgrind/massif/ms_main.c #1.24:1.25
@@ -850,5 +850,4 @@ static UInt curr_census = 0;
static Bool count_stack_size( Addr stack_min, Addr stack_max, void *cp )
{
- VG_(printf)("stack_max=%p stack_min=%p delta=%d\n", stack_max, stack_min, stack_max-stack_min);
*(UInt *)cp += (stack_max - stack_min);
return False;
|