#include <QTextStream>
+#include <cmath>
+
namespace{
/// TODO: share code
QString basename(const QString& path)
stream << '\n';
stream << i18n("inclusive: allocated %1 over %2 calls (%3 temporary, i.e. %4%), peak at %5, leaked %6",
m_format.formatByteSize(row.inclusiveCost.allocated), row.inclusiveCost.allocations, row.inclusiveCost.temporary,
- round(float(row.inclusiveCost.temporary) * 100.f * 100.f / row.inclusiveCost.allocations) / 100.f,
+ round(float(row.inclusiveCost.temporary) * 100.f * 100.f / std::max(uint64_t(1), row.inclusiveCost.allocations)) / 100.f,
m_format.formatByteSize(row.inclusiveCost.peak), m_format.formatByteSize(row.inclusiveCost.leaked));
stream << '\n';
stream << i18n("self: allocated %1 over %2 calls (%3 temporary, i.e. %4%), peak at %5, leaked %6",
m_format.formatByteSize(row.selfCost.allocated), row.selfCost.allocations, row.selfCost.temporary,
- round(float(row.selfCost.temporary) * 100.f * 100.f / row.selfCost.allocations) / 100.f,
+ round(float(row.selfCost.temporary) * 100.f * 100.f / std::max(uint64_t(1), row.selfCost.allocations)) / 100.f,
m_format.formatByteSize(row.selfCost.peak), m_format.formatByteSize(row.selfCost.leaked));
stream << '\n';
stream << "</pre></qt>";