/// <summary>
        /// Returns a anonymous timing string for the given set of nodes (non-recursive)
        /// </summary>
        /// <param name="runs"></param>
        /// <returns></returns>
        public string GetTimingInfo(IConcurrencyResults r)
        {
            var sincl  = r.SequentialRuns.InclusiveMs();
            var sexcl  = r.SequentialRuns.ExclusiveMs();
            var pincl  = r.ParallelRuns.InclusiveMs();
            var pexcl  = r.ParallelRuns.ExclusiveMs();
            var suffix = string.Format(" {0:F}%||", r.GetStats().ParallelConcurrencyPercent);

            if (r.Invocations().Max > 1)
            {
                suffix += string.Format(" calls: {0}", r.Invocations().ToString(0));
            }

            if (sexcl.DeltaRatio > DeltaAbnormalRatio)
            {
                var runTimes = r.AllRuns().Select(n => n.TicksExclusiveTotal).ToMilliseconds().Select(m => Math.Round(m));
                return(string.Format("runs exclusive: {1} {0}", suffix, String.Join("  ", runTimes)));
            }
            else if (r.SequentialRuns.First().HasChildren)
            {
                return(string.Format("exclusive: {0} ||{1}||   inclusive: {2} ||{3} {4}",
                                     sexcl.ToString(DeltaSignificantRatio),
                                     pexcl.ToString(DeltaSignificantRatio),
                                     sincl.ToString(DeltaSignificantRatio),
                                     pincl.ToString(DeltaSignificantRatio), suffix));
            }
            else
            {
                return(string.Format("{0} ||{1} {2}", sincl.ToString(DeltaSignificantRatio), pincl.ToString(DeltaSignificantRatio), suffix));;
            }
        }
Example #2
0
        public static IEnumerable <IConcurrencyResults> CollectChildSets(this IConcurrencyResults r)
        {
            var all = r.AllRuns().ToArray();
            List <IConcurrencyResults> childSets = new List <IConcurrencyResults>();

            if (!all.Any(n => n.HasChildren))
            {
                return(childSets);                              //Return empty set when there are no children;
            }
            var setCount = all.Max(n => n.Children.Count());

            for (var i = 0; i < setCount; i++)
            {
                if (all.Any(ins => ins.Children.Count() != setCount))
                {
                    throw new ArgumentOutOfRangeException("All run trees must have identical structure - mismatched children within segment" + r.SegmentName, "runs");
                }

                var childSeq = r.SequentialRuns.Select(instance => instance.Children[i]).ToArray();
                var childPar = r.ParallelRuns.Select(instance => instance.Children[i]).ToArray();

                var name = (childSeq.FirstOrDefault() ?? childPar.FirstOrDefault()).SegmentName;

                var child = new ConcurrencyResult(childSeq, childPar, r.ParallelThreads, name);
                child.Validate();

                childSets.Add(child);
            }
            return(childSets);
        }
Example #3
0
 public static double MaxExclusiveMs(this IConcurrencyResults r)
 {
     return(r.AllRuns().Max(n => n.TicksExclusiveTotal) * 1000.0 / (double)Stopwatch.Frequency);
 }
Example #4
0
 public static void Validate(this IConcurrencyResults r)
 {
     r.AllRuns().ValidateSet("Within " + r.SegmentName);
 }