Esempio n. 1
0
        public FoldedStackLine Clone()
        {
            FoldedStackLine foldedStackLineClone = (FoldedStackLine)this.MemberwiseClone();

            foldedStackLineClone.StackTimingArray = new long[this.StackTimingArray.Length];
            this.StackTimingArray.CopyTo(foldedStackLineClone.StackTimingArray, 0);
            return(foldedStackLineClone);
        }
Esempio n. 2
0
 public void AddFoldedStackLine(FoldedStackLine foldedStackLineToAdd)
 {
     this.NumSamples = this.NumSamples + foldedStackLineToAdd.NumSamples;
     for (int i = 0; i < this.StackTimingArray.Length; i++)
     {
         if (i < foldedStackLineToAdd.StackTiming.Length)
         {
             this.StackTimingArray[i] = this.StackTimingArray[i] + foldedStackLineToAdd.StackTimingArray[i];
         }
     }
 }
Esempio n. 3
0
        public void AddFoldedStackLine(FoldedStackLine foldedStackLineToAdd)
        {
            // Add number of samples
            this.NumSamples = this.NumSamples + foldedStackLineToAdd.NumSamples;

            // Add timings for each of the folded stack sections
            for (int i = 0; i < this.StackTimingArray.Length; i++)
            {
                if (i < foldedStackLineToAdd.StackTimingArray.Length)
                {
                    this.StackTimingArray[i] = this.StackTimingArray[i] + foldedStackLineToAdd.StackTimingArray[i];
                }
            }

            // Add exit calls from each of the frames
            for (int i = 0; i < this.ExitCallsArray.Length; i++)
            {
                if (i < foldedStackLineToAdd.ExitCallsArray.Length)
                {
                    if (this.ExitCallsArray[i] != null &&
                        this.ExitCallsArray[i].Length > 0 &&
                        foldedStackLineToAdd.ExitCallsArray[i] != null &&
                        foldedStackLineToAdd.ExitCallsArray[i].Length > 0)
                    {
                        // Append two exit calls by decoding them, squishing them together, and then reencoding them
                        string exitsInThisFoldedStack = Encoding.UTF8.GetString(Convert.FromBase64String(this.ExitCallsArray[i]));

                        // Only append if the exit size hasn't grown larger then what we want to see
                        if (exitsInThisFoldedStack.Length < 400)
                        {
                            string exitsInIncomingFoldedStack = Encoding.UTF8.GetString(Convert.FromBase64String(foldedStackLineToAdd.ExitCallsArray[i]));

                            List <string> allExits = new List <string>();
                            allExits.AddRange(exitsInThisFoldedStack.Split('\n').ToList());
                            allExits.AddRange(exitsInIncomingFoldedStack.Split('\n').ToList());

                            // Only append unique values
                            List <string> uniqueExits = allExits.Distinct().ToList();
                            this.ExitCallsArray[i] = Convert.ToBase64String(UTF8Encoding.UTF8.GetBytes(String.Join("\n", uniqueExits)));
                        }
                    }
                    else if (
                        this.ExitCallsArray[i] != null &&
                        this.ExitCallsArray[i].Length > 0 &&
                        (foldedStackLineToAdd.ExitCallsArray[i] == null || foldedStackLineToAdd.ExitCallsArray[i].Length == 0))
                    {
                        // Do nothing, nothing to add from the incoming folded stack
                    }
                    else if (
                        (this.ExitCallsArray[i] == null || this.ExitCallsArray[i].Length == 0) &&
                        foldedStackLineToAdd.ExitCallsArray[i] != null &&
                        foldedStackLineToAdd.ExitCallsArray[i].Length > 0)
                    {
                        // Move the target exit call into here
                        this.ExitCallsArray[i] = foldedStackLineToAdd.ExitCallsArray[i];
                    }
                    else if (
                        (this.ExitCallsArray[i] == null || this.ExitCallsArray[i].Length == 0) &&
                        (foldedStackLineToAdd.ExitCallsArray[i] == null || foldedStackLineToAdd.ExitCallsArray[i].Length == 0))
                    {
                        // Do nothing, nothing to join
                    }
                }
            }
        }