protected IEnumerator <object> UpdateStats() { yield return(Instance.UpdateFilteredTracebacks()); var fDataSeries = Instance.GenerateTopFunctions(); yield return(fDataSeries); SnapshotTimeline.DataSeries.Clear(); foreach (var kvp in fDataSeries.Result) { SnapshotTimeline.DataSeries.Add(kvp.Key, kvp.Value); } SnapshotTimeline.Invalidate(); }
public IEnumerator <object> SaveToRecording(HeapRecording recording) { var db = recording.Database; SavedToDatabase = true; yield return(db.Snapshots.Set(Index, Info)); { var batch = db.Modules.CreateBatch(Modules.Count); foreach (var module in Modules) { batch.Add(module.Filename, module); } yield return(batch.Execute()); } yield return(db.SnapshotModules.Set(Index, Modules.Keys.ToArray())); { var tracebackBatch = db.Tracebacks.CreateBatch(Tracebacks.Count); foreach (var traceback in Tracebacks) { tracebackBatch.Add(traceback.ID, traceback); } yield return(tracebackBatch.Execute()); yield return(recording.UpdateFilteredTracebacks( from traceback in Tracebacks select traceback.ID )); } UInt16 uIndex = (UInt16)Index; HashSet <UInt32> addressSet; DecisionUpdateCallback <AllocationRanges> rangeUpdater = (ref AllocationRanges oldValue, ref AllocationRanges newValue) => { var r = newValue.Ranges.Array[newValue.Ranges.Offset]; newValue = oldValue.Update(r.First, r.TracebackID, r.Size, r.Overhead); return(true); }; foreach (var heap in Heaps) { var fAddressSet = db.HeapAllocations.Get(heap.ID); yield return(fAddressSet); if (fAddressSet.Failed) { addressSet = new HashSet <UInt32>(); } else { addressSet = new HashSet <UInt32>(fAddressSet.Result); } var batch = db.Allocations.CreateBatch(heap.Allocations.Count); foreach (var allocation in heap.Allocations) { batch.AddOrUpdate( allocation.Address, AllocationRanges.New( uIndex, allocation.TracebackID, allocation.Size, allocation.Overhead ), rangeUpdater ); addressSet.Add(allocation.Address); } yield return(batch.Execute()); yield return(db.HeapAllocations.Set(heap.ID, addressSet.ToArray())); } yield return(db.SnapshotHeaps.Set(Index, (from heap in Heaps select heap.Info).ToArray())); }