public float GetTopMarkerTimeRange(ProfileAnalysis analysis, int count, int depthFilter)
        {
            if (analysis == null)
            {
                return(0.0f);
            }

            var frameSummary = analysis.GetFrameSummary();

            if (frameSummary == null)
            {
                return(0.0f);
            }

            var markers = analysis.GetMarkers();

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

            float range = 0;

            foreach (var marker in markers)
            {
                if (depthFilter >= 0 && marker.minDepth != depthFilter)
                {
                    continue;
                }

                if (nameFilters.Count > 0)
                {
                    if (!m_ProfileAnalyzerWindow.NameInFilterList(marker.name, nameFilters))
                    {
                        continue;
                    }
                }
                if (nameExcludes.Count > 0)
                {
                    if (m_ProfileAnalyzerWindow.NameInExcludeList(marker.name, nameExcludes))
                    {
                        continue;
                    }
                }

                range += marker.msAtMedian;
            }

            // Minimum is the frame time range
            // As we can have unaccounted markers
            if (range < frameSummary.msMedian)
            {
                range = frameSummary.msMedian;
            }

            return(range);
        }
Example #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);
        }
        float CalculateTopMarkerTimeRange(RangeSettings rangeSettings)
        {
            if (rangeSettings == null)
            {
                return(0.0f);
            }
            if (rangeSettings.dataView == null)
            {
                return(0.0f);
            }

            ProfileAnalysis analysis = rangeSettings.dataView.analysis;

            if (analysis == null)
            {
                return(0.0f);
            }

            var frameSummary = analysis.GetFrameSummary();

            if (frameSummary == null)
            {
                return(0.0f);
            }

            int           depthFilter  = rangeSettings.depthFilter;
            List <string> nameFilters  = rangeSettings.nameFilters;
            List <string> nameExcludes = rangeSettings.nameExcludes;

            var markers = analysis.GetMarkers();

            float range = 0;

            foreach (var marker in markers)
            {
                if (depthFilter != ProfileAnalyzer.kDepthAll && marker.minDepth != depthFilter)
                {
                    continue;
                }

                if (nameFilters.Count > 0)
                {
                    if (!m_ProfileAnalyzerWindow.NameInFilterList(marker.name, nameFilters))
                    {
                        continue;
                    }
                }
                if (nameExcludes.Count > 0)
                {
                    if (m_ProfileAnalyzerWindow.NameInExcludeList(marker.name, nameExcludes))
                    {
                        continue;
                    }
                }

                range += marker.msAtMedian;
            }

            // Minimum is the frame time range
            // As we can have unaccounted markers
            if (range < frameSummary.msMedian)
            {
                range = frameSummary.msMedian;
            }

            return(range);
        }
Example #4
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);
        }