Exemplo n.º 1
0
        protected Color SelectItemColor(HeapSnapshot.Allocation alloc)
        {
            var id = BitConverter.ToInt32(BitConverter.GetBytes(alloc.TracebackID), 0);

            int hue   = (id & 0xFFFF) % (HSV.HueMax);
            int value = ((id & (0xFFFF << 16)) % (HSV.ValueMax * 70 / 100)) + (HSV.ValueMax * 25 / 100);

            return(HSV.ColorFromHSV(
                       (UInt16)hue, HSV.SaturationMax, (UInt16)value
                       ));
        }
Exemplo n.º 2
0
 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;
 }
Exemplo n.º 3
0
        protected IEnumerator <object> FinishShowingTooltip(
            Point mouseLocation,
            HeapSnapshot.Heap heap,
            HeapSnapshot.Allocation allocation,
            HeapSnapshot.Traceback rawTraceback
            )
        {
            var uniqueRawFrames = rawTraceback.Frames.AsEnumerable().Distinct();

            var fSymbols = Instance.Database.SymbolCache.Select(uniqueRawFrames);

            using (fSymbols)
                yield return(fSymbols);

            var symbolDict = SequenceUtils.ToDictionary(
                uniqueRawFrames, fSymbols.Result
                );

            var tracebackInfo = HeapRecording.ConstructTracebackInfo(
                rawTraceback.ID, rawTraceback.Frames, symbolDict
                );

            var renderParams = new DeltaInfo.RenderParams {
                BackgroundBrush = new SolidBrush(SystemColors.Info),
                BackgroundColor = SystemColors.Info,
                TextBrush       = new SolidBrush(SystemColors.InfoText),
                IsExpanded      = true,
                IsSelected      = false,
                Font            = Font,
                ShadeBrush      = new SolidBrush(Color.FromArgb(31, 0, 0, 0)),
                StringFormat    = CustomTooltip.GetDefaultStringFormat()
            };

            var content = new HeapSnapshot.AllocationTooltipContent(
                ref allocation, ref tracebackInfo, ref renderParams
                )
            {
                Location = mouseLocation,
                Font     = Font
            };

            using (var g = CreateGraphics())
                CustomTooltip.FitContentOnScreen(
                    g, content,
                    ref content.RenderParams.Font,
                    ref content.Location, ref content.Size
                    );

            Tooltip.SetContent(content);
        }
Exemplo n.º 4
0
        public void Visit(HeapSnapshot.Allocation allocation)
        {
            lock (this) {
                if (VisitedTracebacks.Contains(allocation.TracebackID))
                {
                    return;
                }
                else
                {
                    VisitedTracebacks.Add(allocation.TracebackID);
                }

                Allocations    += 1;
                BytesRequested += (int)allocation.Size;
            }
        }