コード例 #1
0
ファイル: HeapDiagram.cs プロジェクト: raffaeler/perfview-1
        public void RenderDiagram(int width, int height, DiagramData data)
        {
            m_data = data;

            Renderer render = new Renderer();

            render.Open(width, height, m_data.drawAllocTicks);

            m_t0 = m_data.startTime;
            m_t1 = m_data.endTime;

            render.SetTimeScale(m_t0, m_t1, out data.x0, out data.x1, data.drawGCEvents);

            if (data.drawGCEvents)
            {
                SetYScale(render);

                // GC events as vertical bars + heap size curves
                DrawGCEvents(render);
            }

            if (m_data.drawAllocTicks)
            {
                DrawAllocation(render);
            }

            if (m_data.drawThreadCount != 0)
            {
                DrawThreads(render);
            }

            data.visual = render.CloseDiagram(data.drawGCEvents);
        }
コード例 #2
0
        public DiagramData RenderDiagram(
            int width, int height,
            double start, double end,
            bool gcEvents,
            int threadCount,
            bool drawMarker,
            bool alloctick)
        {
            DiagramData data = new DiagramData();

            data.dataFile   = m_traceLog;
            data.events     = m_runtime.GC.GCs;
            data.procID     = m_process.ProcessID;
            data.threads    = m_threadInfo;
            data.allocsites = m_allocSites;
            data.vmCurve    = m_VMCurve;
            data.vmMaxVM    = m_MaxVMSize / OneMBD;
            data.wwaHost    = m_stackDecoder.WwaHost;

            data.startTime       = start;
            data.endTime         = end;
            data.drawGCEvents    = gcEvents;
            data.drawThreadCount = threadCount;
            data.drawMarker      = drawMarker;
            data.drawAllocTicks  = alloctick;

            RenderDiagram(width, height, data);

            return(data);
        }
コード例 #3
0
        public void SaveDiagram(string fileName, bool xps)
        {
            fileName = Path.ChangeExtension(fileName, null).Replace(" ", "") + "_" + m_process.ProcessID;

            if (xps)
            {
                fileName = Toolbox.GetSaveFileName(fileName, ".xps", "XPS");
            }
            else
            {
                fileName = Toolbox.GetSaveFileName(fileName, ".png", "PNG");
            }

            if (fileName != null)
            {
                int width  = 1280;
                int height = 720;

                DiagramData data = RenderDiagram(width, height, FirstEventTime, LastEventTime, true, 100, true, true);

                if (xps)
                {
                    Toolbox.SaveAsXps(data.visual, width, height, fileName);
                }
                else
                {
                    Toolbox.SaveAsPng(data.visual, width, height, fileName);
                }
            }
        }
コード例 #4
0
        public DiagramData RenderLegend(int width, int height, int threads)
        {
            DiagramData data = new DiagramData();

            data.dataFile        = m_traceLog;
            data.events          = m_runtime.GC.GCs;
            data.procID          = m_process.ProcessID;
            data.threads         = m_threadInfo;
            data.allocsites      = m_allocSites;
            data.drawLegend      = true;
            data.drawThreadCount = threads;

            RenderDiagram(width, height, data);

            return(data);
        }
コード例 #5
0
ファイル: HeapDiagram.cs プロジェクト: raffaeler/perfview-1
        private void RedrawDiagram()
        {
            int zoomWidth = (int)(m_graphWidth * m_widthZoom);

            Stopwatch watch = new Stopwatch();

            watch.Start();

            int threadCount = 0;

            if (m_timeline.IsChecked == true)
            {
                threadCount = 30;
            }

            DiagramData data = m_heapInfo.RenderDiagram(zoomWidth, m_graphHeight, m_diagramT0, m_diagramT1,
                                                        true, threadCount, m_drawMarker.IsChecked == true, false);

            if (m_rubberBand != null)
            {
                m_rubberBand.Detach();
            }

            m_diagramHolder = new VisualHolder();
            m_rubberBand    = new RubberBandAdorner(m_diagramHolder, m_diagramHolder.AddMessage, CreateContextMenu);

            m_diagramHolder.SetVisual(zoomWidth, m_graphHeight, data.visual, m_widthZoom, m_zoomSlider.Value, data.x0, data.x1);

            m_scrollViewer.Content    = m_diagramHolder;
            m_scrollViewer.MouseMove += OnMouseMove;

            {
                DiagramData legend = m_heapInfo.RenderLegend(LegendWidth, m_graphHeight, threadCount);

                VisualHolder legendHolder = new VisualHolder();
                legendHolder.SetVisual(LegendWidth, m_graphHeight, legend.visual, 1, 1, legend.x0, legend.x1);
                m_leftLegend.Children.Clear();
                m_leftLegend.Children.Add(legendHolder);
            }

            watch.Stop();

            m_statusBar.Log(String.Format("RadrawDiagram({0:N3} {1:N3}, {2}x{3} {4:N3} ms", m_diagramT0, m_diagramT1, zoomWidth, m_graphHeight, watch.Elapsed.TotalMilliseconds));
        }