mirror of
https://github.com/google/benchmark.git
synced 2025-02-27 03:40:08 +08:00
Improve some comments.
This commit is contained in:
parent
64b5f3ff2d
commit
b57b2cfd77
@ -78,18 +78,15 @@ void RunOutputTests(int argc, char* argv[]);
|
|||||||
struct Results;
|
struct Results;
|
||||||
typedef std::function< void(Results const&) > ResultsCheckFn;
|
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);
|
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.
|
// It is passed in calls to checker functions.
|
||||||
struct Results {
|
struct Results {
|
||||||
std::string name; // the benchmark name
|
|
||||||
|
// the benchmark name
|
||||||
|
std::string name;
|
||||||
|
// the benchmark fields
|
||||||
std::map< std::string, std::string > values;
|
std::map< std::string, std::string > values;
|
||||||
|
|
||||||
Results(const std::string& n) : name(n) {}
|
Results(const std::string& n) : name(n) {}
|
||||||
|
@ -247,11 +247,11 @@ void ResultsChecker::SetHeader_(const std::string& csv_header) {
|
|||||||
field_names = SplitCsv_(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) {
|
void ResultsChecker::SetValues_(const std::string& entry_csv_line) {
|
||||||
|
if(entry_csv_line.empty()) return; // some lines are empty
|
||||||
CHECK(!field_names.empty());
|
CHECK(!field_names.empty());
|
||||||
auto vals = SplitCsv_(entry_csv_line);
|
auto vals = SplitCsv_(entry_csv_line);
|
||||||
if(vals.empty()) return;
|
|
||||||
CHECK_EQ(vals.size(), field_names.size());
|
CHECK_EQ(vals.size(), field_names.size());
|
||||||
results.emplace_back(vals[0]); // vals[0] is the benchmark name
|
results.emplace_back(vals[0]); // vals[0] is the benchmark name
|
||||||
auto &entry = results.back();
|
auto &entry = results.back();
|
||||||
|
Loading…
Reference in New Issue
Block a user