Exemplo n.º 1
0
        void OnGUI()
        {
            using (var scroll = new GUILayout.ScrollViewScope(mScrollPosition))
            {
                mScrollPosition = scroll.scrollPosition;

                using (new ScopeProfiler("ScopeProfilerWindow " + (int)Time.realtimeSinceStartup))
                {
                    if (GUILayoutUtils.SizeButton(new GUIContent("Clear Data")))
                    {
                        ScopeProfilerManager.Clear();
                    }

                    mRows.Clear();

                    foreach (var pair in ScopeProfilerManager.GetResult())
                    {
                        var row = new List <GUIContent>
                        {
                            new GUIContent(pair.Key),
                            new GUIContent(pair.Value.CallCount.ToString()),
                            new GUIContent(pair.Value.Elapsed.ToString("N2")),
                            new GUIContent(pair.Value.Average.ToString("N2") + "/s")
                        };

                        mRows.Add(row);
                    }

                    mSelectedGridIndex = GUILayoutUtils.Grid(mSelectedGridIndex, mColumns, mRows);
                }
            }
        }
Exemplo n.º 2
0
 protected override void CloseScope()
 {
     ScopeProfilerManager.Add(mName, Time.realtimeSinceStartup - mStartTime);
 }