Esempio n. 1
0
 public override string ToString()
 {
     return(String.Format(
                "{0} ({1:x8}-{2:x8}) by {3:x8}",
                FileSize.Format(Size),
                Address, NextOffset, TracebackID
                ));
 }
Esempio n. 2
0
        protected string FormatSize(long sizeBytes)
        {
            string result;

            if (!FormattedSizeCache.TryGetValue(sizeBytes, out result))
            {
                FormattedSizeCache[sizeBytes] = result = FileSize.Format(sizeBytes);
            }

            return(result);
        }
Esempio n. 3
0
        public override string ToString()
        {
            var result = String.Format(
                "{0}\r\n{1}{2} allocation(s), {3}{4}",
                Key,
                (Allocations > 0) ? "+" : "-",
                Math.Abs(Allocations),
                (BytesRequested > 0) ? "+" : "-",
                FileSize.Format(Math.Abs(BytesRequested))
                );

            if (Children.Count > 0)
            {
                result += String.Format("\r\nHas {0} children", Children.Count);
            }

            return(result);
        }
Esempio n. 4
0
 public static string FormatSizeBytes(long bytes)
 {
     return(FileSize.Format(bytes));
 }
Esempio n. 5
0
        public IEnumerator <object> RefreshDeltas()
        {
            if (Updating)
            {
                yield break;
            }

            SetBusy(true);

            Future <int> fTotalBytes  = new Future <int>(),
                         fTotalAllocs = new Future <int>(),
                         fMax         = new Future <int>();
            var newListItems          = new List <DeltaInfo>();
            var moduleList            = ModuleList;
            var deltas         = Deltas;
            var functionFilter = FunctionFilter;

            yield return(Future.RunInThread(() => {
                int max = -int.MaxValue;
                int totalBytes = 0, totalAllocs = 0;

                foreach (var delta in deltas)
                {
                    if (functionFilter != null)
                    {
                        bool matched = false;

                        foreach (var functionName in delta.Traceback.Functions)
                        {
                            if (functionFilter.IsMatch(functionName))
                            {
                                matched = true;
                                break;
                            }
                        }

                        if (!matched)
                        {
                            continue;
                        }
                    }

                    bool filteredOut = (delta.Traceback.Modules.Count > 0);
                    foreach (var module in delta.Traceback.Modules)
                    {
                        filteredOut &= !moduleList.SelectedItems.Contains(module);

                        if (!filteredOut)
                        {
                            break;
                        }
                    }

                    if (!filteredOut)
                    {
                        newListItems.Add(delta);
                        totalBytes += delta.BytesDelta * (delta.Added ? 1 : -1);
                        totalAllocs += delta.CountDelta.GetValueOrDefault(0) * (delta.Added ? 1 : -1);
                        max = Math.Max(max, delta.BytesDelta);
                    }
                }

                max = Math.Max(max, Math.Abs(totalBytes));
                fTotalBytes.Complete(totalBytes);
                fTotalAllocs.Complete(totalAllocs);
                fMax.Complete(max);
            }));

            StatusLabel.Text      = String.Format("Showing {0} out of {1} item(s)", newListItems.Count, deltas.Count);
            AllocationTotals.Text = String.Format("Delta bytes: {0} Delta allocations: {1}", FileSize.Format(fTotalBytes.Result), fTotalAllocs.Result);

            DeltaHistogram.Items = DeltaList.Items = newListItems;
            if (newListItems.Count > 0)
            {
                DeltaHistogram.Maximum = fMax.Result;
            }
            else
            {
                DeltaHistogram.Maximum = 1024;
            }
            DeltaHistogram.TotalDelta = fTotalBytes.Result;

            DeltaList.Invalidate();
            DeltaHistogram.Invalidate();

            SetBusy(false);
        }