void DoRecord() { var instance = LuaDeepProfilerSetting.Instance; if (!instance.isRecord) { return; } EditorGUILayout.BeginHorizontal(EditorStyles.toolbar); bool state = instance.isStartRecord; instance.isStartRecord = GUILayout.Toggle(instance.isStartRecord, "StartRecord", EditorStyles.toolbarButton, GUILayout.Height(30)); if (!state && instance.isStartRecord) { m_TreeView.Clear(true); m_luaRefScrollView.ClearRefInfo(true); NetWorkServer.SendCmd(0); } if (state && !instance.isStartRecord) { m_TreeView.LoadHistoryCurve(); } int count = m_TreeView.history.Count - 1; int delta = Mathf.Max(0, count - m_lastCount); if (delta != 0) { endFrame = count; } int oldStartFrame = startFrame; GUILayout.Label("start", EditorStyles.toolbarButton, GUILayout.Height(30), GUILayout.Width(45)); startFrame = EditorGUILayout.IntSlider(startFrame, 0, count, GUILayout.Width(150)); if (GUILayout.Button("<< ", EditorStyles.toolbarButton, GUILayout.Height(30), GUILayout.Width(30))) { startFrame = m_TreeView.GetPreProgramFrame(startFrame); endFrame = startFrame; } if (GUILayout.Button("< ", EditorStyles.toolbarButton, GUILayout.Height(30), GUILayout.Width(30))) { startFrame = Mathf.Max(startFrame - 1, 0); } if (GUILayout.Button(" >", EditorStyles.toolbarButton, GUILayout.Height(30), GUILayout.Width(30))) { startFrame = Mathf.Min(startFrame + 1, count); } if (GUILayout.Button(" >>", EditorStyles.toolbarButton, GUILayout.Height(30), GUILayout.Width(30))) { startFrame = m_TreeView.GetNextProgramFrame(startFrame); endFrame = startFrame; } int oldEndFrame = endFrame; GUILayout.Space(15); GUILayout.Label("end", EditorStyles.toolbarButton, GUILayout.Height(30), GUILayout.Width(45)); endFrame = EditorGUILayout.IntSlider(endFrame, 0, count, GUILayout.Width(150)); if (GUILayout.Button("<< ", EditorStyles.toolbarButton, GUILayout.Height(30), GUILayout.Width(30))) { endFrame = m_TreeView.GetPreProgramFrame(endFrame); startFrame = endFrame; } if (GUILayout.Button("< ", EditorStyles.toolbarButton, GUILayout.Height(30), GUILayout.Width(30))) { endFrame = Mathf.Max(endFrame - 1, 0); } if (GUILayout.Button(" >", EditorStyles.toolbarButton, GUILayout.Height(30), GUILayout.Width(30))) { endFrame = Mathf.Min(endFrame + 1, count); } if (GUILayout.Button(" >>", EditorStyles.toolbarButton, GUILayout.Height(30), GUILayout.Width(30))) { endFrame = m_TreeView.GetNextProgramFrame(endFrame); startFrame = endFrame; } GUILayout.Space(25); GUILayout.Label("capture lua gc", EditorStyles.toolbarButton, GUILayout.Height(30), GUILayout.Width(80)); LuaDeepProfilerSetting.Instance.captureLuaGC = EditorGUILayout.IntField(LuaDeepProfilerSetting.Instance.captureLuaGC, GUILayout.Height(16), GUILayout.Width(50)); LuaDeepProfilerSetting.Instance.captureLuaGC = Mathf.Max(0, LuaDeepProfilerSetting.Instance.captureLuaGC); GUILayout.Label("capture mono gc", EditorStyles.toolbarButton, GUILayout.Height(30), GUILayout.Width(100)); LuaDeepProfilerSetting.Instance.captureMonoGC = EditorGUILayout.IntField(LuaDeepProfilerSetting.Instance.captureMonoGC, GUILayout.Height(16), GUILayout.Width(50)); LuaDeepProfilerSetting.Instance.captureMonoGC = Mathf.Max(0, LuaDeepProfilerSetting.Instance.captureMonoGC); GUILayout.Label("capture frame rate", EditorStyles.toolbarButton, GUILayout.Height(30), GUILayout.Width(100)); LuaDeepProfilerSetting.Instance.captureFrameRate = EditorGUILayout.IntField(LuaDeepProfilerSetting.Instance.captureFrameRate, GUILayout.Height(16), GUILayout.Width(40)); LuaDeepProfilerSetting.Instance.captureFrameRate = Mathf.Max(0, LuaDeepProfilerSetting.Instance.captureFrameRate); m_lastCount = count; GUILayout.Space(25); GUILayout.FlexibleSpace(); if (oldStartFrame != startFrame || oldEndFrame != endFrame) { m_TreeView.ReLoadSamples(startFrame, endFrame); int startGameFrame = m_TreeView.GetFrameCount(startFrame); int endGameFrame = m_TreeView.GetFrameCount(endFrame); m_luaRefScrollView.LoadHistory(startGameFrame, endGameFrame); if (EditorApplication.isPlaying) { EditorApplication.isPaused = true; } } bool isSave = GUILayout.Button("Save", EditorStyles.toolbarButton, GUILayout.Height(30), GUILayout.Width(50)); if (isSave) { m_TreeView.SaveHisotry(); } bool isLoad = GUILayout.Button("Load", EditorStyles.toolbarButton, GUILayout.Height(30), GUILayout.Width(50)); if (isLoad) { m_TreeView.LoadHistory(); } GUILayout.Space(10); EditorGUILayout.EndHorizontal(); }