Пример #1
0
        public HistogramResultRow(object groupByKey, TestContextResultAggregate resultsAggregate, List <ResultItemRow> resultItems)
        {
            CreatedThreads = resultsAggregate.CreatedThreadsAvg;
            WorkingThreads = resultsAggregate.WorkingThreadsAvg;

            GroupByKey   = groupByKey;
            _resultItems = resultItems;
        }
Пример #2
0
        void IResultsAggregator.TestContextResultReceived(IResult result)
        {
            _orderLearner.Learn(result.Checkpoints.Select(c => c.Name).ToArray());

            object groupByKey = _groupByKeyCalculatorFunction(result);
            TestContextResultAggregate histogramRowAggregate = GetHistogramRow(groupByKey);

            histogramRowAggregate.AggregateResult(result);
        }
Пример #3
0
        private TestContextResultAggregate GetHistogramRow(object aggregateSlot)
        {
            TestContextResultAggregate result;

            if (!_histogramItems.TryGetValue(aggregateSlot, out result))
            {
                result = new TestContextResultAggregate();
                _histogramItems.Add(aggregateSlot, result);
            }

            return(result);
        }
Пример #4
0
        public ResultItemTotals(TestContextResultAggregate results)
        {
            CheckpointAggregate setupRow    = results.CheckpointAggregates[Checkpoint.IterationSetupCheckpointName];
            CheckpointAggregate tearDownRow = results.CheckpointAggregates[Checkpoint.IterationTearDownCheckpointName];

            TotalDuration = results.IterationEndTime - results.IterationBeginTime;

            TotalIterationsStartedCount   = setupRow.Count;
            TotalFailedIterationCount     = results.CheckpointAggregates.Sum(resultItemRow => resultItemRow.Value.Errors.Count) - tearDownRow.Errors.Count;
            TotalSuccessfulIterationCount = TotalIterationsStartedCount - TotalFailedIterationCount;


            _iterationSetupErrors    = setupRow.Errors;
            _iterationTearDownErrors = tearDownRow.Errors;

            AverageWorkingThreads = results.WorkingThreadsAvg;
        }
Пример #5
0
        public ResultItemRow(TestContextResultAggregate testContextResultAggregate, CheckpointAggregate checkpointAggregate, TimeSpan?totalDurationOverride = null)
        {
            _errors = checkpointAggregate.Errors;

            Count = checkpointAggregate.Count;

            Name = checkpointAggregate.Name;

            MomentMin = checkpointAggregate.MomentMin;
            MomentMax = checkpointAggregate.MomentMax;
            MomentAvg = TimeSpan.FromMilliseconds(checkpointAggregate.SummedMomentTime.TotalMilliseconds / _countDiv);

            SummedMin = checkpointAggregate.TotalMin;
            SummedMax = checkpointAggregate.TotalMax;
            SummedAvg = TimeSpan.FromMilliseconds(checkpointAggregate.SummedTotalTime.TotalMilliseconds / _countDiv);

            if (totalDurationOverride == null)
            {
                totalDurationOverride = testContextResultAggregate.IterationEndTime -
                                        testContextResultAggregate.IterationBeginTime;
            }

            SuccessIterationsPerSec = Count / totalDurationOverride.Value.TotalMilliseconds * 1000;
        }
Пример #6
0
        public IEnumerable <ResultItemRow> Map(TestContextResultAggregate results, bool includeAllCheckpoints = false, TimeSpan?aggregationTimeSpan = null)
        {
            IEnumerable <string> resultsOrder = _orderLearner.LearnedOrder;

            List <CheckpointAggregate> orderedResults =
                resultsOrder
                .Where(results.CheckpointAggregates.ContainsKey)
                .Select(checkpointName => results.CheckpointAggregates[checkpointName]).ToList();

            if (includeAllCheckpoints)
            {
                yield return
                    (new ResultItemRow(results, results.CheckpointAggregates[Checkpoint.IterationSetupCheckpointName], aggregationTimeSpan));
            }

            int iterationCount = 0;

            if (results.CheckpointAggregates.ContainsKey(Checkpoint.IterationEndCheckpointName))
            {
                foreach (CheckpointAggregate resultItem in orderedResults.GetRange(2, orderedResults.Count - 3))
                {
                    var resultItemRow = new ResultItemRow(results, resultItem, aggregationTimeSpan);
                    resultItemRow.SetErrors(orderedResults[1 + iterationCount].Errors);

                    iterationCount++;
                    yield return(resultItemRow);
                }
            }
            else if (
                results.CheckpointAggregates.ContainsKey(Checkpoint.IterationStartCheckpointName) &&
                results.CheckpointAggregates.ContainsKey(Checkpoint.IterationEndCheckpointName) == false
                )
            {
                foreach (CheckpointAggregate resultItem in orderedResults.GetRange(2, orderedResults.Count - 3))
                {
                    var resultItemRow = new ResultItemRow(results, resultItem, aggregationTimeSpan);
                    resultItemRow.SetErrors(orderedResults[1 + iterationCount].Errors);

                    iterationCount++;
                    yield return(resultItemRow);
                }

                ResultItemRow iterationEndRow = new ResultItemRow(
                    Checkpoint.IterationEndCheckpointName,
                    new ResultItemRow(results, orderedResults[orderedResults.Count - 2])
                    )
                {
                    Count = 0,
                    SuccessIterationsPerSec = 0
                };


                yield return(iterationEndRow);
            }

            if (includeAllCheckpoints)
            {
                yield return
                    (new ResultItemRow(results, results.CheckpointAggregates[Checkpoint.IterationTearDownCheckpointName]));
            }
        }