示例#1
0
        private void UpdateSelectionTotals()
        {
            bool atLeastOneValue = false;
            long total           = 0;

            foreach (XPTable.Models.Row row in iTable_SymbolMemory.SelectedItems)
            {
                TrackingInfo item = (TrackingInfo)row.Tag;
                //
                total          += item.AssociatedMemory;
                atLeastOneValue = true;
            }

            string totalValueAsString      = "[nothing selected]";
            string totalAsPercentageString = "";

            //
            if (atLeastOneValue)
            {
                int  allocCount;
                int  freeCount;
                long freeSpaceSize;
                long allocatedUnknownSize;
                long allocatedSymbolMatchSize;
                long totalHeapAllocatedMemory = TotalAllocatedMemory(out allocCount, out freeCount, out freeSpaceSize, out allocatedUnknownSize, out allocatedSymbolMatchSize);
                //
                totalValueAsString      = total.ToString();
                totalAsPercentageString = NumberFormattingUtils.NumberAsPercentageTwoDP(total, totalHeapAllocatedMemory) + " %";
            }
            //
            iLV_Summary.Items[9].SubItems[1].Text = totalValueAsString;
            iLV_Summary.Items[9].SubItems[2].Text = totalAsPercentageString;
        }
示例#2
0
        private void UpdateSummary()
        {
            long heapCellHeaderOverheadSize = Statistics.SizeTotalHeader;
            long symbolicMatchMemorySize    = Statistics.StatsAllocated.TrackerSymbols.TypeSize;
            long otherMemorySize            = (Statistics.StatsAllocated.TypeSize - Statistics.StatsAllocated.TrackerSymbols.TypeSize);
            long freeSpaceSize  = Statistics.StatsFree.TypeSize;
            long totalCellCount = Statistics.StatsAllocated.TypeCount + Statistics.StatsFree.TypeCount;

            // 1ST GROUP
            iLV_Summary.Items[0].SubItems[1].Text = Statistics.StatsAllocated.TypeCount.ToString();
            iLV_Summary.Items[0].SubItems[2].Text = NumberFormattingUtils.NumberAsPercentageTwoDP(Statistics.StatsAllocated.TypeCount, totalCellCount) + " %";
            iLV_Summary.Items[1].SubItems[1].Text = Statistics.StatsFree.TypeCount.ToString();
            iLV_Summary.Items[1].SubItems[2].Text = NumberFormattingUtils.NumberAsPercentageTwoDP(Statistics.StatsFree.TypeCount, totalCellCount) + " %";

            // 2ND GROUP
            iLV_Summary.Items[2].SubItems[1].Text = symbolicMatchMemorySize.ToString();
            iLV_Summary.Items[2].SubItems[2].Text = NumberFormattingUtils.NumberAsPercentageTwoDP(symbolicMatchMemorySize, symbolicMatchMemorySize + otherMemorySize + freeSpaceSize) + " %";
            iLV_Summary.Items[3].SubItems[1].Text = otherMemorySize.ToString();
            iLV_Summary.Items[3].SubItems[2].Text = NumberFormattingUtils.NumberAsPercentageTwoDP(otherMemorySize, symbolicMatchMemorySize + otherMemorySize + freeSpaceSize) + " %";
            // (4) is a spacer
            iLV_Summary.Items[5].SubItems[1].Text = (symbolicMatchMemorySize + otherMemorySize).ToString();
            iLV_Summary.Items[5].SubItems[2].Text = NumberFormattingUtils.NumberAsPercentageTwoDP(symbolicMatchMemorySize + otherMemorySize, symbolicMatchMemorySize + otherMemorySize + freeSpaceSize) + " %";
            iLV_Summary.Items[6].SubItems[1].Text = freeSpaceSize.ToString();
            iLV_Summary.Items[6].SubItems[2].Text = NumberFormattingUtils.NumberAsPercentageTwoDP(freeSpaceSize, symbolicMatchMemorySize + otherMemorySize + freeSpaceSize) + " %";
            // (7) is a spacer
            iLV_Summary.Items[8].SubItems[1].Text = heapCellHeaderOverheadSize.ToString();
            iLV_Summary.Items[8].SubItems[2].Text = NumberFormattingUtils.NumberAsPercentageTwoDP(heapCellHeaderOverheadSize, symbolicMatchMemorySize + otherMemorySize + freeSpaceSize) + " %";

            // 3RD GROUP
            iLV_Summary.Items[10].SubItems[1].Text = (heapCellHeaderOverheadSize + symbolicMatchMemorySize + otherMemorySize).ToString();
            iLV_Summary.Items[10].SubItems[2].Text = "100.00 %";
        }
示例#3
0
        private void UpdateTable()
        {
            iTable.BeginUpdate();
            iTableModel.Rows.Clear();
            //
            long total = iDistribution.Total;

            foreach (DictionaryEntry entry in iDistribution)
            {
                uint   size                       = (uint)(entry.Key);
                uint   instanceCount              = (uint)entry.Value;
                uint   totalForSize               = size * instanceCount;
                double percentageDistribution     = ((double)(totalForSize) / ((double)total)) * 100.0;
                double percentageHeap             = ((double)(totalForSize) / ((double)TotalHeapSize)) * 100.0;
                string percentageTextDistribution = NumberFormattingUtils.NumberAsPercentageTwoDP(totalForSize, total) + " %";
                string percentageTextHeap         = NumberFormattingUtils.NumberAsPercentageTwoDP(totalForSize, TotalHeapSize) + " %";
                //
                XPTable.Models.Row row = new XPTable.Models.Row();
                //
                XPTable.Models.Cell cellSize = new XPTable.Models.Cell(size.ToString() + " bytes");
                cellSize.Tag = size;
                XPTable.Models.Cell cellInstanceCount = new XPTable.Models.Cell(instanceCount.ToString());
                cellInstanceCount.Data = instanceCount;
                XPTable.Models.Cell cellTotalForSize = new XPTable.Models.Cell(totalForSize.ToString());
                cellTotalForSize.Data = totalForSize;
                XPTable.Models.Cell cellPercentage = new XPTable.Models.Cell(percentageTextDistribution);
                cellPercentage.Tag = percentageDistribution;
                XPTable.Models.Cell cellPercentageOfHeap = new XPTable.Models.Cell(percentageTextHeap);
                cellPercentageOfHeap.Tag = percentageHeap;
                //
                row.Cells.Add(cellSize);
                row.Cells.Add(cellInstanceCount);
                row.Cells.Add(cellTotalForSize);
                row.Cells.Add(cellPercentage);
                row.Cells.Add(cellPercentageOfHeap);
                //
                iTableModel.Rows.Add(row);
            }
            //
            iTable.EndUpdate();
        }
        private void OnStateBody()
        {
            HeapCell entry = iEntries[iCurrentHeapCellIndex++];
            string   link;
            string   body = string.Empty;

            string style = TableRowBodyStyleName;

            if (entry.Type == HeapCell.TType.EFree)
            {
                style = "tableRowFreeCell";
            }
            Writer.WriteLine("<TR class=\"" + style + "\">");

            // Address
            WriteTableColumnBegin();
            WriteDivisionBeginWithId(HeapCellLinkIdentifierName(entry));
            string cellAddress = "0x" + entry.Address.ToString("x8");

            MakeAddressLink(entry);
            WriteDivisionEnd();
            WriteTableColumnEnd();

            // Type
            string typeProperName = string.Empty;

            if (entry.Type == HeapCell.TType.EAllocated)
            {
                typeProperName = "Allocated";
                body           = CreateCellContentsQuickView(entry);
            }
            else if (entry.Type == HeapCell.TType.EFree)
            {
                typeProperName = "Free";
                body           = CreateCellContentsQuickView(entry);
            }

            link = HeapToHTMLPageJavaScriptManager.MakeToolTipDiv(typeProperName + " Cell", body, typeProperName, KHeapDataPreviewLength);
            WriteTableColumnBegin(TAlignment.EAlignCenter, string.Empty);
            WriteLine(link);
            WriteTableColumnEnd();

            // Alloc number
            if (iReconstructor.SourceData.MetaData.Heap.DebugAllocator)
            {
                link = HeapToHTMLPageJavaScriptManager.MakeToolTipDiv("Allocation Number", "Number " + entry.AllocationNumber.ToString() + " of " + iEntries.Count.ToString() + " cells.", entry.AllocationNumber.ToString());

                WriteTableColumnBegin(TAlignment.EAlignRight, string.Empty);
                WriteLine(link);
                WriteTableColumnEnd();
            }

            // Cell length
            body  = string.Empty;
            body += "Type:    " + typeProperName + "<BR>";
            body += "Header:  " + entry.HeaderSize.ToString() + " bytes<BR>";
            body += "Payload: " + entry.PayloadLength.ToString() + " bytes<BR><BR>";
            if (entry.Type == HeapCell.TType.EFree)
            {
                string instanceSizeAsPercentageOfTotal = iReconstructor.Statistics.CellLengthAsHeapPercentage(entry).ToString("##0.000");
                body += "This individual cell corresponds to " + instanceSizeAsPercentageOfTotal + " of the total free cells in this heap.";
            }
            link = HeapToHTMLPageJavaScriptManager.MakeToolTipDiv("Cell Length", body, entry.Length.ToString());
            WriteTableColumnBegin(TAlignment.EAlignRight, string.Empty);
            WriteLine(link);
            WriteTableColumnEnd();

            // Spacer
            WriteTableColumnSpace();

            // Symbol
            if (entry.Symbol != null)
            {
                // Get symbol tracking info.
                TrackingInfo trackingInfo = iReconstructor.Statistics.StatsAllocated.TrackerSymbols[entry.Symbol];
                System.Diagnostics.Debug.Assert(trackingInfo != null);
                string instanceSizeAsPercentageOfTotal      = iReconstructor.Statistics.CellLengthAsHeapPercentage(entry).ToString("##0.000") + "%";
                string totalSymbolicSizeAsPercentageOfTotal = NumberFormattingUtils.NumberAsPercentageThreeDP(trackingInfo.AssociatedMemory, iReconstructor.Statistics.SizeTotal) + "%";

                body = string.Empty;
                if (trackingInfo.Count > 1)
                {
                    body += "There are " + trackingInfo.Count.ToString() + " other instances of this symbol ";
                }
                else
                {
                    body += "This is the only instance of this symbol ";
                }
                body += "and each instance is using " + trackingInfo.PayloadLength.ToString() + " bytes of memory (plus cell header overhead).<BR><BR>";
                body += "Of the total allocated heap memory, cells associated with this symbolic are using a total of " + trackingInfo.AssociatedMemory.ToString() + " bytes (" + totalSymbolicSizeAsPercentageOfTotal + " of total heap) memory.<BR><BR>";
                body += "This individual cell corresponds to " + instanceSizeAsPercentageOfTotal + " of the total " + typeProperName + " heap space.<BR>";

                link = HeapToHTMLPageJavaScriptManager.MakeToolTipDiv("Symbol Information", body, entry.Symbol.NameWithoutVTablePrefix);
                WriteTableColumnBegin(TAlignment.EAlignLeft, string.Empty);
                WriteLine(link);
                WriteTableColumnEnd();
            }
            else
            {
                WriteTableColumnEmpty();
            }

            // Object name
            if (entry.Symbol != null)
            {
                WriteTableColumn(entry.Symbol.ObjectWithoutSection, TAlignment.EAlignLeft);
            }
            else
            {
                WriteTableColumnEmpty();
            }

            WriteTableRowEnd();
        }