diff options
author | Ulf Hermann <ulf.hermann@digia.com> | 2014-06-03 19:06:34 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@digia.com> | 2014-07-02 12:16:26 +0300 |
commit | da597356a1209a60fb2237f71bd4cc7b6165701b (patch) | |
tree | 7dca7a8c257a9c17c390151fdf19f5e6cf37a544 | |
parent | 6e4f3fcef91b19b2f536a27afc975a056c29375f (diff) |
Show scene graph events in correct thread for non-threaded render loop
If no polishAndSync event is ever seen we can be sure the application
is doing non-threaded rendering. In that case all other events belong
to the GUI thread rather than the render thread.
Change-Id: Ib5d0cbcdc7c45bff6303a1b4bfb1f5333830c7f7
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
-rw-r--r-- | plugins/qmlprofilerextension/scenegraphtimelinemodel.cpp | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/plugins/qmlprofilerextension/scenegraphtimelinemodel.cpp b/plugins/qmlprofilerextension/scenegraphtimelinemodel.cpp index 3f457476f7..59267d2c72 100644 --- a/plugins/qmlprofilerextension/scenegraphtimelinemodel.cpp +++ b/plugins/qmlprofilerextension/scenegraphtimelinemodel.cpp @@ -46,8 +46,8 @@ enum SceneGraphEventType { }; enum SceneGraphCategoryType { - SceneGraphRenderThread, SceneGraphGUIThread, + SceneGraphRenderThread, MaximumSceneGraphCategoryType }; @@ -59,6 +59,7 @@ class SceneGraphTimelineModel::SceneGraphTimelineModelPrivate : public: void addVP(QVariantList &l, QString label, qint64 time) const; private: + bool seenPolishAndSync; Q_DECLARE_PUBLIC(SceneGraphTimelineModel) }; @@ -67,25 +68,28 @@ SceneGraphTimelineModel::SceneGraphTimelineModel(QObject *parent) QLatin1String("SceneGraphTimeLineModel"), tr("Scene Graph"), QmlDebug::SceneGraphFrame, QmlDebug::MaximumRangeType, parent) { + Q_D(SceneGraphTimelineModel); + d->seenPolishAndSync = false; } int SceneGraphTimelineModel::rowCount() const { + Q_D(const SceneGraphTimelineModel); if (isEmpty()) return 1; - return 3; + return d->seenPolishAndSync ? 3 : 2; } int SceneGraphTimelineModel::getEventRow(int index) const { Q_D(const SceneGraphTimelineModel); - return d->range(index).sgEventType + 1; + return d->seenPolishAndSync ? d->range(index).sgEventType + 1 : 1; } int SceneGraphTimelineModel::getEventId(int index) const { Q_D(const SceneGraphTimelineModel); - return d->range(index).sgEventType; + return d->seenPolishAndSync ? d->range(index).sgEventType : SceneGraphGUIThread; } QColor SceneGraphTimelineModel::getColor(int index) const @@ -121,13 +125,22 @@ const QVariantList SceneGraphTimelineModel::getLabels() const Q_D(const SceneGraphTimelineModel); QVariantList result; + static QVariant renderThreadLabel(labelForSGType(SceneGraphRenderThread)); + static QVariant guiThreadLabel(labelForSGType(SceneGraphGUIThread)); + if (d->expanded && !isEmpty()) { - for (int i = 0; i < MaximumSceneGraphCategoryType; i++) { + { QVariantMap element; - - element.insert(QLatin1String("displayName"), QVariant(labelForSGType(i))); - element.insert(QLatin1String("description"), QVariant(labelForSGType(i))); - element.insert(QLatin1String("id"), QVariant(i)); + element.insert(QLatin1String("displayName"), guiThreadLabel); + element.insert(QLatin1String("description"), guiThreadLabel); + element.insert(QLatin1String("id"), SceneGraphGUIThread); + result << element; + } + if (d->seenPolishAndSync) { + QVariantMap element; + element.insert(QLatin1String("displayName"), renderThreadLabel); + element.insert(QLatin1String("description"), renderThreadLabel); + element.insert(QLatin1String("id"), SceneGraphRenderThread); result << element; } } @@ -155,7 +168,8 @@ const QVariantList SceneGraphTimelineModel::getEventDetails(int index) const { QVariantMap res; - res.insert(QLatin1String("title"), QVariant(labelForSGType(ev->sgEventType))); + res.insert(QLatin1String("title"), QVariant(labelForSGType( + d->seenPolishAndSync ? ev->sgEventType : SceneGraphGUIThread))); result << res; } @@ -252,6 +266,7 @@ void SceneGraphTimelineModel::loadData() break; } case SceneGraphPolishAndSync: { + d->seenPolishAndSync = true; // GUI thread SceneGraphEvent newEvent; newEvent.sgEventType = SceneGraphGUIThread; @@ -294,6 +309,7 @@ void SceneGraphTimelineModel::clear() { Q_D(SceneGraphTimelineModel); d->clear(); + d->seenPolishAndSync = false; d->expanded = false; d->modelManager->modelProxyCountUpdated(d->modelId, 0, 1); } |