private static void CalculateResults(ResultGroups resultGroups)
        {
            // Calculate the results for each tester and sample size
            foreach (var testerType in _testerTypes)
            {
                // Get the tester results
                var testerResults = resultGroups.SingleOrDefault(i => i.SerializerType == testerType);
                if (testerResults == null)
                {
                    throw new NullReferenceException(String.Format("Cannot find tester results for type {0}", testerType.ToString()));
                }

                foreach (var sampleSize in _sampleSizes)
                {
                    // Get the sample results
                    var sampleResults = testerResults.Results.Where(i => i.SampleSize == sampleSize);
                    if (sampleResults.Count() == 0)
                    {
                        throw new KeyNotFoundException(String.Format("Cannot find tester results for sample size of {0}", sampleSize));
                    }

                    var calculatedResult = CalculateAverageOfResults(sampleResults);
                    calculatedResult.SampleSize = sampleSize;
                    testerResults.CalculatedResults.Add(calculatedResult);
                }
            }
        }
        private static ResultGroups CreateResultGroups()
        {
            var results = new ResultGroups();

            foreach (var testerType in _testerTypes)
            {
                results.Add(new ResultGroup {
                    SerializerType = testerType
                });
            }
            return(results);
        }
        private static void PerformTests(SampleDataSets <Orders> sampleDatasets, ResultGroups resultGroups)
        {
            foreach (var testerType in _testerTypes)
            {
                foreach (var sampleSize in _sampleSizes)
                {
                    // Get the sample data
                    var sampleDataset = sampleDatasets.FirstOrDefault(x => x.Size == sampleSize);
                    if (sampleDataset != null)
                    {
                        // Get the result group to add the test results to
                        var resultGroup = resultGroups.GetByTesterType(testerType);

                        // Perform number of tests required and get the results
                        PerformTestByTesterAndSample(testerType, sampleDataset, resultGroup, _testsToPerformPerInstance);
                    }
                }
            }
        }
        private static void OutputResults(ResultGroups resultGroups)
        {
            var consoleFormatString = "|{0,-30}|{1,10}|{2,10}|{3,10}|{4,10}|";

            Console.WriteLine("");
            Console.WriteLine(String.Format(consoleFormatString, "Serializer", "Sample", "Size", "Ser.", "Deser."));
            foreach (var resultGroup in resultGroups)
            {
                foreach (var calculatedResult in resultGroup.CalculatedResults.OrderBy(i => i.SampleSize))
                {
                    Console.WriteLine(String.Format(consoleFormatString,
                                                    resultGroup.SerializerType.Name,
                                                    calculatedResult.SampleSize,
                                                    calculatedResult.SerializedObjectSize,
                                                    calculatedResult.SerializationTime,
                                                    calculatedResult.DeserializationTime));
                }
            }
        }
 public ResultViewModel(
     string title,
     string desc,
     string date,
     double distance,
     string duration,
     double kmh,
     string minkm,
     ResultGroups group)
 {
     _title = title;
     _description = desc;
     _date = date;
     _distance = distance;
     _duration = duration;
     _kilometerPerHour = kmh;
     _minutePerKilometer = minkm;
     _groups = group;
 }
Esempio n. 6
0
 public void Add(SearchResultPart part)
 {
     ResultGroups.Add(new SearchResultGroupVM(part.GroupKey, RootDir, part.Group.ToList()));
 }