protected override TreeViewItem BuildRoot()
        {
            int idForHiddenRoot      = -1;
            int depthForHiddenRoot   = -1;
            ProfileTreeViewItem root = new ProfileTreeViewItem(idForHiddenRoot, depthForHiddenRoot, "root", null);

            int depth = 0;

            var top = new ThreadTreeViewItem(-1, depth, m_AllThreadIdentifier.name, m_AllThreadIdentifier);

            root.AddChild(top);

            var expandList = new List <int>()
            {
                -1
            };
            string       lastThreadName = "";
            TreeViewItem node           = root;

            for (int index = 0; index < m_ThreadNames.Count; ++index)
            {
                var threadNameWithIndex = m_ThreadNames[index];
                if (threadNameWithIndex == m_AllThreadIdentifier.threadNameWithIndex)
                {
                    continue;
                }

                var threadIdentifier = new ThreadIdentifier(threadNameWithIndex);
                var item             = new ThreadTreeViewItem(index, depth, m_ThreadUINames[index], threadIdentifier);

                if (threadIdentifier.name != lastThreadName)
                {
                    // New threads at root
                    node  = top;
                    depth = 0;
                }

                node.AddChild(item);


                if (threadIdentifier.name != lastThreadName)
                {
                    // Extra instances hang of the parent
                    lastThreadName = threadIdentifier.name;
                    node           = item;
                    depth          = 1;
                }
            }

            SetExpanded(expandList);

            SetupDepthsFromParentsAndChildren(root);

            return(root);
        }
예제 #2
0
        protected override TreeViewItem BuildRoot()
        {
            int idForhiddenRoot      = -1;
            int depthForHiddenRoot   = -1;
            ProfileTreeViewItem root = new ProfileTreeViewItem(idForhiddenRoot, depthForHiddenRoot, "root", null);

            List <string> nameFilters  = m_ProfileAnalyzerWindow.GetNameFilters();
            List <string> nameExcludes = m_ProfileAnalyzerWindow.GetNameExcludes();

            m_MaxMedian    = 0.0f;
            m_MaxTotal     = 0.0;
            m_MaxCount     = 0;
            m_MaxCountMean = 0.0f;
            var markers = m_Model.GetMarkers();

            for (int index = 0; index < markers.Count; ++index)
            {
                var marker = markers[index];
                if (nameFilters.Count > 0)
                {
                    if (!m_ProfileAnalyzerWindow.NameInFilterList(marker.name, nameFilters))
                    {
                        continue;
                    }
                }
                if (nameExcludes.Count > 0)
                {
                    if (m_ProfileAnalyzerWindow.NameInExcludeList(marker.name, nameExcludes))
                    {
                        continue;
                    }
                }

                var item = new ProfileTreeViewItem(index, 0, marker.name, marker);
                root.AddChild(item);
                float ms = item.data.msMedian;
                if (ms > m_MaxMedian)
                {
                    m_MaxMedian = ms;
                }

                double msTotal = item.data.msTotal;
                if (msTotal > m_MaxTotal)
                {
                    m_MaxTotal = msTotal;
                }

                int count = item.data.count;
                if (count > m_MaxCount)
                {
                    m_MaxCount = count;
                }

                float countMean = item.data.countMean;
                if (countMean > m_MaxCountMean)
                {
                    m_MaxCountMean = countMean;
                }
            }

            return(root);
        }
예제 #3
0
        protected override TreeViewItem BuildRoot()
        {
            int idForhiddenRoot      = -1;
            int depthForHiddenRoot   = -1;
            ProfileTreeViewItem root = new ProfileTreeViewItem(idForhiddenRoot, depthForHiddenRoot, "root", null);

            List <string> nameFilters  = m_ProfileAnalyzerWindow.GetNameFilters();
            List <string> nameExcludes = m_ProfileAnalyzerWindow.GetNameExcludes();

            float  minDiff          = float.MaxValue;
            float  maxDiff          = 0.0f;
            double totalMinDiff     = float.MaxValue;
            double totalMaxDiff     = 0.0f;
            float  countMinDiff     = float.MaxValue;
            float  countMaxDiff     = 0.0f;
            float  countMeanMinDiff = float.MaxValue;
            float  countMeanMaxDiff = 0.0f;

            for (int index = 0; index < m_Pairings.Count; ++index)
            {
                var pairing = m_Pairings[index];
                if (nameFilters.Count > 0)
                {
                    if (!m_ProfileAnalyzerWindow.NameInFilterList(pairing.name, nameFilters))
                    {
                        continue;
                    }
                }
                if (nameExcludes.Count > 0)
                {
                    if (m_ProfileAnalyzerWindow.NameInExcludeList(pairing.name, nameExcludes))
                    {
                        continue;
                    }
                }

                var item = new ComparisonTreeViewItem(index, 0, pairing.name, pairing);
                root.AddChild(item);

                float diff = Diff(item);
                if (diff < minDiff)
                {
                    minDiff = diff;
                }
                if (diff > maxDiff && diff < float.MaxValue)
                {
                    maxDiff = diff;
                }

                double totalDiff = TotalDiff(item);
                if (totalDiff < totalMinDiff)
                {
                    totalMinDiff = totalDiff;
                }
                if (totalDiff > totalMaxDiff && totalDiff < float.MaxValue)
                {
                    totalMaxDiff = totalDiff;
                }

                float countDiff = CountDiff(item);
                if (countDiff < countMinDiff)
                {
                    countMinDiff = countDiff;
                }
                if (countDiff > countMaxDiff && countDiff < float.MaxValue)
                {
                    countMaxDiff = countDiff;
                }

                float countMeanDiff = CountMeanDiff(item);
                if (countMeanDiff < countMeanMinDiff)
                {
                    countMeanMinDiff = countMeanDiff;
                }
                if (countMeanDiff > countMeanMaxDiff && countMeanDiff < float.MaxValue)
                {
                    countMeanMaxDiff = countMeanDiff;
                }
            }

            m_DiffRange          = Math.Max(Math.Abs(minDiff), Math.Abs(maxDiff));
            m_TotalDiffRange     = Math.Max(Math.Abs(totalMinDiff), Math.Abs(totalMaxDiff));
            m_CountDiffRange     = Math.Max(Math.Abs(countMinDiff), Math.Abs(countMaxDiff));
            m_CountMeanDiffRange = Math.Max(Math.Abs(countMeanMinDiff), Math.Abs(countMeanMaxDiff));

            return(root);
        }