10 std::cerr <<
"summary ";
14 std::cerr << s << std::endl;
21 std::ostream& os,
results const& r)
const {
22 bool all_sizes_are_zero =
true;
23 for (
auto const& v : r) {
25 all_sizes_are_zero =
false;
30 using namespace std::chrono;
31 if (all_sizes_are_zero) {
32 for (
auto const& v : r) {
33 os <<
config_.
prefix() << duration_cast<nanoseconds>(v.second).count()
37 for (
auto const& v : r) {
39 << duration_cast<nanoseconds>(v.second).count() <<
"\n";
48 return lhs.second < rhs.second;
50 std::sort(r.begin(), r.end(), cmp);
52 auto p = [
this, &r](
double p) {
return r[int(p * n / 100)].second; };
61 max = r.back().second;
67 using namespace std::chrono;
69 return os <<
"min=" << duration_cast<microseconds>(x.
min).count()
70 <<
"us, p25=" << duration_cast<microseconds>(x.
p25).count()
71 <<
"us, p50=" << duration_cast<microseconds>(x.
p50).count()
72 <<
"us, p75=" << duration_cast<microseconds>(x.
p75).count()
73 <<
"us, p90=" << duration_cast<microseconds>(x.
p90).count()
74 <<
"us, p99=" << duration_cast<microseconds>(x.
p99).count()
75 <<
"us, p99.9=" << duration_cast<microseconds>(x.
p99_9).count()
76 <<
"us, max=" << duration_cast<microseconds>(x.
max).count()
void typical_output(results const &r) const
Produce the results of the test in a format that works for most cases.
std::pair< int, duration > result
jb::config_attribute< microbenchmark_config, int > size
jb::config_attribute< microbenchmark_config, std::string > test_case
std::vector< result > results
jb::config_attribute< microbenchmark_config, bool > verbose
std::ostream & operator<<(std::ostream &os, microbenchmark_base::summary const &x)
Stream the summary of a microbenchmark results in microseconds.
microbenchmark_config config_
A simple object to contain the summary of the test results.
jb::config_attribute< microbenchmark_config, std::string > prefix
void write_results(std::ostream &os, results const &r) const
Stream the detailed results.