Display the time when the memory peak was encountered.
authorMilian Wolff <mail@milianw.de>
Wed, 24 Feb 2016 00:41:32 +0000 (01:41 +0100)
committerMilian Wolff <mail@milianw.de>
Wed, 24 Feb 2016 00:41:32 +0000 (01:41 +0100)
accumulatedtracedata.cpp
accumulatedtracedata.h
gui/parser.cpp

index d17fe4b..bf98a25 100644 (file)
@@ -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);
index e00958c..5b55650 100644 (file)
@@ -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
index c3deb12..ec44a78 100644 (file)
@@ -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 << "<qt><dl>"
            << i18n("<dt><b>debuggee</b>:</dt><dd style='font-family:monospace;'>%1</dd>", QString::fromStdString(data.debuggee))
            // xgettext:no-c-format
@@ -311,7 +312,7 @@ QString generateSummary(const ParserData& data)
            << i18n("<dt><b>temporary allocations</b>:</dt><dd>%1 (%2%, %3/s)</dd>",
                    data.totalTemporary, round(float(data.totalTemporary) * 100.f * 100.f / data.totalAllocations) / 100.f,
                    quint64(data.totalTemporary / totalTimeS))
-           << i18n("<dt><b>peak heap memory consumption</b>:</dt><dd>%1</dd>", format.formatByteSize(data.peak))
+           << i18n("<dt><b>peak heap memory consumption</b>:</dt><dd>%1 after %2s</dd>", format.formatByteSize(data.peak), peakTimeS)
            << i18n("<dt><b>total memory leaked</b>:</dt><dd>%1</dd>", format.formatByteSize(data.leaked));
     stream << "</dl></qt>";
     return ret;