public void ResetBySample(LuaProfiler.Sample sample, int depth, LuaProfilerTreeViewItem father)
        {
            if (sample != null)
            {
                totalMemory = sample.costGC;
                totalTime   = (long)(sample.costTime * 1000000);
                displayName = sample.name;
            }
            else
            {
                totalMemory = 0;
                totalTime   = 0;
                displayName = "root";
            }
            totalCallTime = 1;
            averageTime   = totalTime / totalCallTime;

            this.id    = LuaProfilerTreeView.GetUniqueId();
            this.depth = depth;


            childs.Clear();
            if (sample != null)
            {
                for (int i = 0, imax = sample.childs.Count; i < imax; i++)
                {
                    var item = Create(sample.childs[i], depth + 1, this);
                    childs.Add(item);
                }
            }
            this.father = father;

            _frameCount = Time.frameCount;
        }
Exemplo n.º 2
0
        void OnEnable()
        {
            if (m_TreeViewState == null)
            {
                m_TreeViewState = new TreeViewState();
            }

            if (m_luaRefScrollView == null)
            {
                m_luaRefScrollView = new LuaRefScrollView();
            }

            if (m_luaDiffScrollView == null)
            {
                m_luaDiffScrollView = new LuaDiffScrollView();
            }

            m_SearchField = new SearchField();

            LuaProfilerTreeView.m_nodeDict.Clear();
            startFrame = 0;
            endFrame   = 0;
            m_TreeView = new LuaProfilerTreeView(m_TreeViewState, position.width - 40);
            if (sortColIndex > 0)
            {
                m_TreeView.multiColumnHeader.SetSorting(sortColIndex, isAscending);
            }
            oldStartUrl = null;
            oldEndUrl   = null;
            Destory(oldStartT);
            Destory(oldEndT);
            disableChart = null;
            Destory(disableChart);
            luaChart = null;
            Destory(luaChart);
            monoChart = null;
            Destory(monoChart);
            fpsChart = null;
            Destory(fpsChart);
            pssChart = null;
            Destory(pssChart);
            powrChart = null;
            Destory(powrChart);
            Destory(boxTex);
            boxTex       = null;
            m_gs         = null;
            currentStyle = null;
            m_SearchField.downOrUpArrowKeyPressed += m_TreeView.SetFocusAndEnsureSelectedItem;
            OpenLocalMode();

            EditorApplication.update -= m_TreeView.DequeueSample;
            EditorApplication.update += m_TreeView.DequeueSample;
            EditorApplication.update -= m_luaRefScrollView.DequeueLuaInfo;
            EditorApplication.update += m_luaRefScrollView.DequeueLuaInfo;
        }
        void OnEnable()
        {
            if (m_TreeViewState == null)
            {
                m_TreeViewState = new TreeViewState();
            }

            m_TreeView    = new LuaProfilerTreeView(m_TreeViewState, position.width - 40);
            m_SearchField = new SearchField();
            m_SearchField.downOrUpArrowKeyPressed += m_TreeView.SetFocusAndEnsureSelectedItem;
        }
Exemplo n.º 4
0
        public void AddSample(Sample sample)
        {
            if (_frameCount == sample.frameCount)
            {
                frameCalls  += sample.calls;
                currentTime += sample.costTime;
                _showMonoGC += sample.costMonoGC;
                _showLuaGC  += sample.costLuaGC;
            }
            else
            {
                frameCalls  = sample.calls;
                currentTime = sample.costTime;
                _showMonoGC = sample.costMonoGC;
                _showLuaGC  = sample.costLuaGC;
            }

            totalLuaMemory  += sample.costLuaGC;
            totalMonoMemory += sample.costMonoGC;

            totalTime     += sample.costTime;
            totalCallTime += sample.calls;
            averageTime    = totalTime / totalCallTime;
            for (int i = 0, imax = sample.childs.Count; i < imax; i++)
            {
                LuaProfilerTreeViewItem childItem = null;
                var sampleChild = sample.childs[i];
                if (LuaProfilerTreeView.m_nodeDict.TryGetValue(sampleChild.fullName, out childItem))
                {
                    childItem.AddSample(sampleChild);
                }
                else
                {
                    if (LuaProfilerTreeView.CheckSampleValid(sample))
                    {
                        var treeItem = Create(sampleChild, depth + 1, this);
                        childs.Add(treeItem);
                    }
                }
            }
            _frameCount = Time.frameCount;
        }
Exemplo n.º 5
0
        void OnEnable()
        {
            if (m_TreeViewState == null)
            {
                m_TreeViewState = new TreeViewState();
            }

            LuaProfilerTreeView.m_nodeDict.Clear();
            startFrame = 0;
            endFrame   = 0;
            m_TreeView = new LuaProfilerTreeView(m_TreeViewState, position.width - 40);
            if (sortColIndex > 0)
            {
                m_TreeView.multiColumnHeader.SetSorting(sortColIndex, isAscending);
            }
            oldStartUrl = null;
            oldEndUrl   = null;
            Destory(oldStartT);
            Destory(oldEndT);
            m_SearchField = new SearchField();
            m_SearchField.downOrUpArrowKeyPressed += m_TreeView.SetFocusAndEnsureSelectedItem;
        }
Exemplo n.º 6
0
        public void ResetBySample(Sample sample, int depth, LuaProfilerTreeViewItem father)
        {
            if (sample != null)
            {
                filePath = sample.name.Split(splitDot, 2)[0].Trim();
                int tmpLine = 0;
                int.TryParse(Regex.Match(sample.name, @"(?<=(line:))\d*(?=(&))").Value, out tmpLine);
                line = tmpLine;

                _showMonoGC     = sample.costMonoGC;
                _showLuaGC      = sample.costLuaGC;
                totalMonoMemory = sample.costMonoGC;
                totalLuaMemory  = sample.costLuaGC;
                totalTime       = sample.costTime;
                string[] tmp = sample.name.Split(splitFun, 2);
                if (tmp.Length >= 2)
                {
                    displayName = tmp[1].Trim();
                }
                else
                {
                    displayName = sample.name;
                }
                m_originName = sample.name;

                fullName      = sample.fullName;
                frameCalls    = sample.calls;
                currentTime   = sample.costTime;
                totalCallTime = sample.calls;
            }
            else
            {
                _showMonoGC     = 0;
                _showLuaGC      = 0;
                totalMonoMemory = 0;
                totalLuaMemory  = 0;
                totalTime       = 0;
                displayName     = "root";
                fullName        = "root";
                frameCalls      = 0;
                currentTime     = 0;
                totalCallTime   = 1;
            }
            averageTime = totalTime / totalCallTime;

            this.id    = LuaProfilerTreeView.GetUniqueId();
            this.depth = depth;


            childs.Clear();
            if (sample != null)
            {
                for (int i = 0, imax = sample.childs.Count; i < imax; i++)
                {
                    var dict = LuaProfilerTreeView.m_nodeDict;

                    LuaProfilerTreeViewItem mt;
                    var childSample = sample.childs[i];
                    if (dict.TryGetValue(childSample.fullName, out mt))
                    {
                        mt.AddSample(childSample);
                    }
                    else
                    {
                        if (LuaProfilerTreeView.CheckSampleValid(sample))
                        {
                            var item = Create(sample.childs[i], depth + 1, this);
                            childs.Add(item);
                        }
                    }
                }
            }
            this.father = father;

            rootFather = this;
            while (true)
            {
                if (rootFather.father == null)
                {
                    break;
                }
                rootFather = rootFather.father;
            }

            _frameCount = Time.frameCount;
        }
        public void ResetBySample(Sample sample, int depth, LuaProfilerTreeViewItem father)
        {
            if (sample != null)
            {
                if (sample.name.Length >= 6)
                {
                    m_isLua = sample.name.Substring(0, 6) == "[lua]:";
                }

                filePath = sample.name;
                line     = 1;
                if (m_isLua)
                {
                    string[] array = sample.name.Split(splitDot, 2);
                    if (array.Length == 2)
                    {
                        filePath = array[1];
                        array    = filePath.Split(splitFun, 2);
                        if (array.Length == 2)
                        {
                            filePath = array[0].Trim();
                            line     = int.Parse(array[1].Split(splitLine, 2)[1]);
                        }
                    }
                }
                else
                {
                    isError = sample.name == "exception happen clear stack";
                }

                _showMonoGC      = sample.costMonoGC;
                _showLuaGC       = sample.costLuaGC;
                totalMonoMemory  = sample.costMonoGC;
                totalLuaMemory   = sample.costLuaGC;
                selfLuaMemory    = sample.selfLuaGC;
                selfMonoMemory   = sample.selfMonoGC;
                selfCostTime     = sample.selfCostTime;
                totalTime        = sample.costTime;
                displayName      = sample.name;
                m_originName     = sample.name;
                m_originSampleId = sample.sampleId;

                fullName      = sample.fullName;
                frameCalls    = sample.calls;
                currentTime   = sample.costTime;
                totalCallTime = sample.calls;
            }
            else
            {
                _showMonoGC     = 0;
                _showLuaGC      = 0;
                totalMonoMemory = 0;
                totalLuaMemory  = 0;
                selfMonoMemory  = 0;
                selfLuaMemory   = 0;
                selfCostTime    = 0;

                totalTime     = 0;
                displayName   = "root";
                fullName      = "root";
                frameCalls    = 0;
                currentTime   = 0;
                totalCallTime = 1;
            }
            averageTime = totalTime / Mathf.Max(totalCallTime, 1);

            this.id    = LuaProfilerTreeView.GetUniqueId();
            this.depth = depth;


            childs.Clear();
            if (sample != null)
            {
                for (int i = 0, imax = sample.childs.Count; i < imax; i++)
                {
                    var dict = LuaProfilerTreeView.m_nodeDict;

                    LuaProfilerTreeViewItem mt;
                    var childSample = sample.childs[i];
                    if (dict.TryGetValue(childSample.fullName, out mt))
                    {
                        mt.AddSample(childSample);
                    }
                    else
                    {
                        var item = Create(sample.childs[i], depth + 1, this);
                        childs.Add(item);
                    }
                }
                _frameCount = sample.frameCount;
            }
            this.father = father;
        }
Exemplo n.º 8
0
        //private static readonly char[] splitFun = new char[] { '&' };
        public void ResetBySample(Sample sample, int depth, LuaProfilerTreeViewItem father)
        {
            if (sample != null)
            {
                filePath = sample.name.Split(splitDot, 2)[0].Trim();
                int tmpLine = -1;
                if (int.TryParse(Regex.Match(sample.name, @"(?<=(line:))\d*(?=(&))").Value, out tmpLine))
                {
                    line = tmpLine;
                }
                else
                {
                    line = -1;
                }

                _showMonoGC     = sample.costMonoGC;
                _showLuaGC      = sample.costLuaGC;
                totalMonoMemory = sample.costMonoGC;
                totalLuaMemory  = sample.costLuaGC;
                selfLuaMemory   = sample.selfLuaGC;
                selfMonoMemory  = sample.selfMonoGC;
                totalTime       = sample.costTime;
                displayName     = sample.name;
                m_originName    = sample.name;

                fullName      = sample.fullName;
                frameCalls    = sample.calls;
                currentTime   = sample.costTime;
                totalCallTime = sample.calls;
            }
            else
            {
                _showMonoGC     = 0;
                _showLuaGC      = 0;
                totalMonoMemory = 0;
                totalLuaMemory  = 0;
                selfMonoMemory  = 0;
                selfLuaMemory   = 0;

                totalTime     = 0;
                displayName   = "root";
                fullName      = "root";
                frameCalls    = 0;
                currentTime   = 0;
                totalCallTime = 1;
            }
            averageTime = totalTime / Mathf.Max(totalCallTime, 1);

            this.id    = LuaProfilerTreeView.GetUniqueId();
            this.depth = depth;


            childs.Clear();
            if (sample != null)
            {
                for (int i = 0, imax = sample.childs.Count; i < imax; i++)
                {
                    var dict = LuaProfilerTreeView.m_nodeDict;

                    LuaProfilerTreeViewItem mt;
                    var childSample = sample.childs[i];
                    if (dict.TryGetValue(childSample.fullName, out mt))
                    {
                        mt.AddSample(childSample);
                    }
                    else
                    {
                        var item = Create(sample.childs[i], depth + 1, this);
                        childs.Add(item);
                    }
                }
                _frameCount  = sample.frameCount;
                s_frameCount = sample.frameCount;
            }
            this.father = father;
        }
Exemplo n.º 9
0
        public void ResetBySample(Sample sample, int depth, LuaProfilerTreeViewItem father)
        {
            if (sample != null)
            {
                totalMemory   = sample.costGC;
                _showGC       = sample.costGC;
                totalTime     = (long)(sample.costTime * 1000000);
                displayName   = sample.name;
                fullName      = sample.fullName;
                frameCalls    = sample.calls;
                currentTime   = sample.costTime;
                totalCallTime = sample.calls;
            }
            else
            {
                totalMemory   = 0;
                _showGC       = 0;
                totalTime     = 0;
                displayName   = "root";
                fullName      = "root";
                frameCalls    = 0;
                currentTime   = 0;
                totalCallTime = 1;
            }
            averageTime = totalTime / totalCallTime;

            this.id    = LuaProfilerTreeView.GetUniqueId();
            this.depth = depth;


            childs.Clear();
            if (sample != null)
            {
                for (int i = 0, imax = sample.childs.Count; i < imax; i++)
                {
                    var dict = LuaProfilerTreeView.m_nodeDict;

                    LuaProfilerTreeViewItem mt;
                    var childSample = sample.childs[i];
                    if (dict.TryGetValue(childSample.fullName, out mt))
                    {
                        mt.AddSample(childSample);
                    }
                    else
                    {
                        var item = Create(sample.childs[i], depth + 1, this);
                        childs.Add(item);
                    }
                }
            }
            this.father = father;

            rootFather = this;
            while (true)
            {
                if (rootFather.father == null)
                {
                    break;
                }
                rootFather = rootFather.father;
            }

            _frameCount = Time.frameCount;
        }