void operator()

in fatal/benchmark/benchmark.h [345:401]


  void operator ()(
    TOut &out,
    results const &result,
    duration running_time
  ) const {
    for (auto const &group: result) {
      out << "-- group: " << group.first << " --\n";

      bool first = true;
      duration previous_period(0);

      for (auto const &i: group.second) {
        auto const period = i.period();
        bool const inf = period.count() == 0;
        auto const frequency = inf
          ? 0
          : decltype(period)(std::chrono::seconds(1)).count() / period.count();

        out << i.name() << ": period = " << period.count()
          << ' ' << time::suffix(period) << ", frequency = ";

        if (inf) {
          out << "inf";
        } else {
          out << frequency;
        }

        out << " Hz";

        if (first) {
          first = false;
        } else {
          assert(previous_period <= period);

          out << ", diff = ";

          if (previous_period.count()) {
            auto const diff = period.count() * 10000 / previous_period.count();
            assert(diff >= 10000);

            out << (diff / 100) << '.' << (diff % 100) << '%';
          } else {
            out << (period.count() ? "inf" : "0.0%");
          }
        }

        out << '\n';

        previous_period = period;
      }

      out << '\n';
    }

    out << "total running time: " << running_time.count()
      << ' ' << time::suffix(running_time) << '\n';
  }