From cde62980ca5be97d61c9c5800336e0b1f0077da3 Mon Sep 17 00:00:00 2001 From: Milian Wolff Date: Tue, 16 Jun 2015 01:37:37 +0200 Subject: [PATCH] Also show total bytes allocated over time. --- gui/chartmodel.cpp | 6 ++++-- gui/chartmodel.h | 1 + gui/mainwindow.cpp | 10 +++++++--- gui/mainwindow.ui | 9 +++++++-- gui/parser.cpp | 2 +- 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/gui/chartmodel.cpp b/gui/chartmodel.cpp index 40c74f4..8c7e33c 100644 --- a/gui/chartmodel.cpp +++ b/gui/chartmodel.cpp @@ -90,14 +90,16 @@ QVariant ChartModel::data(const QModelIndex& index, int role) const return data.timeStamp; } else if (index.column() == 1) { return data.leaked; - } else { + } else if (index.column() == 2) { return data.allocations; + } else { + return data.allocated; } } int ChartModel::columnCount(const QModelIndex& /*parent*/) const { - return 3; + return 4; } int ChartModel::rowCount(const QModelIndex& parent) const diff --git a/gui/chartmodel.h b/gui/chartmodel.h index 7f566fd..c292043 100644 --- a/gui/chartmodel.h +++ b/gui/chartmodel.h @@ -28,6 +28,7 @@ struct ChartRow quint64 timeStamp; quint64 leaked; quint64 allocations; + quint64 allocated; }; Q_DECLARE_TYPEINFO(ChartRow, Q_MOVABLE_TYPE); diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index d558bf8..783deb3 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -49,14 +49,18 @@ MainWindow::MainWindow(QWidget* parent) m_ui->loadingProgress->setMinimum(0); m_ui->loadingProgress->setMaximum(0); - auto memoryConsumptionProxy = new ChartProxy(i18n("Memory Consumption"), 1, this); - memoryConsumptionProxy->setSourceModel(m_chartModel); - m_ui->memoryConsumptionTab->setModel(memoryConsumptionProxy); + auto leakedProxy = new ChartProxy(i18n("Memory Leaked"), 1, this); + leakedProxy->setSourceModel(m_chartModel); + m_ui->leakedTab->setModel(leakedProxy); auto allocationsProxy = new ChartProxy(i18n("Memory Allocations"), 2, this); allocationsProxy->setSourceModel(m_chartModel); m_ui->allocationsTab->setModel(allocationsProxy); + auto allocatedProxy = new ChartProxy(i18n("Memory Allocated"), 3, this); + allocatedProxy->setSourceModel(m_chartModel); + m_ui->allocatedTab->setModel(allocatedProxy); + connect(m_parser, &Parser::bottomUpDataAvailable, m_bottomUpModel, &BottomUpModel::resetData); connect(m_parser, &Parser::chartDataAvailable, diff --git a/gui/mainwindow.ui b/gui/mainwindow.ui index d3a3091..97227e4 100644 --- a/gui/mainwindow.ui +++ b/gui/mainwindow.ui @@ -166,9 +166,9 @@ widget results - + - Memory Consumption + Leaked @@ -176,6 +176,11 @@ Allocations + + + Allocated + + diff --git a/gui/parser.cpp b/gui/parser.cpp index 87cb7d7..ecb89c7 100644 --- a/gui/parser.cpp +++ b/gui/parser.cpp @@ -40,7 +40,7 @@ struct ParserData final : public AccumulatedTraceData void handleTimeStamp(size_t /*newStamp*/, size_t oldStamp) { - chartData.push_back({oldStamp, timestampData.leaked, totalAllocations}); + chartData.push_back({oldStamp, timestampData.leaked, totalAllocations, totalAllocated}); timestampData = {}; } -- 2.7.4