Home | History | Annotate | Download | only in massif

Lines Matching defs:Snapshot

41 //     - "show me the extra allocations since the last snapshot"
95 snapshot=0
103 snapshot=1
127 - each snapshot specifies an x-axis value and one or more y-axis values.
198 // - Detailed: these record those things in a normal snapshot, plus a very
203 // - Temporary: Massif does a temporary snapshot every so often. The idea
209 // - Permanent: Massif takes a permanent (detailed) snapshot in some
211 // - Peak snapshot: When the memory usage peak is reached, it takes a
212 // snapshot. It keeps this, unless the peak is subsequently exceeded,
213 // in which case it will overwrite the peak snapshot.
268 // This is the total size from the current peak snapshot, or 0 if no peak
269 // snapshot has been taken yet.
469 " --detailed-freq=<N> every Nth snapshot should be detailed [10]\n"
520 // for "saved". When the XTree is duplicated for a snapshot, we duplicate
1024 SXPt* alloc_sxpt; // Heap XTree root, if a detailed snapshot,
1026 Snapshot;
1028 static UInt next_snapshot_i = 0; // Index of where next snapshot will go.
1029 static Snapshot* snapshots; // Array of snapshots.
1031 static Bool is_snapshot_in_use(Snapshot* snapshot)
1033 if (Unused == snapshot->kind) {
1034 // If snapshot is unused, check all the fields are unset.
1035 tl_assert(snapshot->time == UNUSED_SNAPSHOT_TIME);
1036 tl_assert(snapshot->heap_extra_szB == 0);
1037 tl_assert(snapshot->heap_szB == 0);
1038 tl_assert(snapshot->stacks_szB == 0);
1039 tl_assert(snapshot->alloc_sxpt == NULL);
1042 tl_assert(snapshot->time != UNUSED_SNAPSHOT_TIME);
1047 static Bool is_detailed_snapshot(Snapshot* snapshot)
1049 return (snapshot->alloc_sxpt ? True : False);
1052 static Bool is_uncullable_snapshot(Snapshot* snapshot)
1054 return &snapshots[0] == snapshot // First snapshot
1055 || &snapshots[next_snapshot_i-1] == snapshot // Last snapshot
1056 || snapshot->kind == Peak; // Peak snapshot
1059 static void sanity_check_snapshot(Snapshot* snapshot)
1061 if (snapshot->alloc_sxpt) {
1062 sanity_check_SXTree(snapshot->alloc_sxpt);
1078 // This zeroes all the fields in the snapshot, but does not free the heap
1082 static void clear_snapshot(Snapshot* snapshot, Bool do_sanity_check)
1084 if (do_sanity_check) sanity_check_snapshot(snapshot);
1085 snapshot->kind = Unused;
1086 snapshot->time = UNUSED_SNAPSHOT_TIME;
1087 snapshot->heap_extra_szB = 0;
1088 snapshot->heap_szB = 0;
1089 snapshot->stacks_szB = 0;
1090 snapshot->alloc_sxpt = NULL;
1093 // This zeroes all the fields in the snapshot, and frees the heap XTree if
1095 static void delete_snapshot(Snapshot* snapshot)
1100 SXPt* tmp_sxpt = snapshot->alloc_sxpt;
1101 clear_snapshot(snapshot, /*do_sanity_check*/True);
1109 Snapshot* snapshot = &snapshots[i];
1111 switch (snapshot->kind) {
1113 case Normal: suffix = ( is_detailed_snapshot(snapshot) ? "d" : "." ); break;
1116 tl_assert2(0, "VERB_snapshot: unknown snapshot kind: %d", snapshot->kind);
1120 snapshot->time,
1121 snapshot->heap_szB,
1122 snapshot->heap_extra_szB,
1123 snapshot->stacks_szB
1131 // Algorithm for N snapshots: We find the snapshot representing the smallest
1133 // We have to do this one snapshot at a time, rather than finding the (N/2)
1134 // smallest snapshots in one hit, because when a snapshot is removed, its
1148 // Sets j to the index of the first not-yet-removed snapshot at or after i
1159 // Find the snapshot representing the smallest timespan. The timespan
1160 // for snapshot n = d(N-1,N)+d(N,N+1), where d(A,B) is the time between
1161 // snapshot A and B. We don't consider the first and last snapshots for
1163 Snapshot* min_snapshot;
1176 // Nb: We never cull the peak snapshot.
1186 // We've found the least important snapshot, now delete it. First
1217 // two intervals around a snapshot that was under consideration for
1221 // But we have to be careful -- some snapshots (eg. snapshot 0, and the
1222 // peak snapshot) are uncullable. If two uncullable snapshots end up
1270 // to zero and us taking our first snapshot. We determine that time
1272 // first snapshot is considered to be at t = 0ms. Unfortunately, a
1273 // bunch of symbols get read after the first snapshot is taken but
1277 // the first snapshot isn't at t=0.
1294 // Take a snapshot, and only that -- decisions on whether to take a
1295 // snapshot, or what kind of snapshot, are made elsewhere.
1299 take_snapshot(Snapshot* snapshot, SnapshotKind kind, Time my_time,
1302 tl_assert(!is_snapshot_in_use(snapshot));
1309 snapshot->heap_szB = heap_szB;
1312 snapshot->alloc_sxpt = dup_XTree(alloc_xpt, total_szB);
1314 tl_assert(snapshot->alloc_sxpt->szB == heap_szB);
1316 snapshot->heap_extra_szB = heap_extra_szB;
1321 snapshot->stacks_szB = stacks_szB;
1324 // Rest of snapshot.
1325 snapshot->kind = kind;
1326 snapshot->time = my_time;
1327 sanity_check_snapshot(snapshot);
1336 // Take a snapshot, if it's time, or if we've hit a peak.
1341 // If we try to take a snapshot and less than this much time has passed,
1346 // Zero allows startup snapshot.
1351 Snapshot* snapshot;
1359 // Only do a snapshot if it's time.
1371 // amount bigger than the previous peak, then we take a peak snapshot.
1372 // By not taking a snapshot for every peak, we save a lot of effort --
1385 tl_assert2(0, "maybe_take_snapshot: unrecognised snapshot kind");
1388 // Take the snapshot.
1389 snapshot = & snapshots[next_snapshot_i];
1390 take_snapshot(snapshot, kind, my_time, is_detailed);
1399 // Update peak data, if it's a Peak snapshot.
1405 snapshot->heap_szB + snapshot->heap_extra_szB + snapshot->stacks_szB;
1410 // Find the old peak snapshot, if it exists, and mark it as normal.
1422 VERB(2, " (skipped %d snapshot%s)\n",
1429 // Cull the entries, if our snapshot table is full.
1435 // Work out the earliest time when the next snapshot can happen.
1526 // Maybe take a snapshot.
1586 // Maybe take a peak snapshot, since it's a deallocation.
1597 // Maybe take a snapshot.
1647 // Maybe take a peak snapshot, if it's (effectively) a deallocation.
1717 // Maybe take a snapshot.
1808 // Record the last page as a block, and maybe do a snapshot
1955 VG_(gdb_printf) (" snapshot [<filename>]\n");
1957 VG_(gdb_printf) (" takes a snapshot (or a detailed snapshot)\n");
1961 VG_(gdb_printf) (" saves all snapshot(s) taken so far in <filename>\n");
2227 static void pp_snapshot(VgFile *fp, Snapshot* snapshot, Int snapshot_n)
2229 sanity_check_snapshot(snapshot);
2232 FP("snapshot=%d\n", snapshot_n);
2234 FP("time=%lld\n", snapshot->time);
2235 FP("mem_heap_B=%lu\n", snapshot->heap_szB);
2236 FP("mem_heap_extra_B=%lu\n", snapshot->heap_extra_szB);
2237 FP("mem_stacks_B=%lu\n", snapshot->stacks_szB);
2239 if (is_detailed_snapshot(snapshot)) {
2240 // Detailed snapshot -- print heap tree.
2245 snapshot->heap_szB + snapshot->heap_extra_szB + snapshot->stacks_szB;
2248 FP("heap_tree=%s\n", ( Peak == snapshot->kind ? "peak" : "detailed" ));
2249 pp_snapshot_SXPt(fp, snapshot->alloc_sxpt, 0, depth_str,
2250 depth_str_len, snapshot->heap_szB,
2261 Snapshot snapshots_array[],
2301 Snapshot* snapshot = & snapshots_array[i];
2302 pp_snapshot(fp, snapshot, i); // Detailed snapshot!
2323 Snapshot snapshot;
2328 ("error: cannot take snapshot before execution has started\n");
2332 clear_snapshot(&snapshot, /* do_sanity_check */ False);
2333 take_snapshot(&snapshot, Normal, get_time(), detailed);
2336 &snapshot,
2338 delete_snapshot(&snapshot);
2346 ("error: cannot take snapshot before execution has started\n");
2364 switch (VG_(keyword_id) ("help snapshot detailed_snapshot all_snapshots",
2373 case 1: { /* snapshot */
2536 // Initialise snapshot array, and sanity-check it.
2538 sizeof(Snapshot) * clo_max_snapshots);
2539 // We don't want to do snapshot sanity checks here, because they're