public SamplingCallTreeConvertor(IEnumerable <SamplingCallTree> tracingCallTrees)
        {
            var samplingTreeElems = RedistributeValues(tracingCallTrees);

            var flattenedTreeList = new List <SamplingTreeElem>();

            foreach (SamplingTreeElem rootCallTree in samplingTreeElems)
            {
                flattenedTreeList.Add(rootCallTree);
                FlattenCallTree(rootCallTree, flattenedTreeList);
            }

            _aggregators = flattenedTreeList.GroupBy(
                elem => elem.CallTreeElem.MethodMetadata).Select(
                grouping =>
            {
                MethodMetadata methodMetadata = grouping.Key;
                var aggregator = new SamplingMethodAggregator(methodMetadata);
                aggregator.AggregateRange(grouping);
                return(aggregator);
            });

            //_globalAggregatedValues.LastProfiledFrameInStackCount = 0;
            //_globalAggregatedValues.StackTopOccurrenceCount = 0;

            //foreach (var methodAgr in _aggregators)
            //{
            //    _globalAggregatedValues.WallClockDurationHns += methodAgr.TimeWallClock;
            //    _globalAggregatedValues.StackTopOccurrenceCount += methodAgr.StackTopOccurrenceCount;
            //}

            CreateMethodByMetadataDictionary();

            // InterconnectMethodCalls(aggregators);


            CreateCriteriaContext();

            PopulateSourceFiles();
        }
        public SamplingCallTreeConvertor(IEnumerable<SamplingCallTree> tracingCallTrees)
        {
            var samplingTreeElems = RedistributeValues(tracingCallTrees);

            var flattenedTreeList = new List<SamplingTreeElem>();
            foreach (SamplingTreeElem rootCallTree in samplingTreeElems)
            {

                flattenedTreeList.Add(rootCallTree);
                FlattenCallTree(rootCallTree, flattenedTreeList);
            }

            _aggregators = flattenedTreeList.GroupBy(
                elem => elem.CallTreeElem.MethodMetadata).Select(
                    grouping =>
                        {
                            MethodMetadata methodMetadata = grouping.Key;
                            var aggregator = new SamplingMethodAggregator(methodMetadata);
                            aggregator.AggregateRange(grouping);
                            return aggregator;
                        });

            //_globalAggregatedValues.LastProfiledFrameInStackCount = 0;
            //_globalAggregatedValues.StackTopOccurrenceCount = 0;

            //foreach (var methodAgr in _aggregators)
            //{
            //    _globalAggregatedValues.WallClockDurationHns += methodAgr.TimeWallClock;
            //    _globalAggregatedValues.StackTopOccurrenceCount += methodAgr.StackTopOccurrenceCount;
            //}

            CreateMethodByMetadataDictionary();

            // InterconnectMethodCalls(aggregators);

            CreateCriteriaContext();

            PopulateSourceFiles();
        }