コード例 #1
0
ファイル: HeapLayoutView.cs プロジェクト: konlil/HeapProfiler
 public VisibleHeapAllocation(
     HeapSnapshot.Heap heap, int index, int rowIndex, int firstRowIndex,
     ref HeapSnapshot.Allocation allocation, RectangleF rectangle
 )
 {
     Heap = heap;
     Index = index;
     RowIndex = rowIndex;
     FirstRowIndex = firstRowIndex;
     Allocation = allocation;
     Rectangle = rectangle;
 }
コード例 #2
0
ファイル: HeapLayoutView.cs プロジェクト: konlil/HeapProfiler
 public VisibleHeap(HeapSnapshot.Heap heap, int firstRow, int heightInRows)
 {
     Heap = heap;
     FirstRow = firstRow;
     HeightInRows = heightInRows;
 }
コード例 #3
0
ファイル: HeapLayoutView.cs プロジェクト: konlil/HeapProfiler
 protected void HideTooltip()
 {
     if (TooltipHeap != null) {
         TooltipHeap = null;
         TooltipAllocationIndex = -1;
         Tooltip.Hide();
         Invalidate();
     }
 }
コード例 #4
0
ファイル: HeapLayoutView.cs プロジェクト: konlil/HeapProfiler
        protected override void OnMouseMove(MouseEventArgs e)
        {
            HeapSnapshot.Heap heap;
            int allocationIndex;

            if (AllocationFromPoint(e.Location, out heap, out allocationIndex)) {
                if ((heap != TooltipHeap) || (allocationIndex != TooltipAllocationIndex)) {
                    TooltipAllocationIndex = allocationIndex;
                    TooltipHeap = heap;

                    if (Tooltip == null)
                        Tooltip = new CustomTooltip(this);

                    Instance.Scheduler.Start(
                        FinishShowingTooltip(
                            PointToScreen(e.Location),
                            heap, heap.Allocations[allocationIndex],
                            Snapshot.Tracebacks[heap.Allocations[allocationIndex].TracebackID]
                        ),
                        TaskExecutionPolicy.RunAsBackgroundTask
                    );

                    Invalidate();
                }
            } else {
                HideTooltip();

                base.OnMouseMove(e);
            }
        }
コード例 #5
0
ファイル: HeapRecording.cs プロジェクト: konlil/HeapProfiler
        protected IEnumerator<object> LoadSnapshotFromDatabase(HeapSnapshotInfo info)
        {
            var result = new HeapSnapshot(info);

            var fModules = Database.SnapshotModules.Get(info.Index);
            var fHeaps = Database.SnapshotHeaps.Get(info.Index);

            using (fModules)
                yield return fModules;

            var fModuleInfos = Database.Modules.Select(fModules.Result);
            using (fModuleInfos)
                yield return fModuleInfos;

            foreach (var module in fModuleInfos.Result)
                result.Modules.Add(module);

            using (fHeaps)
                yield return fHeaps;

            var heapIDs = from heap in fHeaps.Result select heap.HeapID;
            var fAllocations = Database.HeapAllocations.Select(heapIDs);
            using (fAllocations)
                yield return fAllocations;

            var allocations = SequenceUtils.ToDictionary(heapIDs, fAllocations.Result);

            var tracebackIDs = new HashSet<UInt32>();

            foreach (var heapInfo in fHeaps.Result) {
                var theHeap = new HeapSnapshot.Heap(heapInfo);

                var allocationIds = allocations[heapInfo.HeapID];
                theHeap.Allocations.Capacity = allocationIds.Length;

                var fRanges = Database.Allocations.Select(allocationIds);
                using (fRanges)
                    yield return fRanges;

                yield return Future.RunInThread(() =>
                    SequenceUtils.Zip(
                        allocationIds, fRanges.Result, (id, ranges) => {
                            HeapSnapshot.AllocationRanges.Range range;

                            if (ranges.Get(info.Index, out range)) {
                                theHeap.Allocations.Add(new HeapSnapshot.Allocation(
                                    id, range.Size, range.Overhead, range.TracebackID
                                ));

                                tracebackIDs.Add(range.TracebackID);
                            }
                        }
                    )
                );

                result.Heaps.Add(theHeap);
            }

            var fTracebacks = Database.FilteredTracebacks.CascadingSelect(
                new [] { Database.Tracebacks },
                tracebackIDs
            );
            using (fTracebacks)
                yield return fTracebacks;

            result.Tracebacks.ReplaceWith(fTracebacks.Result);

            yield return Result.New(result);
        }