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;
        }
        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;
        }