diff options
Diffstat (limited to 'src/plugins/qmlprofiler')
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofiler.pro | 3 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofiler.qbs | 1 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofileranimationsmodel.cpp | 2 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofilerbasemodel.cpp | 102 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofilerbasemodel.h | 74 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofilerbasemodel_p.h | 56 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofilerdatamodel.cpp | 58 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofilerdatamodel.h | 23 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofilereventview.cpp | 12 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofilerrangemodel.cpp | 2 |
10 files changed, 72 insertions, 261 deletions
diff --git a/src/plugins/qmlprofiler/qmlprofiler.pro b/src/plugins/qmlprofiler/qmlprofiler.pro index 7cd7ccbf0c..e7e977b6c9 100644 --- a/src/plugins/qmlprofiler/qmlprofiler.pro +++ b/src/plugins/qmlprofiler/qmlprofiler.pro @@ -8,7 +8,6 @@ SOURCES += \ localqmlprofilerrunner.cpp \ qmlprofileranimationsmodel.cpp \ qmlprofilerattachdialog.cpp \ - qmlprofilerbasemodel.cpp \ qmlprofilerbindingloopsrenderpass.cpp \ qmlprofilerclientmanager.cpp \ qmlprofilerconfigwidget.cpp \ @@ -39,8 +38,6 @@ HEADERS += \ qmlprofiler_global.h \ qmlprofileranimationsmodel.h \ qmlprofilerattachdialog.h \ - qmlprofilerbasemodel.h \ - qmlprofilerbasemodel_p.h \ qmlprofilerbindingloopsrenderpass.h \ qmlprofilerclientmanager.h \ qmlprofilerconfigwidget.h \ diff --git a/src/plugins/qmlprofiler/qmlprofiler.qbs b/src/plugins/qmlprofiler/qmlprofiler.qbs index 3b97947663..dd8b618927 100644 --- a/src/plugins/qmlprofiler/qmlprofiler.qbs +++ b/src/plugins/qmlprofiler/qmlprofiler.qbs @@ -23,7 +23,6 @@ QtcPlugin { "qmlprofiler_global.h", "qmlprofileranimationsmodel.h", "qmlprofileranimationsmodel.cpp", "qmlprofilerattachdialog.cpp", "qmlprofilerattachdialog.h", - "qmlprofilerbasemodel.cpp", "qmlprofilerbasemodel.h", "qmlprofilerbasemodel_p.h", "qmlprofilerbindingloopsrenderpass.cpp","qmlprofilerbindingloopsrenderpass.h", "qmlprofilerclientmanager.cpp", "qmlprofilerclientmanager.h", "qmlprofilerconfigwidget.cpp", "qmlprofilerconfigwidget.h", diff --git a/src/plugins/qmlprofiler/qmlprofileranimationsmodel.cpp b/src/plugins/qmlprofiler/qmlprofileranimationsmodel.cpp index 9ae9db6261..0a938b1d72 100644 --- a/src/plugins/qmlprofiler/qmlprofileranimationsmodel.cpp +++ b/src/plugins/qmlprofiler/qmlprofileranimationsmodel.cpp @@ -202,7 +202,7 @@ QVariantMap QmlProfilerAnimationsModel::details(int index) const QVariantMap result; result.insert(QStringLiteral("displayName"), displayName()); - result.insert(tr("Duration"), QmlProfilerBaseModel::formatTime(duration(index))); + result.insert(tr("Duration"), QmlProfilerDataModel::formatTime(duration(index))); result.insert(tr("Framerate"), QString::fromLatin1("%1 FPS").arg(m_data[index].framerate)); result.insert(tr("Animations"), QString::fromLatin1("%1").arg(m_data[index].animationcount)); result.insert(tr("Context"), tr(selectionId(index) == QmlDebug::GuiThread ? "GUI Thread" : diff --git a/src/plugins/qmlprofiler/qmlprofilerbasemodel.cpp b/src/plugins/qmlprofiler/qmlprofilerbasemodel.cpp deleted file mode 100644 index 1b227edf94..0000000000 --- a/src/plugins/qmlprofiler/qmlprofilerbasemodel.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms and -** conditions see http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#include "qmlprofilerbasemodel.h" -#include "qmlprofilermodelmanager.h" -#include "qmlprofilerbasemodel_p.h" - -namespace QmlProfiler { - -QmlProfilerBaseModel::QmlProfilerBaseModel(Utils::FileInProjectFinder *fileFinder, - QmlProfilerModelManager *manager, - QmlProfilerBaseModelPrivate *dd) - : QObject(manager) - , d_ptr(dd) -{ - Q_D(QmlProfilerBaseModel); - d->modelManager = manager; - d->processingDone = false; - d->detailsRewriter = new QmlProfilerDetailsRewriter(this, fileFinder); - Q_ASSERT(d->modelManager); - d->modelId = d->modelManager->registerModelProxy(); - connect(d->detailsRewriter, SIGNAL(rewriteDetailsString(int,QString)), - this, SLOT(detailsChanged(int,QString))); - connect(d->detailsRewriter, SIGNAL(eventDetailsChanged()), - this, SLOT(detailsDone())); -} - -QmlProfilerBaseModel::~QmlProfilerBaseModel() -{ - Q_D(QmlProfilerBaseModel); - delete d->detailsRewriter; - delete d; -} - -void QmlProfilerBaseModel::clear() -{ - Q_D(QmlProfilerBaseModel); - d->detailsRewriter->clearRequests(); - d->modelManager->modelProxyCountUpdated(d->modelId, 0, 1); - d->processingDone = false; - emit changed(); -} - -bool QmlProfilerBaseModel::processingDone() const -{ - Q_D(const QmlProfilerBaseModel); - return d->processingDone; -} - -void QmlProfilerBaseModel::complete() -{ - Q_D(QmlProfilerBaseModel); - d->detailsRewriter->reloadDocuments(); -} - -QString QmlProfilerBaseModel::formatTime(qint64 timestamp) -{ - if (timestamp < 1e6) - return QString::number(timestamp/1e3f,'f',3) + trUtf8(" \xc2\xb5s"); - if (timestamp < 1e9) - return QString::number(timestamp/1e6f,'f',3) + tr(" ms"); - - return QString::number(timestamp/1e9f,'f',3) + tr(" s"); -} - -void QmlProfilerBaseModel::detailsDone() -{ - Q_D(QmlProfilerBaseModel); - emit changed(); - d->processingDone = true; - d->modelManager->modelProxyCountUpdated(d->modelId, isEmpty() ? 0 : 1, 1); - d->modelManager->complete(); -} - -} diff --git a/src/plugins/qmlprofiler/qmlprofilerbasemodel.h b/src/plugins/qmlprofiler/qmlprofilerbasemodel.h deleted file mode 100644 index 4196722bac..0000000000 --- a/src/plugins/qmlprofiler/qmlprofilerbasemodel.h +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms and -** conditions see http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef QMLPROFILERBASEMODEL_H -#define QMLPROFILERBASEMODEL_H - -#include "qmlprofiler_global.h" -#include "qmlprofilerdetailsrewriter.h" -#include <QObject> - -namespace QmlProfiler { - -class QmlProfilerModelManager; - -class QMLPROFILER_EXPORT QmlProfilerBaseModel : public QObject { - Q_OBJECT -public: - virtual ~QmlProfilerBaseModel(); - - virtual void complete(); - virtual void clear(); - virtual bool isEmpty() const = 0; - bool processingDone() const; - - static QString formatTime(qint64 timestamp); - -protected slots: - virtual void detailsChanged(int requestId, const QString &newString) = 0; - virtual void detailsDone(); - -signals: - void changed(); - -protected: - class QmlProfilerBaseModelPrivate; - QmlProfilerBaseModelPrivate *d_ptr; - - QmlProfilerBaseModel(Utils::FileInProjectFinder *fileFinder, QmlProfilerModelManager *manager, - QmlProfilerBaseModelPrivate *dd); - -private: - Q_DECLARE_PRIVATE(QmlProfilerBaseModel) -}; - -} - -#endif // QMLPROFILERBASEMODEL_H diff --git a/src/plugins/qmlprofiler/qmlprofilerbasemodel_p.h b/src/plugins/qmlprofiler/qmlprofilerbasemodel_p.h deleted file mode 100644 index 8d82fb4fe5..0000000000 --- a/src/plugins/qmlprofiler/qmlprofilerbasemodel_p.h +++ /dev/null @@ -1,56 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms and -** conditions see http://www.qt.io/terms-conditions. For further information -** use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -****************************************************************************/ - -#ifndef QMLPROFILERBASEMODEL_P_H -#define QMLPROFILERBASEMODEL_P_H - -#include "qmlprofilerbasemodel.h" - -namespace QmlProfiler { - -class QmlProfilerBaseModel::QmlProfilerBaseModelPrivate { -public: - QmlProfilerBaseModelPrivate(QmlProfilerBaseModel *qq) : q_ptr(qq) {} - virtual ~QmlProfilerBaseModelPrivate() {} - - QmlProfilerModelManager *modelManager; - int modelId; - bool processingDone; - Internal::QmlProfilerDetailsRewriter *detailsRewriter; - -protected: - QmlProfilerBaseModel *q_ptr; -private: - Q_DECLARE_PUBLIC(QmlProfilerBaseModel) -}; - -} - -#endif // QMLPROFILERBASEMODEL_P_H diff --git a/src/plugins/qmlprofiler/qmlprofilerdatamodel.cpp b/src/plugins/qmlprofiler/qmlprofilerdatamodel.cpp index 9a834cba9b..9e33df85e7 100644 --- a/src/plugins/qmlprofiler/qmlprofilerdatamodel.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerdatamodel.cpp @@ -29,9 +29,10 @@ ****************************************************************************/ #include "qmlprofilerdatamodel.h" -#include "qmlprofilerbasemodel_p.h" #include "qmlprofilermodelmanager.h" #include "qmlprofilernotesmodel.h" +#include "qmlprofilerdetailsrewriter.h" + #include <qmldebug/qmlprofilereventtypes.h> #include <utils/qtcassert.h> #include <QUrl> @@ -40,17 +41,17 @@ namespace QmlProfiler { -class QmlProfilerDataModel::QmlProfilerDataModelPrivate : - public QmlProfilerBaseModel::QmlProfilerBaseModelPrivate +class QmlProfilerDataModel::QmlProfilerDataModelPrivate { public: - QmlProfilerDataModelPrivate(QmlProfilerDataModel *qq) : QmlProfilerBaseModelPrivate(qq) {} QVector<QmlEventTypeData> eventTypes; QVector<QmlEventData> eventList; QVector<QmlEventNoteData> eventNotes; QHash<QmlEventTypeData, int> eventTypeIds; -private: - Q_DECLARE_PUBLIC(QmlProfilerDataModel) + + QmlProfilerModelManager *modelManager; + int modelId; + Internal::QmlProfilerDetailsRewriter *detailsRewriter; }; QString getDisplayName(const QmlProfilerDataModel::QmlEventTypeData &event) @@ -91,15 +92,41 @@ QString getInitialDetails(const QmlProfilerDataModel::QmlEventTypeData &event) return details; } +QString QmlProfilerDataModel::formatTime(qint64 timestamp) +{ + if (timestamp < 1e6) + return QString::number(timestamp/1e3f,'f',3) + trUtf8(" \xc2\xb5s"); + if (timestamp < 1e9) + return QString::number(timestamp/1e6f,'f',3) + tr(" ms"); + + return QString::number(timestamp/1e9f,'f',3) + tr(" s"); +} + QmlProfilerDataModel::QmlProfilerDataModel(Utils::FileInProjectFinder *fileFinder, - QmlProfilerModelManager *parent) - : QmlProfilerBaseModel(fileFinder, parent, new QmlProfilerDataModelPrivate(this)) + QmlProfilerModelManager *parent) : + QObject(parent), d_ptr(new QmlProfilerDataModelPrivate) { Q_D(QmlProfilerDataModel); + Q_ASSERT(parent); + d->modelManager = parent; + d->detailsRewriter = new QmlProfilerDetailsRewriter(this, fileFinder); + d->modelId = d->modelManager->registerModelProxy(); + connect(d->detailsRewriter, SIGNAL(rewriteDetailsString(int,QString)), + this, SLOT(detailsChanged(int,QString))); + connect(d->detailsRewriter, SIGNAL(eventDetailsChanged()), + this, SLOT(detailsDone())); + // The document loading is very expensive. d->modelManager->setProxyCountWeight(d->modelId, 4); } +QmlProfilerDataModel::~QmlProfilerDataModel() +{ + Q_D(QmlProfilerDataModel); + delete d->detailsRewriter; + delete d; +} + const QVector<QmlProfilerDataModel::QmlEventData> &QmlProfilerDataModel::getEvents() const { Q_D(const QmlProfilerDataModel); @@ -151,8 +178,9 @@ void QmlProfilerDataModel::clear() d->eventTypes.clear(); d->eventTypeIds.clear(); d->eventNotes.clear(); - // This call emits changed(). Don't emit it again here. - QmlProfilerBaseModel::clear(); + d->detailsRewriter->clearRequests(); + d->modelManager->modelProxyCountUpdated(d->modelId, 0, 1); + emit changed(); } bool QmlProfilerDataModel::isEmpty() const @@ -223,7 +251,7 @@ void QmlProfilerDataModel::complete() // Allow changed() event only after documents have been reloaded to avoid // unnecessary updates of child models. - QmlProfilerBaseModel::complete(); + d->detailsRewriter->reloadDocuments(); } void QmlProfilerDataModel::addQmlEvent(QmlDebug::Message message, QmlDebug::RangeType rangeType, @@ -280,4 +308,12 @@ void QmlProfilerDataModel::detailsChanged(int requestId, const QString &newStrin event->data = newString; } +void QmlProfilerDataModel::detailsDone() +{ + Q_D(QmlProfilerDataModel); + emit changed(); + d->modelManager->modelProxyCountUpdated(d->modelId, isEmpty() ? 0 : 1, 1); + d->modelManager->complete(); +} + } diff --git a/src/plugins/qmlprofiler/qmlprofilerdatamodel.h b/src/plugins/qmlprofiler/qmlprofilerdatamodel.h index a9833e397f..fee1b4bacc 100644 --- a/src/plugins/qmlprofiler/qmlprofilerdatamodel.h +++ b/src/plugins/qmlprofiler/qmlprofilerdatamodel.h @@ -31,12 +31,14 @@ #ifndef QMLPROFILERDATAMODEL_H #define QMLPROFILERDATAMODEL_H +#include "qmlprofilermodelmanager.h" + #include <qmldebug/qmlprofilereventtypes.h> -#include "qmlprofilerbasemodel.h" +#include <utils/fileinprojectfinder.h> namespace QmlProfiler { -class QMLPROFILER_EXPORT QmlProfilerDataModel : public QmlProfilerBaseModel +class QMLPROFILER_EXPORT QmlProfilerDataModel : public QObject { Q_OBJECT public: @@ -67,7 +69,11 @@ public: QString text; }; - explicit QmlProfilerDataModel(Utils::FileInProjectFinder *fileFinder, QmlProfilerModelManager *parent = 0); + static QString formatTime(qint64 timestamp); + + explicit QmlProfilerDataModel(Utils::FileInProjectFinder *fileFinder, + QmlProfilerModelManager *parent); + ~QmlProfilerDataModel(); const QVector<QmlEventData> &getEvents() const; const QVector<QmlEventTypeData> &getEventTypes() const; @@ -77,20 +83,25 @@ public: void setNoteData(const QVector<QmlEventNoteData> ¬es); int count() const; - virtual void clear(); - virtual bool isEmpty() const; - virtual void complete(); + void clear(); + bool isEmpty() const; + void complete(); void addQmlEvent(QmlDebug::Message message, QmlDebug::RangeType rangeType, int bindingType, qint64 startTime, qint64 duration, const QString &data, const QmlDebug::QmlEventLocation &location, qint64 ndata1, qint64 ndata2, qint64 ndata3, qint64 ndata4, qint64 ndata5); qint64 lastTimeMark() const; +signals: + void changed(); + protected slots: void detailsChanged(int requestId, const QString &newString); + void detailsDone(); private: class QmlProfilerDataModelPrivate; + QmlProfilerDataModelPrivate *d_ptr; Q_DECLARE_PRIVATE(QmlProfilerDataModel) }; diff --git a/src/plugins/qmlprofiler/qmlprofilereventview.cpp b/src/plugins/qmlprofiler/qmlprofilereventview.cpp index 5018c06327..3e235127df 100644 --- a/src/plugins/qmlprofiler/qmlprofilereventview.cpp +++ b/src/plugins/qmlprofiler/qmlprofilereventview.cpp @@ -653,7 +653,7 @@ void QmlProfilerEventsMainView::parseModelProxy() } if (d->m_fieldShown[TotalTime]) { - newRow << new EventsViewItem(QmlProfilerBaseModel::formatTime(stats.duration)); + newRow << new EventsViewItem(QmlProfilerDataModel::formatTime(stats.duration)); newRow.last()->setData(QVariant(stats.duration)); } @@ -663,22 +663,22 @@ void QmlProfilerEventsMainView::parseModelProxy() } if (d->m_fieldShown[TimePerCall]) { - newRow << new EventsViewItem(QmlProfilerBaseModel::formatTime(stats.timePerCall)); + newRow << new EventsViewItem(QmlProfilerDataModel::formatTime(stats.timePerCall)); newRow.last()->setData(QVariant(stats.timePerCall)); } if (d->m_fieldShown[MedianTime]) { - newRow << new EventsViewItem(QmlProfilerBaseModel::formatTime(stats.medianTime)); + newRow << new EventsViewItem(QmlProfilerDataModel::formatTime(stats.medianTime)); newRow.last()->setData(QVariant(stats.medianTime)); } if (d->m_fieldShown[MaxTime]) { - newRow << new EventsViewItem(QmlProfilerBaseModel::formatTime(stats.maxTime)); + newRow << new EventsViewItem(QmlProfilerDataModel::formatTime(stats.maxTime)); newRow.last()->setData(QVariant(stats.maxTime)); } if (d->m_fieldShown[MinTime]) { - newRow << new EventsViewItem(QmlProfilerBaseModel::formatTime(stats.minTime)); + newRow << new EventsViewItem(QmlProfilerDataModel::formatTime(stats.minTime)); newRow.last()->setData(QVariant(stats.minTime)); } @@ -938,7 +938,7 @@ void QmlProfilerEventRelativesView::rebuildTree( newRow << new EventsViewItem(type.displayName.isEmpty() ? tr("<bytecode>") : type.displayName); newRow << new EventsViewItem(QmlProfilerEventsMainView::nameForType(type.rangeType)); - newRow << new EventsViewItem(QmlProfilerBaseModel::formatTime(event.duration)); + newRow << new EventsViewItem(QmlProfilerDataModel::formatTime(event.duration)); newRow << new EventsViewItem(QString::number(event.calls)); newRow << new EventsViewItem(type.data.isEmpty() ? tr("Source code not available") : type.data); diff --git a/src/plugins/qmlprofiler/qmlprofilerrangemodel.cpp b/src/plugins/qmlprofiler/qmlprofilerrangemodel.cpp index 064474b1ab..700cdb7f05 100644 --- a/src/plugins/qmlprofiler/qmlprofilerrangemodel.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerrangemodel.cpp @@ -233,7 +233,7 @@ QVariantMap QmlProfilerRangeModel::details(int index) const result.insert(QStringLiteral("displayName"), tr(QmlProfilerModelManager::featureName(mainFeature()))); - result.insert(tr("Duration"), QmlProfilerBaseModel::formatTime(duration(index))); + result.insert(tr("Duration"), QmlProfilerDataModel::formatTime(duration(index))); result.insert(tr("Details"), types[id].data); result.insert(tr("Location"), types[id].displayName); |