MCPcopy Create free account
hub / github.com/BYVoid/OpenCC / FormatCounterValue

Function FormatCounterValue

src/benchmark/Performance.cpp:578–594  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

576}
577
578std::string FormatCounterValue(const benchmark::BenchmarkReporter::Run& run,
579 const char* key, const char* suffix = "") {
580 const auto it = run.counters.find(key);
581 if (it == run.counters.end()) {
582 return "";
583 }
584
585 std::ostringstream os;
586 if (run.run_type == benchmark::BenchmarkReporter::Run::RT_Aggregate &&
587 run.aggregate_unit == benchmark::StatisticUnit::kPercentage) {
588 os << std::fixed << std::setprecision(2) << (100.0 * it->second.value)
589 << "%";
590 } else {
591 os << std::fixed << std::setprecision(2) << it->second.value << suffix;
592 }
593 return os.str();
594}
595
596std::string BenchmarkGroupName(const benchmark::BenchmarkReporter::Run& run) {
597 const std::string name = run.benchmark_name();

Callers 1

PrintRunDataMethod · 0.85

Calls 3

findMethod · 0.80
endMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected