34 void print(ostream& os,
const string& title,
double total_ms = 0.0)
const
36 vector<pair<string, Entry>> sorted(
entries.begin(),
entries.end());
38 [](
const auto& a,
const auto& b) {
return a.second.total_ms > b.second.total_ms; });
40 os <<
"\n[PROFILE] " << title <<
"\n";
41 os <<
" " << left << setw(48) <<
"section"
42 << right << setw(12) <<
"total_ms"
43 << setw(10) <<
"calls"
44 << setw(12) <<
"ms/call";
45 if (total_ms > 0.0) os << setw(8) <<
"%";
48 for (
const auto& [key, entry] : sorted)
50 os <<
" " << left << setw(48) << key
51 << right << setw(12) << fixed << setprecision(2) << entry.total_ms
52 << setw(10) << entry.calls
53 << setw(12) << fixed << setprecision(3) << (entry.total_ms / double(entry.calls));
55 os << setw(7) << fixed << setprecision(1) << (entry.total_ms / total_ms * 100.0) <<
"%";