private void FlattenCallTree(SamplingTreeElem rootElem, List <SamplingTreeElem> flattenedTreeList)
 {
     flattenedTreeList.AddRange(rootElem.Children);
     foreach (SamplingTreeElem callTreeElem in rootElem.Children)
     {
         FlattenCallTree(callTreeElem, flattenedTreeList);
     }
 }
 private void RecursiveTimeTreeWalk(SamplingTreeElem treeElem, ulong wallClockDurationHns, uint maxInStackOccurrence)
 {
     treeElem.WallClockTime = wallClockDurationHns * treeElem.InStackSnapshotOccurrence /
                              (double)maxInStackOccurrence;
     foreach (var childTreeElem in treeElem.Children)
     {
         RecursiveTimeTreeWalk(childTreeElem, wallClockDurationHns, maxInStackOccurrence);
     }
 }
        private void RecursiveTreeWalk(SamplingCallTreeElem callTreeElem, out SamplingTreeElem recomputedTreeElem)
        {
            recomputedTreeElem = new SamplingTreeElem();
            recomputedTreeElem.CallTreeElem = callTreeElem;
            recomputedTreeElem.TopStackSnapshotOccurrence =  //callTreeElem.LastProfiledFrameInStackCount +
                                                            callTreeElem.StackTopOccurrenceCount;
            recomputedTreeElem.InStackSnapshotOccurrence = recomputedTreeElem.TopStackSnapshotOccurrence;
            bool leafReached = callTreeElem.ChildrenCount == 0;

            if (!leafReached)
            {
                foreach (var childCallTreeElem in callTreeElem.Children)
                {
                    SamplingTreeElem childTreeElem;
                    RecursiveTreeWalk(childCallTreeElem, out childTreeElem);
                    recomputedTreeElem.Children.Add(childTreeElem);
                    recomputedTreeElem.InStackSnapshotOccurrence += childTreeElem.InStackSnapshotOccurrence;
                }
            }
        }
 private void RecursiveTreeWalk(SamplingCallTreeElem callTreeElem, out SamplingTreeElem recomputedTreeElem)
 {
     recomputedTreeElem = new SamplingTreeElem();
     recomputedTreeElem.CallTreeElem = callTreeElem;
     recomputedTreeElem.TopStackSnapshotOccurrence  = //callTreeElem.LastProfiledFrameInStackCount +
                                                        callTreeElem.StackTopOccurrenceCount;
     recomputedTreeElem.InStackSnapshotOccurrence = recomputedTreeElem.TopStackSnapshotOccurrence;
     bool leafReached = callTreeElem.ChildrenCount == 0;
     if(!leafReached)
     {
         foreach (var childCallTreeElem in callTreeElem.Children)
         {
             SamplingTreeElem childTreeElem;
             RecursiveTreeWalk(childCallTreeElem, out childTreeElem);
             recomputedTreeElem.Children.Add(childTreeElem);
             recomputedTreeElem.InStackSnapshotOccurrence += childTreeElem.InStackSnapshotOccurrence;
         }
     }
 }
 private void RecursiveTimeTreeWalk(SamplingTreeElem treeElem, ulong wallClockDurationHns, uint maxInStackOccurrence)
 {
     treeElem.WallClockTime = wallClockDurationHns*treeElem.InStackSnapshotOccurrence/
                              (double) maxInStackOccurrence;
     foreach (var childTreeElem in treeElem.Children)
     {
         RecursiveTimeTreeWalk(childTreeElem, wallClockDurationHns, maxInStackOccurrence);
     }
 }
 private void FlattenCallTree(SamplingTreeElem rootElem, List<SamplingTreeElem> flattenedTreeList)
 {
     flattenedTreeList.AddRange(rootElem.Children);
     foreach (SamplingTreeElem callTreeElem in rootElem.Children)
     {
         FlattenCallTree(callTreeElem, flattenedTreeList);
     }
 }
 public void Aggregate(SamplingTreeElem callTreeElem)
 {
     Contract.Requires(FunctionId == callTreeElem.CallTreeElem.FunctionId);
     AggregateElemSpecificFields(callTreeElem);
 }
 protected void AggregateElemSpecificFields(SamplingTreeElem callTreeElem)
 {
     StackTopOccurrenceCount = callTreeElem.TopStackSnapshotOccurrence;
     TimeWallClock           = callTreeElem.WallClockTime;
 }
 protected void AggregateElemSpecificFields(SamplingTreeElem callTreeElem)
 {
     StackTopOccurrenceCount = callTreeElem.TopStackSnapshotOccurrence;
     TimeWallClock = callTreeElem.WallClockTime;
 }
 public void Aggregate(SamplingTreeElem callTreeElem)
 {
     Contract.Requires(FunctionId == callTreeElem.CallTreeElem.FunctionId);
     AggregateElemSpecificFields(callTreeElem);
 }