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;
        }
        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;
        }
Beispiel #4
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;
        }
Beispiel #5
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;
        }