Esempio n. 1
0
        private string GetMergedOutput(ExperimentResult experimentResult)
        {
            var sb = new StringBuilder();

            if (System.Diagnostics.Debugger.IsAttached)
            {
                sb.AppendLine("Warning. Experiment was executed under debugger. Results may be unrelaiable.");
            }

            sb.AppendLine(experimentResult.Name);
            sb.AppendLine(" " + _separator + experimentResult.ProbeResults
                          .Select(x => x.Name)
                          .Join(_separator));

            var sizesGroups = experimentResult.ProbeResults
                              .SelectMany(x => x.Measurments)
                              .GroupBy(x => x.Size);

            foreach (var group in sizesGroups)
            {
                sb.AppendLine(group.Key + _separator + group.Select(x => x.Duration.TotalMilliseconds.ToString())
                              .Join(_separator));
            }

            return(sb.ToString());
        }
Esempio n. 2
0
        public void Output(ExperimentResult experimentResult)
        {
            if (!experimentResult.ProbeResults.Any())
            {
                throw new ArgumentException("No probes to output");
            }

            if (!Directory.Exists(_outputPath))
            {
                Directory.CreateDirectory(_outputPath);
            }

            var output = GetMergedOutput(experimentResult);

            var fileName = Path.Combine(_outputPath, experimentResult.Name + ".txt");

            File.WriteAllText(fileName, output);
        }