Home | History | Annotate | Download | only in massif

Lines Matching refs:snapshot

41 //     - "show me the extra allocations since the last snapshot"
90 snapshot=0
98 snapshot=1
122 - each snapshot specifies an x-axis value and one or more y-axis values.
196 // - Detailed: these record those things in a normal snapshot, plus a very
201 // - Temporary: Massif does a temporary snapshot every so often. The idea
207 // - Permanent: Massif takes a permanent (detailed) snapshot in some
209 // - Peak snapshot: When the memory usage peak is reached, it takes a
210 // snapshot. It keeps this, unless the peak is subsequently exceeded,
211 // in which case it will overwrite the peak snapshot.
261 // This is the total size from the current peak snapshot, or 0 if no peak
262 // snapshot has been taken yet.
443 " --detailed-freq=<N> every Nth snapshot should be detailed [10]\n"
647 XTree* xt; // Snapshot of heap_xt, if a detailed snapshot,
649 Snapshot;
651 static UInt next_snapshot_i = 0; // Index of where next snapshot will go.
652 static Snapshot* snapshots; // Array of snapshots.
654 static Bool is_snapshot_in_use(Snapshot* snapshot)
656 if (Unused == snapshot->kind) {
657 // If snapshot is unused, check all the fields are unset.
658 tl_assert(snapshot->time == UNUSED_SNAPSHOT_TIME);
659 tl_assert(snapshot->heap_extra_szB == 0);
660 tl_assert(snapshot->heap_szB == 0);
661 tl_assert(snapshot->stacks_szB == 0);
662 tl_assert(snapshot->xt == NULL);
665 tl_assert(snapshot->time != UNUSED_SNAPSHOT_TIME);
670 static Bool is_detailed_snapshot(Snapshot* snapshot)
672 return (snapshot->xt ? True : False);
675 static Bool is_uncullable_snapshot(Snapshot* snapshot)
677 return &snapshots[0] == snapshot // First snapshot
678 || &snapshots[next_snapshot_i-1] == snapshot // Last snapshot
679 || snapshot->kind == Peak; // Peak snapshot
682 static void sanity_check_snapshot(Snapshot* snapshot)
685 tl_assert(snapshot->xt == NULL || snapshot->kind != Unused);
700 // This zeroes all the fields in the snapshot, but does not free the xt
704 static void clear_snapshot(Snapshot* snapshot, Bool do_sanity_check)
706 if (do_sanity_check) sanity_check_snapshot(snapshot);
707 snapshot->kind = Unused;
708 snapshot->time = UNUSED_SNAPSHOT_TIME;
709 snapshot->heap_extra_szB = 0;
710 snapshot->heap_szB = 0;
711 snapshot->stacks_szB = 0;
712 snapshot->xt = NULL;
715 // This zeroes all the fields in the snapshot, and frees the heap XTree xt if
717 static void delete_snapshot(Snapshot* snapshot)
722 XTree* tmp_xt = snapshot->xt;
723 clear_snapshot(snapshot, /*do_sanity_check*/True);
731 Snapshot* snapshot = &snapshots[i];
733 switch (snapshot->kind) {
735 case Normal: suffix = ( is_detailed_snapshot(snapshot) ? "d" : "." ); break;
738 tl_assert2(0, "VERB_snapshot: unknown snapshot kind: %d", snapshot->kind);
742 snapshot->time,
743 snapshot->heap_szB,
744 snapshot->heap_extra_szB,
745 snapshot->stacks_szB
753 // Algorithm for N snapshots: We find the snapshot representing the smallest
755 // We have to do this one snapshot at a time, rather than finding the (N/2)
756 // smallest snapshots in one hit, because when a snapshot is removed, its
770 // Sets j to the index of the first not-yet-removed snapshot at or after i
781 // Find the snapshot representing the smallest timespan. The timespan
782 // for snapshot n = d(N-1,N)+d(N,N+1), where d(A,B) is the time between
783 // snapshot A and B. We don't consider the first and last snapshots for
785 Snapshot* min_snapshot;
798 // Nb: We never cull the peak snapshot.
808 // We've found the least important snapshot, now delete it. First
839 // two intervals around a snapshot that was under consideration for
843 snapshot 0, and the
844 // peak snapshot) are uncullable. If two uncullable snapshots end up
892 // to zero and us taking our first snapshot. We determine that time
894 // first snapshot is considered to be at t = 0ms. Unfortunately, a
895 // bunch of symbols get read after the first snapshot is taken but
899 // the first snapshot isn't at t=0.
916 // Take a snapshot, and only that -- decisions on whether to take a
917 // snapshot, or what kind of snapshot, are made elsewhere.
921 take_snapshot(Snapshot* snapshot, SnapshotKind kind, Time my_time,
924 tl_assert(!is_snapshot_in_use(snapshot));
931 snapshot->heap_szB = heap_szB;
933 snapshot->xt = VG_(XT_snapshot)(heap_xt);
935 snapshot->heap_extra_szB = heap_extra_szB;
940 snapshot->stacks_szB = stacks_szB;
943 // Rest of snapshot.
944 snapshot->kind = kind;
945 snapshot->time = my_time;
946 sanity_check_snapshot(snapshot);
955 // Take a snapshot, if it's time, or if we've hit a peak.
960 // If we try to take a snapshot and less than this much time has passed,
965 // Zero allows startup snapshot.
970 Snapshot* snapshot;
978 // Only do a snapshot if it's time.
990 // amount bigger than the previous peak, then we take a peak snapshot.
991 // By not taking a snapshot for every peak, we save a lot of effort --
1004 tl_assert2(0, "maybe_take_snapshot: unrecognised snapshot kind");
1007 // Take the snapshot.
1008 snapshot = & snapshots[next_snapshot_i];
1009 take_snapshot(snapshot, kind, my_time, is_detailed);
1018 // Update peak data, if it's a Peak snapshot.
1024 snapshot->heap_szB + snapshot->heap_extra_szB + snapshot->stacks_szB;
1029 // Find the old peak snapshot, if it exists, and mark it as normal.
1041 VERB(2, " (skipped %d snapshot%s)\n",
1048 // Cull the entries, if our snapshot table is full.
1054 // Work out the earliest time when the next snapshot can happen.
1145 // Maybe take a snapshot.
1205 // Maybe take a peak snapshot, since it's a deallocation.
1216 // Maybe take a snapshot.
1270 // Maybe take a peak snapshot, if it's (effectively) a deallocation.
1348 // Maybe take a snapshot.
1439 // Record the last page as a block, and maybe do a snapshot afterwards.
1450 // Unrecord the first page. This might be the peak, so do a snapshot.
1592 " snapshot [<filename>]\n"
1594 " takes a snapshot (or a detailed snapshot)\n"
1598 " saves all snapshot(s) taken so far in <filename>\n"
1746 static void pp_snapshot(MsFile *fp, Snapshot* snapshot, Int snapshot_n)
1750 .time = snapshot->time,
1751 .sz_B = snapshot->heap_szB,
1752 .extra_B = snapshot->heap_extra_szB,
1753 .stacks_B = snapshot->stacks_szB,
1754 .detailed = is_detailed_snapshot(snapshot),
1755 .peak = Peak == snapshot->kind,
1762 sanity_check_snapshot(snapshot);
1764 VG_(XT_massif_print)(fp, snapshot->xt, &header, alloc_szB);
1768 Snapshot snapshots_array[],
1782 Snapshot* snapshot = & snapshots_array[i];
1783 pp_snapshot(fp, snapshot, i); // Detailed snapshot!
1804 Snapshot snapshot;
1809 ("error: cannot take snapshot before execution has started\n");
1813 clear_snapshot(&snapshot, /* do_sanity_check */ False);
1814 take_snapshot(&snapshot, Normal, get_time(), detailed);
1817 &snapshot,
1819 delete_snapshot(&snapshot);
1827 ("error: cannot take snapshot before execution has started\n");
1865 switch (VG_(keyword_id) ("help snapshot detailed_snapshot all_snapshots"
1875 case 1: { /* snapshot */
2045 // Initialise snapshot array, and sanity-check it.
2047 sizeof(Snapshot) * clo_max_snapshots);
2048 // We don't want to do snapshot sanity checks here, because they're