Exemplo n.º 1
0
        float RightCount(ComparisonTreeViewItem item)
        {
            if (item.data.rightIndex < 0)
            {
                return(0.0f);
            }

            List <MarkerData> markers = m_right.GetMarkers();

            if (item.data.rightIndex >= markers.Count)
            {
                return(0.0f);
            }

            return(markers[item.data.rightIndex].count);
        }
Exemplo n.º 2
0
        float LeftMedian(ComparisonTreeViewItem item)
        {
            if (item.data.leftIndex < 0)
            {
                return(0.0f);
            }

            List <MarkerData> markers = m_left.GetMarkers();

            if (item.data.leftIndex >= markers.Count)
            {
                return(0.0f);
            }

            return(markers[item.data.leftIndex].msMedian);
        }
Exemplo n.º 3
0
        protected override TreeViewItem BuildRoot()
        {
            int idForhiddenRoot      = -1;
            int depthForHiddenRoot   = -1;
            ProfileTreeViewItem root = new ProfileTreeViewItem(idForhiddenRoot, depthForHiddenRoot, "root", null);

            int depthFilter = m_profileAnalyserWindow.GetDepthFilter();

            int index = 0;

            m_minDiff = float.MaxValue;
            m_maxDiff = 0.0f;
            foreach (var pairing in m_pairings)
            {
                if (depthFilter >= 0)
                {
                    if (pairing.leftIndex >= 0 && m_left.GetMarkers()[pairing.leftIndex].minDepth != depthFilter)
                    {
                        index += 1; // Keep index mapping to main pairing list
                        continue;
                    }
                    if (pairing.rightIndex >= 0 && m_right.GetMarkers()[pairing.rightIndex].minDepth != depthFilter)
                    {
                        index += 1; // Keep index mapping to main pairing list
                        continue;
                    }
                }
                var item = new ComparisonTreeViewItem(index, 0, pairing.name, pairing);
                root.AddChild(item);
                float diff = Diff(item);
                if (diff < m_minDiff)
                {
                    m_minDiff = diff;
                }
                if (diff > m_maxDiff && diff < float.MaxValue)
                {
                    m_maxDiff = diff;
                }
                index += 1;
            }

            return(root);
        }
Exemplo n.º 4
0
        void CellGUI(Rect cellRect, ComparisonTreeViewItem item, MyColumns column, ref RowGUIArgs args)
        {
            // Center cell rect vertically (makes it easier to place controls, icons etc in the cells)
            CenterRectUsingSingleLineHeight(ref cellRect);

            // Find largest of min/max and use that range and both the -ve and +ve extends for the bar graphs.
            float min   = Math.Abs(m_minDiff);
            float max   = Math.Abs(m_maxDiff);
            float range = Math.Max(min, max);

            switch (column)
            {
            case MyColumns.Name:
            {
                args.rowRect = cellRect;
                base.RowGUI(args);
            }
            break;

            case MyColumns.LeftMedian:
                if (item.data.leftIndex < 0)
                {
                    EditorGUI.LabelField(cellRect, "-");
                }
                else
                {
                    EditorGUI.LabelField(cellRect, string.Format("{0:f2}", LeftMedian(item)));
                }
                break;

            case MyColumns.Left:
            {
                float diff = Diff(item);
                if (diff < 0.0f)
                {
                    if (m_profileAnalyserWindow.DrawStart(cellRect))
                    {
                        float w = cellRect.width * -diff / range;
                        m_profileAnalyserWindow.DrawBar(cellRect.width - w, 1, w, cellRect.height - 1, m_profileAnalyserWindow.m_colorLeft);
                        m_profileAnalyserWindow.DrawEnd();
                    }
                }
                GUI.Label(cellRect, new GUIContent("", string.Format("{0:f2}", Diff(item))));
            }
            break;

            case MyColumns.Diff:
                EditorGUI.LabelField(cellRect, string.Format("{0:f2}", Diff(item)));
                break;

            case MyColumns.Right:
            {
                float diff = Diff(item);
                if (diff > 0.0f)
                {
                    if (m_profileAnalyserWindow.DrawStart(cellRect))
                    {
                        float w = cellRect.width * diff / range;
                        m_profileAnalyserWindow.DrawBar(0, 1, w, cellRect.height - 1, m_profileAnalyserWindow.m_colorRight);
                        m_profileAnalyserWindow.DrawEnd();
                    }
                }
                GUI.Label(cellRect, new GUIContent("", string.Format("{0:f2}", Diff(item))));
            }
            break;

            case MyColumns.RightMedian:
                if (item.data.rightIndex < 0)
                {
                    EditorGUI.LabelField(cellRect, "-");
                }
                else
                {
                    EditorGUI.LabelField(cellRect, string.Format("{0:f2}", RightMedian(item)));
                }
                break;

            case MyColumns.AbsDiff:
                EditorGUI.LabelField(cellRect, string.Format("{0:f2}", AbsDiff(item)));
                break;

            case MyColumns.LeftCount:
                if (item.data.leftIndex < 0)
                {
                    EditorGUI.LabelField(cellRect, "-");
                }
                else
                {
                    EditorGUI.LabelField(cellRect, string.Format("{0}", LeftCount(item)));
                }
                break;

            case MyColumns.RightCount:
                if (item.data.rightIndex < 0)
                {
                    EditorGUI.LabelField(cellRect, "-");
                }
                else
                {
                    EditorGUI.LabelField(cellRect, string.Format("{0}", RightCount(item)));
                }
                break;

            case MyColumns.CountDiff:
                if (item.data.leftIndex < 0 && item.data.rightIndex < 0)
                {
                    EditorGUI.LabelField(cellRect, "-");
                }
                else
                {
                    EditorGUI.LabelField(cellRect, string.Format("{0}", CountDiff(item)));
                }
                break;
            }
        }
Exemplo n.º 5
0
 float CountDiff(ComparisonTreeViewItem item)
 {
     return(RightCount(item) - LeftCount(item));
 }
Exemplo n.º 6
0
 float AbsDiff(ComparisonTreeViewItem item)
 {
     return(Math.Abs(Diff(item)));
 }
Exemplo n.º 7
0
 float Diff(ComparisonTreeViewItem item)
 {
     return(RightMedian(item) - LeftMedian(item));
 }