diff --git a/benchmark.hpp b/benchmark.hpp index 9b6dcb8..cf1b274 100644 --- a/benchmark.hpp +++ b/benchmark.hpp @@ -147,14 +147,13 @@ void runAll(){ //Run through all valid problem numbers, skipping a few that are in the tooLong vector for(unsigned int cnt = 1;cnt < PROBLEM_NUMBERS.size();++cnt){ unsigned int problemNumber = PROBLEM_NUMBERS[cnt]; - double totalTime = 0; //Get the problem Problem* problem = getProblem(problemNumber); //Run the problem the specified number of times std::cout << problemNumber << ". " << problem->getDescription() << '\n'; - runProblem(problem, timesToRun); + double totalTime = runProblem(problem, timesToRun); //Print the results std::cout << getBenchmarkResults(problem, totalTime, timesToRun); @@ -194,14 +193,14 @@ double runProblem(Problem* problem, unsigned int timesToRun){ } //Prints the benchmark results of a problem -std::string getBenchmarkResults(Problem* problem, double totalTime, unsigned int timesRan){ +std::string getBenchmarkResults(Problem* problem, double totalTime, unsigned int timesRun){ //Calculate the average run time of the problem - totalTime /= timesRan; + totalTime /= timesRun; std::string timeResults = mee::Stopwatch::getStr(totalTime); //Tally the results std::stringstream results; results << "\n\n" << problem->getString(); - results << "\nIt took an average of " << timeResults << " to run this problem over " << timesRan << " iterations\n\n" << std::endl; + results << "\nIt took an average of " << timeResults << " to run this problem over " << timesRun << " iterations\n\n" << std::endl; return results.str(); }