Improve some comments.

This commit is contained in:
Joao Paulo Magalhaes 2017-05-01 22:33:19 +01:00
parent 64b5f3ff2d
commit b57b2cfd77
2 changed files with 7 additions and 10 deletions

View File

@ -78,18 +78,15 @@ void RunOutputTests(int argc, char* argv[]);
struct Results;
typedef std::function< void(Results const&) > ResultsCheckFn;
// Add a function to check the (CSV) results of a benchmark. These
// functions will be called only after the output was successfully
// checked.
// bm_name_pattern: a name or a regex which will be matched agains
// all the benchmark names. Matching benchmarks
// will be the subject of a call to fn
size_t AddChecker(const char* bm_name_pattern, ResultsCheckFn fn);
// Class to hold the (CSV!) results of a benchmark.
// Class holding the results of a benchmark.
// It is passed in calls to checker functions.
struct Results {
std::string name; // the benchmark name
// the benchmark name
std::string name;
// the benchmark fields
std::map< std::string, std::string > values;
Results(const std::string& n) : name(n) {}

View File

@ -247,11 +247,11 @@ void ResultsChecker::SetHeader_(const std::string& csv_header) {
field_names = SplitCsv_(csv_header);
}
// set the values for subscribed benchmarks, and silently ignore all others
// set the values for a benchmark
void ResultsChecker::SetValues_(const std::string& entry_csv_line) {
if(entry_csv_line.empty()) return; // some lines are empty
CHECK(!field_names.empty());
auto vals = SplitCsv_(entry_csv_line);
if(vals.empty()) return;
CHECK_EQ(vals.size(), field_names.size());
results.emplace_back(vals[0]); // vals[0] is the benchmark name
auto &entry = results.back();