From 04c10788f709731986a8f9ef941cc81647ee61ea Mon Sep 17 00:00:00 2001 From: Milian Wolff Date: Wed, 24 Feb 2016 01:41:32 +0100 Subject: [PATCH] Display the time when the memory peak was encountered. --- accumulatedtracedata.cpp | 2 ++ accumulatedtracedata.h | 1 + gui/parser.cpp | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/accumulatedtracedata.cpp b/accumulatedtracedata.cpp index d17fe4b..bf98a25 100644 --- a/accumulatedtracedata.cpp +++ b/accumulatedtracedata.cpp @@ -155,6 +155,7 @@ bool AccumulatedTraceData::read(istream& in) totalAllocations = 0; totalTemporary = 0; peak = 0; + peakTime = 0; leaked = 0; allocations.clear(); uint fileVersion = 0; @@ -248,6 +249,7 @@ bool AccumulatedTraceData::read(istream& in) leaked += info.size; if (leaked > peak) { peak = leaked; + peakTime = timeStamp; } handleAllocation(info, allocationIndex); diff --git a/accumulatedtracedata.h b/accumulatedtracedata.h index e00958c..5b55650 100644 --- a/accumulatedtracedata.h +++ b/accumulatedtracedata.h @@ -130,6 +130,7 @@ struct AccumulatedTraceData uint64_t peak = 0; uint64_t leaked = 0; uint64_t totalTime = 0; + uint64_t peakTime = 0; // our indices are sequentially increasing thus a new allocation can only ever // occur with an index larger than any other we encountered so far diff --git a/gui/parser.cpp b/gui/parser.cpp index c3deb12..ec44a78 100644 --- a/gui/parser.cpp +++ b/gui/parser.cpp @@ -300,6 +300,7 @@ QString generateSummary(const ParserData& data) KFormat format; QTextStream stream(&ret); const double totalTimeS = 0.001 * data.totalTime; + const double peakTimeS = 0.001 * data.peakTime; stream << "
" << i18n("
debuggee:
%1
", QString::fromStdString(data.debuggee)) // xgettext:no-c-format @@ -311,7 +312,7 @@ QString generateSummary(const ParserData& data) << i18n("
temporary allocations:
%1 (%2%, %3/s)
", data.totalTemporary, round(float(data.totalTemporary) * 100.f * 100.f / data.totalAllocations) / 100.f, quint64(data.totalTemporary / totalTimeS)) - << i18n("
peak heap memory consumption:
%1
", format.formatByteSize(data.peak)) + << i18n("
peak heap memory consumption:
%1 after %2s
", format.formatByteSize(data.peak), peakTimeS) << i18n("
total memory leaked:
%1
", format.formatByteSize(data.leaked)); stream << "
"; return ret; -- 2.7.4