Add special case for single-call functions in profiler::dump

This commit is contained in:
Nikita Lisitsa 2021-06-04 14:26:16 +03:00
parent 5d023cb923
commit f327cc4315

View file

@ -79,12 +79,17 @@ namespace psemek::util
for (auto const & c : node.children)
{
auto const & stat = c.second.execution_time;
log::info() << std::string(depth * 2, ' ') << std::setw(max_name_length + 3) << std::left << std::setfill(' ') << c.first
<< " avg " << pretty(stat.mean())
<< " 25% " << pretty(stat.percentile(0.25))
<< " 50% " << pretty(stat.percentile(0.50))
<< " 75% " << pretty(stat.percentile(0.75))
<< " (" << stat.count() << " calls)";
if (stat.count() == 1)
log::info() << std::string(depth * 2, ' ') << std::setw(max_name_length + 3) << std::left << std::setfill(' ') << c.first
<< " " << pretty(stat.mean())
<< " (" << stat.count() << " call)";
else
log::info() << std::string(depth * 2, ' ') << std::setw(max_name_length + 3) << std::left << std::setfill(' ') << c.first
<< " avg " << pretty(stat.mean())
<< " 25% " << pretty(stat.percentile(0.25))
<< " 50% " << pretty(stat.percentile(0.50))
<< " 75% " << pretty(stat.percentile(0.75))
<< " (" << stat.count() << " calls)";
dump_impl(c.second, depth + 1);
}
}