forked from qt-creator/qt-creator
QmlProfiler: Remove now-unused members from statistics
Change-Id: Ibf56f405dc51a82d0f56ab300905b1137375d5c0 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -38,7 +38,6 @@ class QMLPROFILER_EXPORT QmlProfilerEventsView : public QWidget
|
||||
Q_OBJECT
|
||||
public:
|
||||
QmlProfilerEventsView(QWidget *parent = 0) : QWidget(parent) {}
|
||||
virtual void clear() {}
|
||||
|
||||
virtual void selectByTypeId(int typeIndex) = 0;
|
||||
virtual void onVisibleFeaturesChanged(quint64 features) = 0;
|
||||
|
@@ -30,15 +30,11 @@
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QHash>
|
||||
#include <QSet>
|
||||
#include <QString>
|
||||
|
||||
#include <functional>
|
||||
|
||||
namespace QmlProfiler {
|
||||
|
||||
QString QmlProfilerStatisticsModel::nameForType(RangeType typeNumber)
|
||||
QString nameForType(RangeType typeNumber)
|
||||
{
|
||||
switch (typeNumber) {
|
||||
case Painting: return QmlProfilerStatisticsModel::tr("Painting");
|
||||
@@ -125,22 +121,6 @@ bool QmlProfilerStatisticsModel::isRestrictedToRange() const
|
||||
return m_modelManager->isRestrictedToRange();
|
||||
}
|
||||
|
||||
const QVector<QmlProfilerStatisticsModel::QmlEventStats> &
|
||||
QmlProfilerStatisticsModel::getData() const
|
||||
{
|
||||
return m_data;
|
||||
}
|
||||
|
||||
const QVector<QmlEventType> &QmlProfilerStatisticsModel::getTypes() const
|
||||
{
|
||||
return m_modelManager->eventTypes();
|
||||
}
|
||||
|
||||
const QHash<int, QString> &QmlProfilerStatisticsModel::getNotes() const
|
||||
{
|
||||
return m_notes;
|
||||
}
|
||||
|
||||
QStringList QmlProfilerStatisticsModel::details(int typeIndex) const
|
||||
{
|
||||
QString data;
|
||||
@@ -447,8 +427,6 @@ void QmlProfilerStatisticsModel::notesChanged(int typeIndex)
|
||||
emit dataChanged(index(typeIndex, 0), index(typeIndex, MainDetails), noteRoles);
|
||||
}
|
||||
}
|
||||
|
||||
emit notesAvailable(typeIndex);
|
||||
}
|
||||
|
||||
void QmlProfilerStatisticsModel::loadEvent(const QmlEvent &event, const QmlEventType &type)
|
||||
@@ -502,19 +480,11 @@ void QmlProfilerStatisticsModel::loadEvent(const QmlEvent &event, const QmlEvent
|
||||
m_callersModel->loadEvent(type.rangeType(), event, isRecursive);
|
||||
}
|
||||
|
||||
|
||||
void QmlProfilerStatisticsModel::finalize()
|
||||
{
|
||||
for (QmlEventStats &stats : m_data)
|
||||
stats.finalize();
|
||||
endResetModel();
|
||||
|
||||
emit dataAvailable();
|
||||
}
|
||||
|
||||
int QmlProfilerStatisticsModel::count() const
|
||||
{
|
||||
return m_data.count();
|
||||
}
|
||||
|
||||
QmlProfilerStatisticsRelativesModel::QmlProfilerStatisticsRelativesModel(
|
||||
@@ -526,28 +496,6 @@ QmlProfilerStatisticsRelativesModel::QmlProfilerStatisticsRelativesModel(
|
||||
QTC_CHECK(modelManager);
|
||||
QTC_CHECK(statisticsModel);
|
||||
statisticsModel->setRelativesModel(this, relation);
|
||||
|
||||
// Load the child models whenever the parent model is done to get the filtering for JS/QML
|
||||
// right.
|
||||
connect(statisticsModel, &QmlProfilerStatisticsModel::dataAvailable,
|
||||
this, &QmlProfilerStatisticsRelativesModel::dataAvailable);
|
||||
}
|
||||
|
||||
const QVector<QmlProfilerStatisticsRelativesModel::QmlStatisticsRelativesData> &
|
||||
QmlProfilerStatisticsRelativesModel::getData(int typeId) const
|
||||
{
|
||||
auto it = m_data.find(typeId);
|
||||
if (it != m_data.end()) {
|
||||
return it.value();
|
||||
} else {
|
||||
static const QVector<QmlStatisticsRelativesData> emptyVector;
|
||||
return emptyVector;
|
||||
}
|
||||
}
|
||||
|
||||
const QVector<QmlEventType> &QmlProfilerStatisticsRelativesModel::getTypes() const
|
||||
{
|
||||
return m_modelManager->eventTypes();
|
||||
}
|
||||
|
||||
bool operator<(const QmlProfilerStatisticsRelativesModel::QmlStatisticsRelativesData &a,
|
||||
@@ -597,11 +545,6 @@ void QmlProfilerStatisticsRelativesModel::loadEvent(RangeType type, const QmlEve
|
||||
}
|
||||
}
|
||||
|
||||
QmlProfilerStatisticsRelation QmlProfilerStatisticsRelativesModel::relation() const
|
||||
{
|
||||
return m_relation;
|
||||
}
|
||||
|
||||
int QmlProfilerStatisticsRelativesModel::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
return parent.isValid() ? 0 : m_data[m_relativeTypeIndex].count();
|
||||
@@ -687,7 +630,7 @@ QVariant QmlProfilerStatisticsRelativesModel::data(const QModelIndex &index, int
|
||||
case RelativeLocation:
|
||||
return type.displayName().isEmpty() ? tr("<bytecode>") : type.displayName();
|
||||
case RelativeType:
|
||||
return QmlProfilerStatisticsModel::nameForType(type.rangeType());
|
||||
return nameForType(type.rangeType());
|
||||
case RelativeTotalTime:
|
||||
return Timeline::formatTime(stats.duration);
|
||||
case RelativeCallCount:
|
||||
@@ -711,7 +654,7 @@ QVariant QmlProfilerStatisticsRelativesModel::headerData(int section, Qt::Orient
|
||||
|
||||
switch (section) {
|
||||
case RelativeLocation:
|
||||
return relation() == QmlProfilerStatisticsCallees ? tr("Callee") : tr("Caller");
|
||||
return m_relation == QmlProfilerStatisticsCallees ? tr("Callee") : tr("Caller");
|
||||
case RelativeType:
|
||||
return tr("Type");
|
||||
case RelativeTotalTime:
|
||||
@@ -719,7 +662,7 @@ QVariant QmlProfilerStatisticsRelativesModel::headerData(int section, Qt::Orient
|
||||
case RelativeCallCount:
|
||||
return tr("Calls");
|
||||
case RelativeDetails:
|
||||
return relation() == QmlProfilerStatisticsCallees ? tr("Callee Description")
|
||||
return m_relation == QmlProfilerStatisticsCallees ? tr("Callee Description")
|
||||
: tr("Caller Description");
|
||||
case MaxRelativeField:
|
||||
default:
|
||||
@@ -742,11 +685,6 @@ bool QmlProfilerStatisticsRelativesModel::setData(const QModelIndex &index, cons
|
||||
}
|
||||
}
|
||||
|
||||
int QmlProfilerStatisticsRelativesModel::count() const
|
||||
{
|
||||
return m_data.count();
|
||||
}
|
||||
|
||||
void QmlProfilerStatisticsRelativesModel::clear()
|
||||
{
|
||||
beginResetModel();
|
||||
|
@@ -27,8 +27,6 @@
|
||||
|
||||
#include "qmlprofilernotesmodel.h"
|
||||
#include "qmlprofilereventtypes.h"
|
||||
#include "qmleventlocation.h"
|
||||
#include "qmlprofilerconstants.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
@@ -85,8 +83,6 @@ class QmlProfilerStatisticsModel : public QAbstractTableModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
static QString nameForType(RangeType typeNumber);
|
||||
|
||||
struct QmlEventStats {
|
||||
std::vector<qint64> durations;
|
||||
qint64 total = 0;
|
||||
@@ -130,9 +126,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
double durationPercent(int typeId) const;
|
||||
double durationSelfPercent(int typeId) const;
|
||||
|
||||
QmlProfilerStatisticsModel(QmlProfilerModelManager *modelManager);
|
||||
~QmlProfilerStatisticsModel() override = default;
|
||||
|
||||
@@ -141,12 +134,7 @@ public:
|
||||
|
||||
QStringList details(int typeIndex) const;
|
||||
QString summary(const QVector<int> &typeIds) const;
|
||||
const QVector<QmlEventStats> &getData() const;
|
||||
const QVector<QmlEventType> &getTypes() const;
|
||||
const QHash<int, QString> &getNotes() const;
|
||||
qint64 rootDuration() const { return m_rootDuration; }
|
||||
|
||||
int count() const;
|
||||
void clear();
|
||||
|
||||
void setRelativesModel(QmlProfilerStatisticsRelativesModel *childModel,
|
||||
@@ -157,10 +145,6 @@ public:
|
||||
QVariant data(const QModelIndex &index, int role) const override;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
||||
|
||||
signals:
|
||||
void dataAvailable();
|
||||
void notesAvailable(int typeIndex);
|
||||
|
||||
private:
|
||||
void loadEvent(const QmlEvent &event, const QmlEventType &type);
|
||||
void finalize();
|
||||
@@ -170,6 +154,9 @@ private:
|
||||
|
||||
QVariant dataForMainEntry(const QModelIndex &index, int role) const;
|
||||
|
||||
double durationPercent(int typeId) const;
|
||||
double durationSelfPercent(int typeId) const;
|
||||
|
||||
QVector<QmlEventStats> m_data;
|
||||
|
||||
QPointer<QmlProfilerStatisticsRelativesModel> m_calleesModel;
|
||||
@@ -204,16 +191,9 @@ public:
|
||||
QmlProfilerStatisticsModel *statisticsModel,
|
||||
QmlProfilerStatisticsRelation relation);
|
||||
|
||||
int count() const;
|
||||
void clear();
|
||||
|
||||
const QVector<QmlStatisticsRelativesData> &getData(int typeId) const;
|
||||
const QVector<QmlEventType> &getTypes() const;
|
||||
|
||||
void loadEvent(RangeType type, const QmlEvent &event, bool isRecursive);
|
||||
|
||||
QmlProfilerStatisticsRelation relation() const;
|
||||
|
||||
int rowCount(const QModelIndex &parent) const override;
|
||||
int columnCount(const QModelIndex &parent) const override;
|
||||
QVariant data(const QModelIndex &index, int role) const override;
|
||||
@@ -221,10 +201,7 @@ public:
|
||||
|
||||
bool setData(const QModelIndex &index, const QVariant &value, int role) override;
|
||||
|
||||
signals:
|
||||
void dataAvailable();
|
||||
|
||||
protected:
|
||||
private:
|
||||
QVariant dataForMainEntry(qint64 totalDuration, int role, int column) const;
|
||||
|
||||
QHash<int, QVector<QmlStatisticsRelativesData>> m_data;
|
||||
|
@@ -24,21 +24,16 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "qmlprofilerstatisticsview.h"
|
||||
#include "qmlprofilerviewmanager.h"
|
||||
#include "qmlprofilertool.h"
|
||||
|
||||
#include <coreplugin/minisplitter.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <timeline/timelineformattime.h>
|
||||
|
||||
#include <QUrl>
|
||||
#include <QHash>
|
||||
#include <QHeaderView>
|
||||
#include <QApplication>
|
||||
#include <QClipboard>
|
||||
#include <QContextMenuEvent>
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QMenu>
|
||||
#include <QSortFilterProxyModel>
|
||||
|
||||
@@ -130,11 +125,6 @@ QStringList QmlProfilerStatisticsView::details(int typeId) const
|
||||
return m_mainView->details(typeId);
|
||||
}
|
||||
|
||||
QModelIndex QmlProfilerStatisticsView::selectedModelIndex() const
|
||||
{
|
||||
return m_mainView->selectedModelIndex();
|
||||
}
|
||||
|
||||
void QmlProfilerStatisticsView::contextMenuEvent(QContextMenuEvent *ev)
|
||||
{
|
||||
QMenu menu;
|
||||
@@ -151,13 +141,13 @@ void QmlProfilerStatisticsView::contextMenuEvent(QContextMenuEvent *ev)
|
||||
|
||||
if (mouseOnTable(position)) {
|
||||
menu.addSeparator();
|
||||
if (selectedModelIndex().isValid())
|
||||
if (m_mainView->selectedModelIndex().isValid())
|
||||
copyRowAction = menu.addAction(tr("Copy Row"));
|
||||
copyTableAction = menu.addAction(tr("Copy Table"));
|
||||
|
||||
showExtendedStatsAction = menu.addAction(tr("Extended Event Statistics"));
|
||||
showExtendedStatsAction->setCheckable(true);
|
||||
showExtendedStatsAction->setChecked(showExtendedStatistics());
|
||||
showExtendedStatsAction->setChecked(m_mainView->showExtendedStatistics());
|
||||
}
|
||||
|
||||
menu.addSeparator();
|
||||
@@ -169,31 +159,23 @@ void QmlProfilerStatisticsView::contextMenuEvent(QContextMenuEvent *ev)
|
||||
|
||||
if (selectedAction) {
|
||||
if (selectedAction == copyRowAction)
|
||||
copyRowToClipboard();
|
||||
m_mainView->copyRowToClipboard();
|
||||
if (selectedAction == copyTableAction)
|
||||
copyTableToClipboard();
|
||||
m_mainView->copyTableToClipboard();
|
||||
if (selectedAction == getGlobalStatsAction)
|
||||
emit showFullRange();
|
||||
if (selectedAction == showExtendedStatsAction)
|
||||
setShowExtendedStatistics(!showExtendedStatistics());
|
||||
m_mainView->setShowExtendedStatistics(m_mainView->showExtendedStatistics());
|
||||
}
|
||||
}
|
||||
|
||||
bool QmlProfilerStatisticsView::mouseOnTable(const QPoint &position) const
|
||||
{
|
||||
QPoint tableTopLeft = m_mainView->mapToGlobal(QPoint(0,0));
|
||||
QPoint tableBottomRight = m_mainView->mapToGlobal(QPoint(m_mainView->width(), m_mainView->height()));
|
||||
return (position.x() >= tableTopLeft.x() && position.x() <= tableBottomRight.x() && position.y() >= tableTopLeft.y() && position.y() <= tableBottomRight.y());
|
||||
}
|
||||
|
||||
void QmlProfilerStatisticsView::copyTableToClipboard() const
|
||||
{
|
||||
m_mainView->copyTableToClipboard();
|
||||
}
|
||||
|
||||
void QmlProfilerStatisticsView::copyRowToClipboard() const
|
||||
{
|
||||
m_mainView->copyRowToClipboard();
|
||||
QPoint tableBottomRight = m_mainView->mapToGlobal(QPoint(m_mainView->width(),
|
||||
m_mainView->height()));
|
||||
return position.x() >= tableTopLeft.x() && position.x() <= tableBottomRight.x()
|
||||
&& position.y() >= tableTopLeft.y() && position.y() <= tableBottomRight.y();
|
||||
}
|
||||
|
||||
void QmlProfilerStatisticsView::selectByTypeId(int typeIndex)
|
||||
@@ -207,16 +189,6 @@ void QmlProfilerStatisticsView::onVisibleFeaturesChanged(quint64 features)
|
||||
m_mainView->restrictToFeatures(features);
|
||||
}
|
||||
|
||||
void QmlProfilerStatisticsView::setShowExtendedStatistics(bool show)
|
||||
{
|
||||
m_mainView->setShowExtendedStatistics(show);
|
||||
}
|
||||
|
||||
bool QmlProfilerStatisticsView::showExtendedStatistics() const
|
||||
{
|
||||
return m_mainView->showExtendedStatistics();
|
||||
}
|
||||
|
||||
QmlProfilerStatisticsMainView::QmlProfilerStatisticsMainView(QmlProfilerStatisticsModel *model) :
|
||||
m_model(model)
|
||||
{
|
||||
|
@@ -30,11 +30,12 @@
|
||||
#include "qmlprofilereventsview.h"
|
||||
#include "qmlprofilereventtypes.h"
|
||||
|
||||
#include <debugger/analyzer/analyzermanager.h>
|
||||
#include <utils/itemviews.h>
|
||||
|
||||
#include <QPointer>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace QmlProfiler {
|
||||
namespace Internal {
|
||||
|
||||
@@ -63,8 +64,6 @@ private:
|
||||
void copyTableToClipboard() const;
|
||||
void copyRowToClipboard() const;
|
||||
bool mouseOnTable(const QPoint &position) const;
|
||||
void setShowExtendedStatistics(bool show);
|
||||
bool showExtendedStatistics() const;
|
||||
|
||||
std::unique_ptr<QmlProfilerStatisticsMainView> m_mainView;
|
||||
std::unique_ptr<QmlProfilerStatisticsRelativesView> m_calleesView;
|
||||
|
@@ -104,8 +104,6 @@ QmlProfilerViewManager::QmlProfilerViewManager(QObject *parent,
|
||||
void QmlProfilerViewManager::clear()
|
||||
{
|
||||
m_traceView->clear();
|
||||
m_flameGraphView->clear();
|
||||
m_statisticsView->clear();
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
Reference in New Issue
Block a user