static HookSetup()
 {
     if (LuaDeepProfilerSetting.Instance.isDeepProfiler)
     {
         LuaDeepProfiler.Start(true);
     }
     //HookLuaFuns();
     EditorApplication.playModeStateChanged += OnEditorPlaying;
 }
        void DoToolbar()
        {
            GUILayout.BeginHorizontal(EditorStyles.toolbar);

            #region clear
            bool isClear = GUILayout.Button("Clear", EditorStyles.toolbarButton, GUILayout.Height(30));
            if (isClear)
            {
                m_TreeView.Clear();
            }
            GUILayout.Space(5);
            #endregion

            #region deep
            bool flag = GUILayout.Toggle(LuaDeepProfilerSetting.Instance.isDeepProfiler, "Deep Profiler", EditorStyles.toolbarButton, GUILayout.Height(30));
            if (flag != LuaDeepProfilerSetting.Instance.isDeepProfiler)
            {
                if (flag)
                {
                    LuaDeepProfiler.Start();
                }
                LuaDeepProfilerSetting.Instance.isDeepProfiler = flag;
                EditorUtility.SetDirty(LuaDeepProfilerSetting.Instance);
                AssetDatabase.SaveAssets();
                AssetDatabase.Refresh();
            }
            GUILayout.Space(5);
            #endregion

            #region stop
            bool isStop = GUILayout.Toggle(m_isStop, "Stop GC", EditorStyles.toolbarButton, GUILayout.Height(30));

            if (m_isStop != isStop)
            {
                if (isStop)
                {
                    var env = LuaProfiler.mainEnv;
                    if (env != null)
                    {
                        env.StopGc();
                    }
                    m_isStop = true;
                }
                else
                {
                    var env = LuaProfiler.mainEnv;
                    if (env != null)
                    {
                        env.RestartGc();
                    }
                    m_isStop = false;
                }
            }
            GUILayout.Space(5);
            #endregion

            #region stable
            bool isStable = GUILayout.Toggle(m_isStable, "Stable GC", EditorStyles.toolbarButton, GUILayout.Height(30));
            if (isStable != m_isStable)
            {
                LuaProfiler.ToggleStableGC();
                m_isStable = isStable;
            }
            GUILayout.Space(5);
            #endregion

            #region run gc
            bool isRunGC = GUILayout.Button("Full GC", EditorStyles.toolbarButton, GUILayout.Height(30));
            if (isRunGC)
            {
                var env = LuaProfiler.mainEnv;
                if (env != null)
                {
                    env.FullGc();
                }
            }
            GUILayout.Space(20);
            GUILayout.FlexibleSpace();
            #endregion

            #region gc value
            GUILayout.Label(string.Format("Lua Total:{0}", LuaProfiler.GetLuaMemory()), EditorStyles.toolbarButton, GUILayout.Height(30));
            #endregion

            GUILayout.Space(100);
            GUILayout.FlexibleSpace();
            m_TreeView.searchString = m_SearchField.OnToolbarGUI(m_TreeView.searchString);
            GUILayout.EndHorizontal();
        }