void DrawTaskList(TasksProfilerBehaviour taskProfilerBehaviour, TaskInfo[] tasks) { ProfilerEditorLayout.BeginVerticalBox(); { ProfilerEditorLayout.BeginHorizontal(); { if (GUILayout.Button("Remove Finished Tasks", GUILayout.Width(180), GUILayout.Height(14))) { taskProfilerBehaviour.ResetDurations(); } } ProfilerEditorLayout.EndHorizontal(); _sortingOption = (SORTING_OPTIONS)EditorGUILayout.EnumPopup("Sort By:", _sortingOption); EditorGUILayout.Space(); ProfilerEditorLayout.BeginHorizontal(); { _systemNameSearchTerm = EditorGUILayout.TextField("Search", _systemNameSearchTerm); const string clearButtonControlName = "Clear Button"; GUI.SetNextControlName(clearButtonControlName); if (GUILayout.Button("x", GUILayout.Width(19), GUILayout.Height(14))) { _systemNameSearchTerm = string.Empty; GUI.FocusControl(clearButtonControlName); } } ProfilerEditorLayout.EndHorizontal(); _showTickTasks = EditorGUILayout.Foldout(_showTickTasks, "Tasks Ticks"); // if (_showTickTasks && ShouldShowSystems(tasks)) { ProfilerEditorLayout.BeginVerticalBox(); { var systemsDrawn = DrawUpdateTaskInfos(tasks); if (systemsDrawn == 0) { EditorGUILayout.LabelField(string.Empty); } } ProfilerEditorLayout.EndVertical(); } } ProfilerEditorLayout.EndVertical(); }
void DrawTasksMonitor(TaskInfo[] tasks) { if (_tasksMonitor == null) { _tasksMonitor = new TasksMonitor(SYSTEM_MONITOR_DATA_LENGTH); _taskMonitorData = new Queue <float>(new float[SYSTEM_MONITOR_DATA_LENGTH]); if (EditorApplication.update != Repaint) { EditorApplication.update += Repaint; } } double totalDuration = 0; for (int i = 0; i < tasks.Length; i++) { totalDuration += tasks[i].lastUpdateDuration; } ProfilerEditorLayout.BeginVerticalBox(); { EditorGUILayout.LabelField("Execution duration", EditorStyles.boldLabel); ProfilerEditorLayout.BeginHorizontal(); { EditorGUILayout.LabelField("Total", totalDuration.ToString()); } ProfilerEditorLayout.EndHorizontal(); ProfilerEditorLayout.BeginHorizontal(); { _axisUpperBounds = EditorGUILayout.FloatField("Axis Upper Bounds", _axisUpperBounds); } ProfilerEditorLayout.EndHorizontal(); if (!EditorApplication.isPaused) { if (_taskMonitorData.Count >= SYSTEM_MONITOR_DATA_LENGTH) { _taskMonitorData.Dequeue(); } _taskMonitorData.Enqueue((float)totalDuration); } _tasksMonitor.Draw(_taskMonitorData.ToArray(), 80f, _axisUpperBounds); } ProfilerEditorLayout.EndVertical(); }