示例#1
0
        private void showAllocatorsMenuItem_Click(object sender, System.EventArgs e)
        {
            TypeDesc selectedType = FindSelectedType();

            // Create a new allocation graph and add all the objects in the selected address range
            // whose type matches the selected type (if any).

            ReadNewLog log       = liveObjectTable.readNewLog;
            var        histogram = new Histogram(log);
            ulong      low       = selectedLowAddr;
            ulong      high      = low == 0 ? ulong.MaxValue : selectedHighAddr;

            LiveObjectTable.LiveObject o;
            for (liveObjectTable.GetNextObject(low, high, out o); o.id < high; liveObjectTable.GetNextObject(o.id + o.size, high, out o))
            {
                if (selectedType == null || selectedType.typeIndex == o.typeIndex)
                {
                    histogram.AddObject(o.typeSizeStacktraceIndex, 1);
                }
            }

            // Build the real graph from the histogram

            Graph graph = histogram.BuildAllocationGraph(new FilterForm());

            // And make another graph form for it - hardest part is to compute an appropriate title...

            string title         = "Allocation Graph for live " + ComputeObjectsDescription(selectedType, selectedLowAddr, selectedHighAddr);
            var    graphViewForm = new GraphViewForm(graph, title);

            graphViewForm.Visible = true;
        }
示例#2
0
        private void showWhoAllocatedMenuItem_Click(object sender, System.EventArgs e)
        {
            TypeDesc selectedType = FindSelectedType();
            double   minAge       = 0;
            double   maxAge       = double.PositiveInfinity;

            Debug.Assert(bucketTable != null, "bucketTable != null");
            foreach (Bucket b in bucketTable)
            {
                if (b.selected)
                {
                    minAge = b.minAge;
                    maxAge = b.maxAge;
                }
            }
            string title = "Allocation Graph for objects";

            if (selectedType != null)
            {
                title = string.Format("Allocation Graph for {0} objects", selectedType.typeName);
            }

            if (minAge > 0.0)
            {
                title += string.Format(" of age between {0} and {1} seconds", FormatTime(minAge), FormatTime(maxAge));
            }

            Debug.Assert(liveObjectTable != null, "liveObjectTable != null");
            var selectedHistogram = new Histogram(liveObjectTable.readNewLog);

            LiveObjectTable.LiveObject o;
            double nowTime = liveObjectTable.readNewLog.TickIndexToTime(liveObjectTable.lastTickIndex);

            Debug.Assert(typeIndexToTypeDesc != null, "typeIndexToTypeDesc != null");
            for (liveObjectTable.GetNextObject(0, ulong.MaxValue, out o); o.id < ulong.MaxValue; liveObjectTable.GetNextObject(o.id + o.size, uint.MaxValue, out o))
            {
                double age = nowTime - liveObjectTable.readNewLog.TickIndexToTime(o.allocTickIndex);
                if (minAge <= age && age < maxAge)
                {
                    var t = (TypeDesc)typeIndexToTypeDesc[o.typeIndex];

                    if (selectedType == null || t == selectedType)
                    {
                        selectedHistogram.AddObject(o.typeSizeStacktraceIndex, 1);
                    }
                }
            }

            Graph graph = selectedHistogram.BuildAllocationGraph(new FilterForm());

            var graphViewForm = new GraphViewForm(graph, title);

            graphViewForm.Visible = true;
        }
        private void showAllocatorsMenuItem_Click(object sender, System.EventArgs e)
        {
            TypeDesc selectedType = FindSelectedType();

            // Create a new allocation graph and add all the objects in the selected address range
            // whose type matches the selected type (if any).

            ReadNewLog log = liveObjectTable.readNewLog;
            Histogram histogram = new Histogram(log);
            ulong low = selectedLowAddr;
            ulong high = low == 0 ? ulong.MaxValue : selectedHighAddr;
            LiveObjectTable.LiveObject o;
            for (liveObjectTable.GetNextObject(low, high, out o); o.id < high; liveObjectTable.GetNextObject(o.id + o.size, high, out o))
            {
                if (selectedType == null || selectedType.typeIndex == o.typeIndex)
                    histogram.AddObject(o.typeSizeStacktraceIndex, 1);
            }

            // Build the real graph from the histogram

            Graph graph = histogram.BuildAllocationGraph(new FilterForm());

            // And make another graph form for it - hardest part is to compute an appropriate title...

            string title = "Allocation Graph for live " + ComputeObjectsDescription(selectedType, selectedLowAddr, selectedHighAddr);
            GraphViewForm graphViewForm = new GraphViewForm(graph, title);
            graphViewForm.Visible = true;
        }
示例#4
0
        private void showWhoAllocatedMenuItem_Click(object sender, System.EventArgs e)
        {
            Histogram selectedHistogram;
            string title;
            TypeDesc selectedType = FindSelectedType();
            double minAge = 0;
            double maxAge = double.PositiveInfinity;
            foreach (Bucket b in bucketTable)
            {
                if (b.selected)
                {
                    minAge = b.minAge;
                    maxAge = b.maxAge;
                }
            }
            title = "Allocation Graph for objects";
            if (selectedType != null)
                title = string.Format("Allocation Graph for {0} objects", selectedType.typeName);
            if (minAge > 0.0)
                title += string.Format(" of age between {0} and {1} seconds", FormatTime(minAge), FormatTime(maxAge));
            selectedHistogram = new Histogram(liveObjectTable.readNewLog);
            LiveObjectTable.LiveObject o;
            double nowTime = liveObjectTable.readNewLog.TickIndexToTime(liveObjectTable.lastTickIndex);
            for (liveObjectTable.GetNextObject(0, ulong.MaxValue, out o); o.id < ulong.MaxValue; liveObjectTable.GetNextObject(o.id + o.size, uint.MaxValue, out o))
            {
                double age = nowTime - liveObjectTable.readNewLog.TickIndexToTime(o.allocTickIndex);
                if (minAge <= age && age < maxAge)
                {
                    TypeDesc t = (TypeDesc)typeIndexToTypeDesc[o.typeIndex];
                
                    if (selectedType == null || t == selectedType)
                    {
                        selectedHistogram.AddObject(o.typeSizeStacktraceIndex, 1);
                    }
                }
            }

            Graph graph = selectedHistogram.BuildAllocationGraph(new FilterForm());

            GraphViewForm graphViewForm = new GraphViewForm(graph, title);
            graphViewForm.Visible = true;
        }