TheRainDoodle / Phenom-II-Benchmark

Small set of low level benchmarks for testing hardware speed against a Phenom II 810 Quad Core
GNU General Public License v3.0
91 stars 20 forks source link

Added 'All' option and writing results to file #4

Closed Rampagy closed 3 years ago

Rampagy commented 4 years ago

I added option 9 to consecutively run all of the tests. I also added writing the results to a file results.txt. The file is placed where the application is run from.

igavelyuk commented 4 years ago

Omg you still my idea :trollface:, I'm implement dorky CSV import

igavelyuk commented 4 years ago

And add kind of database infrastructure

igavelyuk commented 4 years ago

@Rampagy pls adopt idea to make import to CVS and JSON probably nice separate single tread and multi

visuve commented 3 years ago

@Rampagy why would you convert tabs to spaces on someone else's project?

Also your WriteResults function is rather horrible. It opens and closes a file many times in a row, which adds a lot of overhead for nothing.

void WriteResults(std::string line) // Why not constant reference?
{
    // Output file
    std::ofstream resultsFile;

    // append instead of overwrite
    resultsFile.open("results.txt", std::ios_base::app);

    // write line
    resultsFile << line;

    // close file
    resultsFile.close();  // Not needed. std::ofstream uses RAII.
}

You could squeeze your shitty function to this:

void WriteResults(const std::string& line)
{
    std::ofstream("results.txt", std::ios_base::app) << line;
}

So the question is why have a oneliner function at all when it just increases overhead? You could just open std::ofstream results("results.txt", std::ios_base::app)`; at the beginning of the benchmark and call results << testHeader; or results << instructions;