-
Notifications
You must be signed in to change notification settings - Fork 255
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
closes #37
- Loading branch information
Showing
17 changed files
with
570 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
/* | ||
diffviewwidget.cpp | ||
This file is part of Hotspot, the Qt GUI for performance analysis. | ||
Copyright (C) 2021 Klarälvdalens Datakonsult AB, a KDAB Group company, [email protected] | ||
Author: Lieven Hey <[email protected]> | ||
Licensees holding valid commercial KDAB Hotspot licenses may use this file in | ||
accordance with Hotspot Commercial License Agreement provided with the Software. | ||
Contact [email protected] if any conditions of this licensing are not clear to you. | ||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 2 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include "diffviewwidget.h" | ||
|
||
#include <QLabel> | ||
#include <QProgressBar> | ||
|
||
#include "dockwidgetsetup.h" | ||
#include "filterandzoomstack.h" | ||
#include "models/treemodel.h" | ||
#include "parsers/perf/perfparser.h" | ||
#include "resultsutil.h" | ||
#include "settings.h" | ||
#include "timelinewidget.h" | ||
|
||
#include "ui_resultsdiffpage.h" | ||
|
||
DiffViewWidget::DiffViewWidget(QWidget* parent) | ||
: QWidget(parent) | ||
, ui(new Ui::ResultsDiffPage) | ||
, m_parserA(new PerfParser(this)) | ||
, m_parserB(new PerfParser(this)) | ||
, m_model(new DiffViewModel(this)) | ||
{ | ||
ui->setupUi(this); | ||
; | ||
ui->diffTreeView->setModel(m_model); | ||
ui->diffTreeView->sortByColumn(DiffViewModel::InitialSortColumn, Qt::DescendingOrder); | ||
ResultsUtil::setupCostDelegate<DiffViewModel>(m_model, ui->diffTreeView); | ||
|
||
auto repositionFilterBusyIndicator = [this] { | ||
auto geometry = m_filterBusyIndicator->geometry(); | ||
geometry.setWidth(width() / 2); | ||
geometry.moveCenter(rect().center()); | ||
m_filterBusyIndicator->setGeometry(geometry); | ||
}; | ||
|
||
connect(m_parserA, &PerfParser::parsingStarted, this, [this, repositionFilterBusyIndicator] { | ||
repositionFilterBusyIndicator(); | ||
m_filterBusyIndicator->setVisible(true); | ||
}); | ||
|
||
connect(m_parserB, &PerfParser::parsingStarted, this, [this, repositionFilterBusyIndicator] { | ||
repositionFilterBusyIndicator(); | ||
m_filterBusyIndicator->setVisible(true); | ||
}); | ||
|
||
connect(m_parserA, &PerfParser::parsingFinished, this, [this] { | ||
m_aFinished = true; | ||
if (m_bFinished) { | ||
m_filterBusyIndicator->setVisible(false); | ||
} | ||
}); | ||
|
||
connect(m_parserB, &PerfParser::parsingFinished, this, [this] { | ||
m_bFinished = true; | ||
if (m_aFinished) { | ||
m_filterBusyIndicator->setVisible(false); | ||
} | ||
}); | ||
|
||
connect(m_parserA, &PerfParser::topDownDataAvailable, this, [this](const Data::TopDownResults& results) { | ||
m_resultsA = results; | ||
|
||
const auto data = Data::DiffViewResults::fromTopDown(m_resultsA, m_resultsB); | ||
|
||
if (data.costsA.numTypes() > 0 && data.costsB.numTypes() > 0) { | ||
m_model->setData(data); | ||
} | ||
}); | ||
|
||
connect(m_parserB, &PerfParser::topDownDataAvailable, this, [this](const Data::TopDownResults& results) { | ||
m_resultsB = results; | ||
|
||
const auto data = Data::DiffViewResults::fromTopDown(m_resultsA, m_resultsB); | ||
|
||
if (data.costsA.numTypes() > 0 && data.costsB.numTypes() > 0) { | ||
m_model->setData(data); | ||
} | ||
}); | ||
|
||
{ | ||
m_filterBusyIndicator = new QWidget(this); | ||
m_filterBusyIndicator->setMinimumHeight(100); | ||
m_filterBusyIndicator->setVisible(false); | ||
m_filterBusyIndicator->setToolTip(tr("Filtering in progress, please wait...")); | ||
auto layout = new QVBoxLayout(m_filterBusyIndicator); | ||
layout->setAlignment(Qt::AlignCenter); | ||
auto progressBar = new QProgressBar(m_filterBusyIndicator); | ||
layout->addWidget(progressBar); | ||
progressBar->setMaximum(0); | ||
auto label = new QLabel(m_filterBusyIndicator->toolTip(), m_filterBusyIndicator); | ||
label->setAlignment(Qt::AlignCenter); | ||
layout->addWidget(label); | ||
} | ||
} | ||
|
||
DiffViewWidget::~DiffViewWidget() = default; | ||
|
||
void DiffViewWidget::open(const QString& a, const QString& b) | ||
{ | ||
auto settings = Settings::instance(); | ||
m_parserA->startParseFile(a, settings->sysroot(), settings->kallsyms(), settings->debugPaths(), | ||
settings->extraLibPaths(), settings->appPath(), settings->arch()); | ||
m_parserB->startParseFile(b, settings->sysroot(), settings->kallsyms(), settings->debugPaths(), | ||
settings->extraLibPaths(), settings->appPath(), settings->arch()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
diffviewwidget.h | ||
This file is part of Hotspot, the Qt GUI for performance analysis. | ||
Copyright (C) 2021 Klarälvdalens Datakonsult AB, a KDAB Group company, [email protected] | ||
Author: Lieven Hey <[email protected]> | ||
Licensees holding valid commercial KDAB Hotspot licenses may use this file in | ||
accordance with Hotspot Commercial License Agreement provided with the Software. | ||
Contact [email protected] if any conditions of this licensing are not clear to you. | ||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 2 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "data.h" | ||
#include <QWidget> | ||
|
||
class PerfParser; | ||
class DiffViewModel; | ||
class TimeLineWidget; | ||
class FilterAndZoomStack; | ||
|
||
namespace KDDockWidgets { | ||
class MainWindow; | ||
class DockWidget; | ||
} | ||
|
||
namespace Ui { | ||
class ResultsDiffPage; | ||
} | ||
|
||
class DiffViewWidget : public QWidget | ||
{ | ||
Q_OBJECT | ||
public: | ||
explicit DiffViewWidget(QWidget* parent = nullptr); | ||
~DiffViewWidget(); | ||
|
||
public slots: | ||
void open(const QString& a, const QString& b); | ||
|
||
private: | ||
QScopedPointer<Ui::ResultsDiffPage> ui; | ||
PerfParser* m_parserA; | ||
PerfParser* m_parserB; | ||
DiffViewModel* m_model; | ||
KDDockWidgets::MainWindow* m_contents; | ||
KDDockWidgets::DockWidget* m_timelineDockA; | ||
KDDockWidgets::DockWidget* m_timelineDockB; | ||
TimeLineWidget* m_timelineA; | ||
TimeLineWidget* m_timelineB; | ||
QWidget* m_filterBusyIndicator = nullptr; | ||
Data::TopDownResults m_resultsA; | ||
Data::TopDownResults m_resultsB; | ||
|
||
bool m_aFinished = false; | ||
bool m_bFinished = false; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.