Exemple #1
0
        private void DrawStats()
        {
            GUILayout.BeginHorizontal();
            GUILayout.Label("Statistics", EditorStyles.boldLabel, GUILayout.ExpandWidth(false));
            statsType = (StatsType)EditorGUILayout.EnumPopup(statsType, GUILayout.ExpandWidth(false));
            var calulateStatistics = GUILayout.Button("Calculate", GUILayout.ExpandWidth(false));

            GUILayout.EndHorizontal();

            if (calulateStatistics)
            {
                //using (Profiler.AddSample(Profiler.SamplerType.CalculateStatsTotal))
                {
                    var statsCalculator = StatsCalculatorProvider.GetStatsCalculator(statsType);
                    var stats           = statsCalculator.CalculateStats(ColumnsToShow);
                    UpdateFunctionStats(stats);
                }
            }

            if (functionStatsTableState == null)
            {
                functionStatsTableState = new FunctionTableState(ColumnsToShow, ColumnHeaders);
            }

            if (functionStats != null)
            {
                TableGUILayout.BeginTable(functionStatsTableState, GUI.skin.GetStyle("OL Box"), GUILayout.MinHeight(100f), GUILayout.MaxHeight(500f));
                for (var i = 0; i < functionStats.Count; ++i)
                {
                    var functionData = functionStats[i];
                    TableGUILayout.AddRow(functionStatsTableState, i, functionData);
                }
                TableGUILayout.EndTable();
            }
        }
        private void DrawStats()
        {
            GUILayout.BeginHorizontal();
            GUILayout.Label("Statistics", EditorStyles.boldLabel, GUILayout.ExpandWidth(false));
            statsType = (StatsType)EditorGUILayout.EnumPopup(statsType, GUILayout.ExpandWidth(false));
            var calulateStatistics = GUILayout.Button("Calculate", GUILayout.ExpandWidth(false));

            GUILayout.EndHorizontal();

            if (calulateStatistics)
            {
                var statsCalculator = StatsCalculatorProvider.GetStatsCalculator(statsType);
                var stats           = statsCalculator.CalculateStats(ColumnsToShow);
                functionStats = stats.Select <FunctionData, string[]>(f => ColumnsToShow.Select <ProfilerColumn, string>(f.GetValue).ToArray()).ToArray();
            }

            if (functionStatsTableState == null)
            {
                functionStatsTableState = new FunctionTableState(ColumnsToShow, ColumnHeaders);
            }

            if (functionStats != null)
            {
                TableGUILayout.BeginTable(functionStatsTableState, GUI.skin.GetStyle("OL Box"), GUILayout.MinHeight(100f), GUILayout.MaxHeight(500f));
                for (var i = 0; i < functionStats.Length; ++i)
                {
                    var functionData = functionStats[i];
                    TableGUILayout.AddRow(functionStatsTableState, i, functionData);
                }
                TableGUILayout.EndTable();
            }
        }