private static string BuildChain(CallChain chain)
 {
     if (chain == null) return "NULL!";
     string ret = chain.Name;
     ret += chain.Children.Select(BuildChain);
     return ret;
 }
예제 #2
0
 private static IEnumerable<IEnumerable<string>> RecurseTo(CallChain chain, string method, string test)
 {
     var stack = new Stack<string>();
     if(test != null)
     {
         stack.Push(test);
     }
     return RecurseToInternal(stack, chain, method);
 }
예제 #3
0
        private static IEnumerable <IEnumerable <string> > RecurseTo(CallChain chain, string method, string test)
        {
            var stack = new Stack <string>();

            if (test != null)
            {
                stack.Push(test);
            }
            return(RecurseToInternal(stack, chain, method));
        }
        private static string BuildChain(CallChain chain)
        {
            if (chain == null)
            {
                return("NULL!");
            }
            string ret = chain.Name;

            ret += chain.Children.Select(BuildChain);
            return(ret);
        }
예제 #5
0
 private static IEnumerable<IEnumerable<string>> RecurseToInternal(Stack<string> currentStack, CallChain chain, string method)
 {
     if (chain == null) yield break;
     currentStack.Push(chain.Name);
     if (chain.Name == method)
     {
         yield return currentStack.ToArray();
     }
     foreach (var c in chain.Children)
     {
         foreach (var item in RecurseToInternal(currentStack, c, method)) yield return item;
     }
     currentStack.Pop();
 }
 private CallChain BuildChain(Stack <CallChain> chain, ProfilerEntry entry, bool unExpected)
 {
     if (entry.Type == ProfileType.Leave || unExpected)
     {
         if (ignoredcount > 0)
         {
             ignoredcount--;
             return(null);
         }
         while (chain.Count > 0)
         {
             var current = chain.Pop();
             if (current.FunctionId == entry.Functionid || chain.Count == 0)
             {
                 current.EndTime = entry.Time;
                 return(current);
             }
         }
     }
     if (entry.Type == ProfileType.Enter)
     {
         if (chain.Count > 200)
         {
             ignoredcount++;
             return(null);
         }
         var chainEntry = new CallChain(entry.Runtime.Replace(", ", ","), entry.Runtime, entry.Functionid);
         chainEntry.StartTime = entry.Time;
         if (chain.Count != 0)
         {
             var parent = chain.Peek();
             if (parent.Children.Count < 1000)
             {
                 parent.AddChild(chainEntry);
             }
         }
         chain.Push(chainEntry);
     }
     return(null);
 }
 private void Index(string test, CallChain chain)
 {
     string item = chain.Name.Replace('+', '/');
     
     Dictionary<string, bool> tests;
     if(!_linkHash.TryGetValue(item, out tests))
     {
         tests = new Dictionary<string, bool>();
         _linkHash.Add(item, tests);
     }
     CountsAndTimes counts;
     if (!_timesHash.TryGetValue(item, out counts))
     {
         counts = new CountsAndTimes();
         _timesHash.Add(item, counts);
     }
     if(!tests.ContainsKey(test))
     {
         tests.Add(test, false);
     }
     counts.ProcessNewEntry(chain);
 }
예제 #8
0
        private void Index(string test, CallChain chain)
        {
            string item = chain.Name.Replace('+', '/');

            Dictionary <string, bool> tests;

            if (!_linkHash.TryGetValue(item, out tests))
            {
                tests = new Dictionary <string, bool>();
                _linkHash.Add(item, tests);
            }
            CountsAndTimes counts;

            if (!_timesHash.TryGetValue(item, out counts))
            {
                counts = new CountsAndTimes();
                _timesHash.Add(item, counts);
            }
            if (!tests.ContainsKey(test))
            {
                tests.Add(test, false);
            }
            counts.ProcessNewEntry(chain);
        }
예제 #9
0
 private static IEnumerable <IEnumerable <string> > RecurseToInternal(Stack <string> currentStack, CallChain chain, string method)
 {
     if (chain == null)
     {
         yield break;
     }
     currentStack.Push(chain.Name);
     if (chain.Name == method)
     {
         yield return(currentStack.ToArray());
     }
     foreach (var c in chain.Children)
     {
         foreach (var item in RecurseToInternal(currentStack, c, method))
         {
             yield return(item);
         }
     }
     currentStack.Pop();
 }
 public void AddTearDown(CallChain chain)
 {
     Teardowns.Add(chain);
 }
 public void AddSetup(CallChain chain)
 {
     Setups.Add(chain);
 }
예제 #12
0
 public void AddTearDown(CallChain chain)
 {
     Teardowns.Add(chain);
 }
예제 #13
0
 public void AddSetup(CallChain chain)
 {
     Setups.Add(chain);
 }
예제 #14
0
 public void AddChild(CallChain child)
 {
     _children.Add(child);
 }
 public void can_calulate_total_time_properly_for_single_item_with_multiple_children()
 {
     var count = new CountsAndTimes();
     var chain = new CallChain("TEST", "TESTR", 3) { StartTime = 0, EndTime = 10 };
     chain.Children.Add(new CallChain("TEST1", "TESTR", 3) { StartTime = 3, EndTime = 5 });
     chain.Children.Add(new CallChain("TEST1", "TESTR", 3) { StartTime = 5, EndTime = 7 });
     count.ProcessNewEntry(chain);
     Assert.AreEqual(6, count.TotalTime);
     Assert.AreEqual(6, count.MaxTime);
     Assert.AreEqual(6, count.MinTime);
     Assert.AreEqual(6, count.AverageTime);
 }
 private CallChain BuildChain(Stack<CallChain> chain, ProfilerEntry entry, bool unExpected)
 {
     if(entry.Type == ProfileType.Leave || unExpected)
     {
         if(ignoredcount > 0)
         {
             ignoredcount--;
             return null;
         }
         while (chain.Count > 0)
         {
             var current = chain.Pop();
             if (current.FunctionId == entry.Functionid || chain.Count == 0)
             {
                 current.EndTime = entry.Time;
                 return current;
             }
         }
     }
     if(entry.Type == ProfileType.Enter)
     {
         if(chain.Count > 200)
         {
             ignoredcount++;
             return null;
         }
         var chainEntry = new CallChain(entry.Runtime.Replace(", ", ","),entry.Runtime, entry.Functionid);
         chainEntry.StartTime = entry.Time;
         if (chain.Count != 0)
         {
             var parent = chain.Peek();
             if(parent.Children.Count < 1000)
                  parent.AddChild(chainEntry);
         }
         chain.Push(chainEntry);
     }
     return null;
 }
 private static Chain BuildChain(CallChain callChain, bool isSetup, bool isTest, bool isTeardown )
 {
     var chain = new Chain(callChain.Runtime, callChain.Name);
     chain.IsSetup = isSetup;
     chain.IsTest = isTest;
     chain.IsTeardown = isTeardown;
     chain.TimeStart = callChain.StartTime;
     chain.TimeEnd = callChain.EndTime;
     foreach(var child in callChain.Children)
     {
         chain.Children.Add(BuildChain(child, false, false, false));
     }
     return chain;
 }
 public void does_not_include_children_that_are_itself_when_counting_with_multiple_children()
 {
     var count = new CountsAndTimes();
     var chain = new CallChain("TEST", "TESTR", 3) { StartTime = 0, EndTime = 10 };
     chain.Children.Add(new CallChain("TEST", "TESTR", 3) { StartTime = 3, EndTime = 5 });
     chain.Children.Add(new CallChain("TEST1", "TESTR", 3) { StartTime = 5, EndTime = 7 });
     count.ProcessNewEntry(chain);
     Assert.AreEqual(8, count.TotalTime);
     Assert.AreEqual(8, count.MaxTime);
     Assert.AreEqual(8, count.MinTime);
     Assert.AreEqual(8, count.AverageTime);
 }
예제 #19
0
 public void AddChild(CallChain child)
 {
     _children.Add(child);
 }