From: Milian Wolff Date: Wed, 16 Dec 2015 12:37:22 +0000 (+0100) Subject: Show data as soon as it is available. X-Git-Tag: submit/tizen/20180620.112952^2~231 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a137921c9d502c36a3d4e6cea0287c21f3948fb6;p=sdk%2Ftools%2Fheaptrack.git Show data as soon as it is available. This way one can investigate the data table while waiting for the charts to be built up, which can take some time for large data files. --- diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 87c6514..e623f83 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -26,6 +26,7 @@ #include #include +#include #include "treemodel.h" #include "treeproxy.h" @@ -39,8 +40,6 @@ using namespace std; MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent) , m_ui(new Ui::MainWindow) - , m_bottomUpModel(new TreeModel(this)) - , m_topDownModel(new TreeModel(this)) , m_parser(new Parser(this)) { m_ui->setupUi(this); @@ -50,6 +49,9 @@ MainWindow::MainWindow(QWidget* parent) m_ui->loadingProgress->setMinimum(0); m_ui->loadingProgress->setMaximum(0); + auto bottomUpModel = new TreeModel(this); + auto topDownModel = new TreeModel(this); + auto consumedModel = new ChartModel(ChartModel::Consumed, this); m_ui->consumedTab->setModel(consumedModel); auto allocationsModel = new ChartModel(ChartModel::Allocations, this); @@ -61,33 +63,67 @@ MainWindow::MainWindow(QWidget* parent) auto sizeHistogramModel = new HistogramModel(this); m_ui->sizesTab->setModel(sizeHistogramModel); + m_ui->tabWidget->setTabEnabled(m_ui->tabWidget->indexOf(m_ui->consumedTab), false); + m_ui->tabWidget->setTabEnabled(m_ui->tabWidget->indexOf(m_ui->allocationsTab), false); + m_ui->tabWidget->setTabEnabled(m_ui->tabWidget->indexOf(m_ui->allocatedTab), false); + m_ui->tabWidget->setTabEnabled(m_ui->tabWidget->indexOf(m_ui->temporaryTab), false); + m_ui->tabWidget->setTabEnabled(m_ui->tabWidget->indexOf(m_ui->sizesTab), false); + m_ui->tabWidget->setTabEnabled(m_ui->tabWidget->indexOf(m_ui->topDownTab), false); + m_ui->tabWidget->setTabEnabled(m_ui->tabWidget->indexOf(m_ui->flameGraphTab), false); + connect(m_parser, &Parser::bottomUpDataAvailable, - m_bottomUpModel, &TreeModel::resetData); + this, [=] (const TreeData& data) { + bottomUpModel->resetData(data); + m_ui->flameGraphTab->setBottomUpData(data); + m_ui->progressLabel->setAlignment(Qt::AlignVCenter | Qt::AlignRight); + statusBar()->addWidget(m_ui->progressLabel, 1); + statusBar()->addWidget(m_ui->loadingProgress); + m_ui->pages->setCurrentWidget(m_ui->resultsPage); + }); connect(m_parser, &Parser::topDownDataAvailable, - m_topDownModel, &TreeModel::resetData); + this, [=] (const TreeData& data) { + topDownModel->resetData(data); + m_ui->flameGraphTab->setTopDownData(data); + m_ui->tabWidget->setTabEnabled(m_ui->tabWidget->indexOf(m_ui->topDownTab), true); + m_ui->tabWidget->setTabEnabled(m_ui->tabWidget->indexOf(m_ui->flameGraphTab), true); + }); connect(m_parser, &Parser::consumedChartDataAvailable, - consumedModel, &ChartModel::resetData); + this, [=] (const ChartData& data) { + consumedModel->resetData(data); + m_ui->tabWidget->setTabEnabled(m_ui->tabWidget->indexOf(m_ui->consumedTab), true); + }); connect(m_parser, &Parser::allocatedChartDataAvailable, - allocatedModel, &ChartModel::resetData); + this, [=] (const ChartData& data) { + allocatedModel->resetData(data); + m_ui->tabWidget->setTabEnabled(m_ui->tabWidget->indexOf(m_ui->allocatedTab), true); + }); connect(m_parser, &Parser::allocationsChartDataAvailable, - allocationsModel, &ChartModel::resetData); + this, [=] (const ChartData& data) { + allocationsModel->resetData(data); + m_ui->tabWidget->setTabEnabled(m_ui->tabWidget->indexOf(m_ui->allocationsTab), true); + }); connect(m_parser, &Parser::temporaryChartDataAvailable, - temporaryModel, &ChartModel::resetData); + this, [=] (const ChartData& data) { + temporaryModel->resetData(data); + m_ui->tabWidget->setTabEnabled(m_ui->tabWidget->indexOf(m_ui->temporaryTab), true); + }); connect(m_parser, &Parser::sizeHistogramDataAvailable, - sizeHistogramModel, &HistogramModel::resetData); + this, [=] (const HistogramData& data) { + sizeHistogramModel->resetData(data); + m_ui->tabWidget->setTabEnabled(m_ui->tabWidget->indexOf(m_ui->sizesTab), true); + }); connect(m_parser, &Parser::summaryAvailable, m_ui->summary, &QLabel::setText); connect(m_parser, &Parser::progressMessageAvailable, m_ui->progressLabel, &QLabel::setText); - connect(m_parser, &Parser::topDownDataAvailable, - m_ui->flameGraphTab, &FlameGraph::setTopDownData); - connect(m_parser, &Parser::bottomUpDataAvailable, - m_ui->flameGraphTab, &FlameGraph::setBottomUpData); connect(m_parser, &Parser::finished, - this, [&] { m_ui->pages->setCurrentWidget(m_ui->resultsPage); }); + this, [=] { + statusBar()->removeWidget(m_ui->progressLabel); + statusBar()->removeWidget(m_ui->loadingProgress); + }); - auto bottomUpProxy = new TreeProxy(m_bottomUpModel); - bottomUpProxy->setSourceModel(m_bottomUpModel); + auto bottomUpProxy = new TreeProxy(bottomUpModel); + bottomUpProxy->setSourceModel(bottomUpModel); bottomUpProxy->setSortRole(TreeModel::SortRole); m_ui->bottomUpResults->setModel(bottomUpProxy); m_ui->bottomUpResults->hideColumn(TreeModel::FunctionColumn); @@ -102,8 +138,8 @@ MainWindow::MainWindow(QWidget* parent) connect(m_ui->bottomUpFilterModule, &QLineEdit::textChanged, bottomUpProxy, &TreeProxy::setModuleFilter); - auto topDownProxy = new TreeProxy(m_topDownModel); - topDownProxy->setSourceModel(m_topDownModel); + auto topDownProxy = new TreeProxy(topDownModel); + topDownProxy->setSourceModel(topDownModel); topDownProxy->setSortRole(TreeModel::SortRole); m_ui->topDownResults->setModel(topDownProxy); m_ui->topDownResults->hideColumn(TreeModel::FunctionColumn); diff --git a/gui/mainwindow.h b/gui/mainwindow.h index 85a98ae..eec98d2 100644 --- a/gui/mainwindow.h +++ b/gui/mainwindow.h @@ -43,8 +43,6 @@ public slots: private: QScopedPointer m_ui; - TreeModel* m_bottomUpModel; - TreeModel* m_topDownModel; Parser* m_parser; }; diff --git a/gui/parser.cpp b/gui/parser.cpp index bf97556..6acb7c9 100644 --- a/gui/parser.cpp +++ b/gui/parser.cpp @@ -503,16 +503,17 @@ void Parser::parse(const QString& path) emit progressMessageAvailable(i18n("merging allocations...")); // merge allocations before modifying the data again const auto mergedAllocations = mergeAllocations(*data); - emit progressMessageAvailable(i18n("building size histogram...")); + emit bottomUpDataAvailable(mergedAllocations); + // also calculate the size histogram + emit progressMessageAvailable(i18n("building size histogram...")); const auto sizeHistogram = buildSizeHistogram(*data); + emit sizeHistogramDataAvailable(sizeHistogram); // now data can be modified again for the chart data evaluation emit progressMessageAvailable(i18n("building charts...")); auto parallel = new Collection; *parallel << make_job([this, mergedAllocations, sizeHistogram]() { - emit bottomUpDataAvailable(mergedAllocations); - emit sizeHistogramDataAvailable(sizeHistogram); const auto topDownData = toTopDownData(mergedAllocations); emit topDownDataAvailable(topDownData); }) << make_job([this, data, stdPath]() {