Exemplo n.º 1
0
    public static void GetInput()
    {
        // save input from user
        var line = Console.ReadLine();

        if (String.IsNullOrWhiteSpace(line))
        {
            ActiveError("Empty input");
        }

        // input for seeing the sizes of the types
        else if (currentSection == ChoosingState.ChoosingComparisons && line.Contains("s"))
        {
            PrintSizesOfTypes();
        }

        // input for running the previous benchmark
        else if (currentSection == ChoosingState.ChoosingComparisons && line.Contains("p") && currentBenchmarkData != null && currentBenchmarkData.IsValid)
        {
            BenchmarksManager.RunBenchmark(currentBenchmarkData);
        }
        else // normal choosing input
        {
            // if there are spaces, it means the user inputed many choices separated with spaces
            if (line.Contains(" ") && ContainingDigits(line))
            {
                ApplyMultipleInputs(line);
            }
            else
            {
                ApplySingleInput(line);
            }
        }
    }
 public ReportGenerator(ConfigurationManager configuration,
                        ResultsManager results, ParametersManager parameters,
                        BenchmarksManager benchmarks, EnvironmentManager environment)
 {
     _configuration = configuration;
     _results       = results;
     _parameters    = parameters;
     _benchmarks    = benchmarks;
     _environment   = environment;
 }
Exemplo n.º 3
0
 public BenchmarkRunner()
 {
     _configuration = new ConfigurationManager();
     _parameters    = new ParametersManager(_configuration);
     _results       = new ResultsManager();
     _benchmarks    = new BenchmarksManager(_parameters);
     _execution     = new ExecutionManager(_configuration, _results);
     _environment   = new EnvironmentManager();
     _report        = new ReportGenerator(_configuration, _results, _parameters,
                                          _benchmarks, _environment);
 }
Exemplo n.º 4
0
    public static void AddDataFromInput(int input, bool printAfter = true)
    {
        // Adds the data by the user's input
        // Prints the next section
        // Or starts the benchmark if it is the last section

        if (IsNumberValid(input))
        {
            int inputForArray = input - 1;
            switch (currentSection)
            {
            case ChoosingState.ChoosingComparisons:
                currentBenchmarkData = new BenchmarkData(BenchmarksManager.comparisons[inputForArray]);
                currentSection       = ChoosingState.ChoosingDuration;
                if (printAfter)
                {
                    PrintSection();
                }
                break;

            case ChoosingState.ChoosingDuration:
                currentBenchmarkPresetGroup = BenchmarksManager.benchmarkPresetGroups[inputForArray];
                currentSection = ChoosingState.ChoosingPreset;
                if (printAfter)
                {
                    PrintSection();
                }
                break;

            case ChoosingState.ChoosingPreset:
                currentSection = ChoosingState.Complete;
                currentBenchmarkData.InputPreset(currentBenchmarkPresetGroup.presets[inputForArray], currentBenchmarkPresetGroup.Name, input);
                BenchmarksManager.RunBenchmark(currentBenchmarkData);
                break;

            default:
                break;
            }
        }

        else
        {
            ActiveError("Number is invalid. Number: <" + input + ">");
        }
    }