34 BenchmarkStore(
const BenchmarkStore&) =
delete;
35 BenchmarkStore& operator=(
const BenchmarkStore&) =
delete;
38 BenchmarkStore(BenchmarkStore&&) =
delete;
39 BenchmarkStore& operator=(BenchmarkStore&&) =
delete;
43 static BenchmarkStore
store;
46 void list(ostream& os)
const
48 for (
const auto* bm : store_) {
49 os << bm->name <<
'\n';
57 for (
auto* bm : store_) {
69 BenchmarkSuite
suite{os, 1000.0};
71 suite.run(bm->name, bm->fn);
75 void store(Benchmark& bm) { store_.push_back(&bm); }
78 BenchmarkStore() =
default;
88 BenchmarkStore::instance().store(*
this);
102 opts(
'f',
"filter",
Value{
regex},
"run benchmarks matching regex")
103 (
'l',
"list",
Switch{list},
"list available benchmarks")
104 (
'h',
"help",
Help{})
111 auto&
store = BenchmarkStore::instance();
118 }
catch (
const exception& e) {
119 cerr <<
"error: " << e.what();