if (role == SortRole || role == MaxCostRole) {
return static_cast<qint64>(row.selfCost.allocated);
} else {
- return m_format.formatByteSize(row.selfCost.allocated, 1, KFormat::MetricBinaryDialect);
+ return m_format.formatByteSize(row.selfCost.allocated, 1, KFormat::JEDECBinaryDialect);
}
case SelfAllocationsColumn:
return static_cast<qint64>(row.selfCost.allocations);
if (role == SortRole || role == MaxCostRole) {
return static_cast<qint64>(row.selfCost.peak);
} else {
- return m_format.formatByteSize(row.selfCost.peak, 1, KFormat::MetricBinaryDialect);
+ return m_format.formatByteSize(row.selfCost.peak, 1, KFormat::JEDECBinaryDialect);
}
case SelfPeakInstancesColumn:
return static_cast<qint64>(row.selfCost.peak_instances);
if (role == SortRole || role == MaxCostRole) {
return static_cast<qint64>(row.selfCost.leaked);
} else {
- return m_format.formatByteSize(row.selfCost.leaked, 1, KFormat::MetricBinaryDialect);
+ return m_format.formatByteSize(row.selfCost.leaked, 1, KFormat::JEDECBinaryDialect);
}
case InclusiveAllocatedColumn:
if (role == SortRole || role == MaxCostRole) {
return static_cast<qint64>(row.inclusiveCost.allocated);
} else {
- return m_format.formatByteSize(row.inclusiveCost.allocated, 1, KFormat::MetricBinaryDialect);
+ return m_format.formatByteSize(row.inclusiveCost.allocated, 1, KFormat::JEDECBinaryDialect);
}
case InclusiveAllocationsColumn:
return static_cast<qint64>(row.inclusiveCost.allocations);
if (role == SortRole || role == MaxCostRole) {
return static_cast<qint64>(row.inclusiveCost.peak);
} else {
- return m_format.formatByteSize(row.inclusiveCost.peak, 1, KFormat::MetricBinaryDialect);
+ return m_format.formatByteSize(row.inclusiveCost.peak, 1, KFormat::JEDECBinaryDialect);
}
case InclusivePeakInstancesColumn:
return static_cast<qint64>(row.inclusiveCost.peak_instances);
if (role == SortRole || role == MaxCostRole) {
return static_cast<qint64>(row.inclusiveCost.leaked);
} else {
- return m_format.formatByteSize(row.inclusiveCost.leaked, 1, KFormat::MetricBinaryDialect);
+ return m_format.formatByteSize(row.inclusiveCost.leaked, 1, KFormat::JEDECBinaryDialect);
}
case FunctionColumn:
return row.location->function;
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, 1, KFormat::MetricBinaryDialect),
+ m_format.formatByteSize(row.inclusiveCost.allocated, 1, KFormat::JEDECBinaryDialect),
row.inclusiveCost.allocations,
row.inclusiveCost.temporary, round(float(row.inclusiveCost.temporary) * 100.f * 100.f
/ std::max(int64_t(1), row.inclusiveCost.allocations))
/ 100.f,
- m_format.formatByteSize(row.inclusiveCost.peak, 1, KFormat::MetricBinaryDialect),
- m_format.formatByteSize(row.inclusiveCost.leaked, 1, KFormat::MetricBinaryDialect));
+ m_format.formatByteSize(row.inclusiveCost.peak, 1, KFormat::JEDECBinaryDialect),
+ m_format.formatByteSize(row.inclusiveCost.leaked, 1, KFormat::JEDECBinaryDialect));
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, 1, KFormat::MetricBinaryDialect),
+ m_format.formatByteSize(row.selfCost.allocated, 1, KFormat::JEDECBinaryDialect),
row.selfCost.allocations, row.selfCost.temporary,
round(float(row.selfCost.temporary) * 100.f * 100.f / std::max(int64_t(1), row.selfCost.allocations))
/ 100.f,
- m_format.formatByteSize(row.selfCost.peak, 1, KFormat::MetricBinaryDialect),
- m_format.formatByteSize(row.selfCost.leaked, 1, KFormat::MetricBinaryDialect));
+ m_format.formatByteSize(row.selfCost.peak, 1, KFormat::JEDECBinaryDialect),
+ m_format.formatByteSize(row.selfCost.leaked, 1, KFormat::JEDECBinaryDialect));
stream << '\n';
stream << "</pre></qt>";
return tooltip;
auto byteCost = [cost]() -> QString
{
KFormat format;
- const auto formatted = format.formatByteSize(cost, 1, KFormat::MetricBinaryDialect);
+ const auto formatted = format.formatByteSize(cost, 1, KFormat::JEDECBinaryDialect);
if (cost > 1024) {
return i18nc("%1: the formatted byte size, e.g. \"1.2KB\", %2: the raw byte size, e.g. \"1300\"",
"%1 (%2 bytes)", formatted, cost);
const QString customizedLabel(const QString& label) const override
{
KFormat format(QLocale::system());
- return format.formatByteSize(label.toDouble(), 1, KFormat::MetricBinaryDialect);
+ return format.formatByteSize(label.toDouble(), 1, KFormat::JEDECBinaryDialect);
}
};
}
i18nc("%1: peak consumption in bytes, %2: relative number, %3: "
"function label",
"%1 (%2%) contribution to peak consumption in %3 and below.",
- format.formatByteSize(m_cost, 1, KFormat::MetricBinaryDialect), fraction, function);
+ format.formatByteSize(m_cost, 1, KFormat::JEDECBinaryDialect), fraction, function);
break;
case PeakInstances:
tooltip =
break;
case Leaked:
tooltip = i18nc("%1: leaked bytes, %2: relative number, %3: function label", "%1 (%2%) leaked in %3 and below.",
- format.formatByteSize(m_cost, 1, KFormat::MetricBinaryDialect), fraction, function);
+ format.formatByteSize(m_cost, 1, KFormat::JEDECBinaryDialect), fraction, function);
break;
case Allocated:
tooltip = i18nc("%1: allocated bytes, %2: relative number, %3: function label",
"%1 (%2%) allocated in %3 and below.",
- format.formatByteSize(m_cost, 1, KFormat::MetricBinaryDialect), fraction, function);
+ format.formatByteSize(m_cost, 1, KFormat::JEDECBinaryDialect), fraction, function);
break;
}
label = i18n("%1 temporary allocations in total", totalCost);
break;
case Peak:
- label = i18n("%1 contribution to peak consumption", format.formatByteSize(totalCost, 1, KFormat::MetricBinaryDialect));
+ label = i18n("%1 contribution to peak consumption", format.formatByteSize(totalCost, 1, KFormat::JEDECBinaryDialect));
break;
case PeakInstances:
label = i18n("%1 contribution to peak number of instances", totalCost);
break;
case Leaked:
- label = i18n("%1 leaked in total", format.formatByteSize(totalCost, 1, KFormat::MetricBinaryDialect));
+ label = i18n("%1 leaked in total", format.formatByteSize(totalCost, 1, KFormat::JEDECBinaryDialect));
break;
case Allocated:
- label = i18n("%1 allocated in total", format.formatByteSize(totalCost, 1, KFormat::MetricBinaryDialect));
+ label = i18n("%1 allocated in total", format.formatByteSize(totalCost, 1, KFormat::JEDECBinaryDialect));
break;
}
auto rootItem = new FrameGraphicsItem(totalCost, type, label);
case Leaked:
case Allocated:
label = i18n("%1 (%2% of total of %3) matched by search.",
- format.formatByteSize(match.directCost, 1, KFormat::MetricBinaryDialect), costFraction,
- format.formatByteSize(m_rootItem->cost(), 1, KFormat::MetricBinaryDialect));
+ format.formatByteSize(match.directCost, 1, KFormat::JEDECBinaryDialect), costFraction,
+ format.formatByteSize(m_rootItem->cost(), 1, KFormat::JEDECBinaryDialect));
break;
}
m_searchResultsLabel->setText(label);
const QString customizedLabel(const QString& label) const override
{
KFormat format(QLocale::system());
- return format.formatByteSize(label.toDouble(), 1, KFormat::MetricBinaryDialect);
+ return format.formatByteSize(label.toDouble(), 1, KFormat::JEDECBinaryDialect);
}
};
// xgettext:no-c-format
<< i18n("<dt><b>total runtime</b>:</dt><dd>%1s</dd>", totalTimeS)
<< i18n("<dt><b>total system memory</b>:</dt><dd>%1</dd>",
- format.formatByteSize(data.totalSystemMemory, 1, KFormat::MetricBinaryDialect))
+ format.formatByteSize(data.totalSystemMemory, 1, KFormat::JEDECBinaryDialect))
<< "</dl></qt>";
}
qint64(data.cost.temporary / totalTimeS))
<< i18n("<dt><b>bytes allocated in total</b> (ignoring "
"deallocations):</dt><dd>%1 (%2/s)</dd>",
- format.formatByteSize(data.cost.allocated, 2, KFormat::MetricBinaryDialect),
- format.formatByteSize(data.cost.allocated / totalTimeS, 1, KFormat::MetricBinaryDialect))
+ format.formatByteSize(data.cost.allocated, 2, KFormat::JEDECBinaryDialect),
+ format.formatByteSize(data.cost.allocated / totalTimeS, 1, KFormat::JEDECBinaryDialect))
<< "</dl></qt>";
}
if (AccumulatedTraceData::isShowCoreCLRPartOption)
QTextStream stream(&textRight);
stream << "<qt><dl>" << i18n("<dt><b>peak heap memory consumption</b>:</dt><dd>%1 "
"after %2s</dd>",
- format.formatByteSize(data.cost.peak, 1, KFormat::MetricBinaryDialect),
+ format.formatByteSize(data.cost.peak, 1, KFormat::JEDECBinaryDialect),
peakTimeS)
<< i18n("<dt><b>peak RSS</b> (including heaptrack "
"overhead):</dt><dd>%1</dd>",
- format.formatByteSize(data.peakRSS, 1, KFormat::MetricBinaryDialect))
+ format.formatByteSize(data.peakRSS, 1, KFormat::JEDECBinaryDialect))
<< i18n("<dt><b>total memory leaked</b>:</dt><dd>%1</dd>",
- format.formatByteSize(data.cost.leaked, 1, KFormat::MetricBinaryDialect))
+ format.formatByteSize(data.cost.leaked, 1, KFormat::JEDECBinaryDialect))
<< "</dl></qt>";
}
if (role == SortRole || role == MaxCostRole) {
return static_cast<qint64>(abs(row->cost.allocated));
}
- return m_format.formatByteSize(row->cost.allocated, 1, KFormat::MetricBinaryDialect);
+ return m_format.formatByteSize(row->cost.allocated, 1, KFormat::JEDECBinaryDialect);
case AllocationsColumn:
if (role == SortRole || role == MaxCostRole) {
return static_cast<qint64>(abs(row->cost.allocations));
if (role == SortRole || role == MaxCostRole) {
return static_cast<qint64>(abs(row->cost.peak));
} else {
- return m_format.formatByteSize(row->cost.peak, 1, KFormat::MetricBinaryDialect);
+ return m_format.formatByteSize(row->cost.peak, 1, KFormat::JEDECBinaryDialect);
}
case PeakInstancesColumn:
if (role == SortRole || role == MaxCostRole) {
if (role == SortRole || role == MaxCostRole) {
return static_cast<qint64>(abs(row->cost.leaked));
} else {
- return m_format.formatByteSize(row->cost.leaked, 1, KFormat::MetricBinaryDialect);
+ return m_format.formatByteSize(row->cost.leaked, 1, KFormat::JEDECBinaryDialect);
}
case FunctionColumn:
return row->location->function;
const auto temporaryFractionTotal =
QString::number(double(row->cost.temporary) * 100. / m_maxCost.cost.temporary, 'g', 3);
stream << i18n("allocated: %1 (%2% of total)\n",
- format.formatByteSize(row->cost.allocated, 1, KFormat::MetricBinaryDialect), allocatedFraction);
+ format.formatByteSize(row->cost.allocated, 1, KFormat::JEDECBinaryDialect), allocatedFraction);
stream << i18n("peak contribution: %1 (%2% of total)\n",
- format.formatByteSize(row->cost.peak, 1, KFormat::MetricBinaryDialect), peakFraction);
+ format.formatByteSize(row->cost.peak, 1, KFormat::JEDECBinaryDialect), peakFraction);
stream << i18n("leaked: %1 (%2% of total)\n",
- format.formatByteSize(row->cost.leaked, 1, KFormat::MetricBinaryDialect), leakedFraction);
+ format.formatByteSize(row->cost.leaked, 1, KFormat::JEDECBinaryDialect), leakedFraction);
stream << i18n("allocations: %1 (%2% of total)\n", row->cost.allocations, allocationsFraction);
stream << i18n("temporary: %1 (%2% of allocations, %3% of total)\n", row->cost.temporary, temporaryFraction,
temporaryFractionTotal);
// handle negative values
return out << '-' << formatBytes(-data.m_bytes);
}
- if (data.m_bytes < 1000) {
+ if (data.m_bytes < 1024) {
// no fancy formatting for plain byte values, esp. no .00 factions
return out << data.m_bytes << 'B';
}
auto unit = units.begin();
size_t i = 0;
double bytes = data.m_bytes;
- while (i < units.size() - 1 && bytes > 1000.) {
- bytes /= 1000.;
+ while (i < units.size() - 1 && bytes > 1024.) {
+ bytes /= 1024.;
++i;
++unit;
}