aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@digia.com>2014-01-16 13:18:05 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-22 18:10:19 +0100
commit2ce7959eb9e69cd68013fc6a0f77a9556a84365b (patch)
tree64f52ddce97d858c04b69390f504c778bb5ad0c7
parentb287ed4c4dee9d705073badc79cdb0c3e183d19b (diff)
Further pack messages for QQmlProfilerService
Allow multiple detailTypes in each packet and extend the profiling code to make use of that. Note that this changes the usual order of pixmapSizeKnown and PixmapLoadingFinished events. As far as I can see this doesn't affect the QML profiler frontend and the order of these events isn't specified anywhere. Change-Id: Id39ad98594ccf35add4415e08daf9e92ab561237 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
-rw-r--r--src/qml/debugger/qqmlprofilerservice.cpp125
-rw-r--r--src/qml/debugger/qqmlprofilerservice_p.h143
-rw-r--r--src/quick/items/qquickview.cpp10
-rw-r--r--src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp6
-rw-r--r--src/quick/scenegraph/coreapi/qsgrenderer.cpp3
-rw-r--r--src/quick/scenegraph/qsgadaptationlayer.cpp3
-rw-r--r--src/quick/scenegraph/qsgrenderloop.cpp3
-rw-r--r--src/quick/scenegraph/qsgthreadedrenderloop.cpp6
-rw-r--r--src/quick/scenegraph/qsgwindowsrenderloop.cpp15
-rw-r--r--src/quick/scenegraph/util/qsgatlastexture.cpp3
-rw-r--r--src/quick/scenegraph/util/qsgtexture.cpp6
-rw-r--r--src/quick/util/qquickpixmapcache.cpp22
-rw-r--r--tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp12
13 files changed, 178 insertions, 179 deletions
diff --git a/src/qml/debugger/qqmlprofilerservice.cpp b/src/qml/debugger/qqmlprofilerservice.cpp
index 2d958fb1ce..91d27f9b11 100644
--- a/src/qml/debugger/qqmlprofilerservice.cpp
+++ b/src/qml/debugger/qqmlprofilerservice.cpp
@@ -60,67 +60,74 @@ bool QQmlProfilerService::enabled = false;
void QQmlProfilerData::toByteArrays(QList<QByteArray> &messages) const
{
QByteArray data;
- //### using QDataStream is relatively expensive
- for (int i = 0; i < QQmlProfilerService::MaximumMessage; ++i) {
- if ((messageType & (1 << i)) == 0)
+ Q_ASSERT_X(((messageType | detailType) & (1 << 31)) == 0, Q_FUNC_INFO, "You can use at most 31 message types and 31 detail types.");
+ for (uint decodedMessageType = 0; (messageType >> decodedMessageType) != 0; ++decodedMessageType) {
+ if ((messageType & (1 << decodedMessageType)) == 0)
continue;
- QQmlDebugStream ds(&data, QIODevice::WriteOnly);
- ds << time << i << detailType;
- switch (i) {
- case QQmlProfilerService::Event:
- if (detailType == (int)QQmlProfilerService::AnimationFrame)
- ds << framerate << count;
- break;
- case QQmlProfilerService::RangeStart:
- if (detailType == (int)QQmlProfilerService::Binding)
- ds << bindingType;
- break;
- case QQmlProfilerService::RangeData:
- ds << detailString;
- break;
- case QQmlProfilerService::RangeLocation:
- ds << (detailUrl.isEmpty() ? detailString : detailUrl.toString()) << x << y;
- break;
- case QQmlProfilerService::RangeEnd: break;
- case QQmlProfilerService::PixmapCacheEvent:
- ds << detailUrl.toString();
- switch (detailType) {
- case QQmlProfilerService::PixmapSizeKnown: ds << x << y; break;
- case QQmlProfilerService::PixmapReferenceCountChanged: ds << count; break;
- case QQmlProfilerService::PixmapCacheCountChanged: ds << count; break;
- default: break;
+ for (uint decodedDetailType = 0; (detailType >> decodedDetailType) != 0; ++decodedDetailType) {
+ if ((detailType & (1 << decodedDetailType)) == 0)
+ continue;
+
+ //### using QDataStream is relatively expensive
+ QQmlDebugStream ds(&data, QIODevice::WriteOnly);
+ ds << time << decodedMessageType << decodedDetailType;
+
+ switch (decodedMessageType) {
+ case QQmlProfilerService::Event:
+ if (decodedDetailType == (int)QQmlProfilerService::AnimationFrame)
+ ds << framerate << count;
+ break;
+ case QQmlProfilerService::RangeStart:
+ if (decodedDetailType == (int)QQmlProfilerService::Binding)
+ ds << bindingType;
+ break;
+ case QQmlProfilerService::RangeData:
+ ds << detailString;
+ break;
+ case QQmlProfilerService::RangeLocation:
+ ds << (detailUrl.isEmpty() ? detailString : detailUrl.toString()) << x << y;
+ break;
+ case QQmlProfilerService::RangeEnd: break;
+ case QQmlProfilerService::PixmapCacheEvent:
+ ds << detailUrl.toString();
+ switch (decodedDetailType) {
+ case QQmlProfilerService::PixmapSizeKnown: ds << x << y; break;
+ case QQmlProfilerService::PixmapReferenceCountChanged: ds << count; break;
+ case QQmlProfilerService::PixmapCacheCountChanged: ds << count; break;
+ default: break;
+ }
+ break;
+ case QQmlProfilerService::SceneGraphFrame:
+ switch (decodedDetailType) {
+ // RendererFrame: preprocessTime, updateTime, bindingTime, renderTime
+ case QQmlProfilerService::SceneGraphRendererFrame: ds << subtime_1 << subtime_2 << subtime_3 << subtime_4; break;
+ // AdaptationLayerFrame: glyphCount (which is an integer), glyphRenderTime, glyphStoreTime
+ case QQmlProfilerService::SceneGraphAdaptationLayerFrame: ds << (int)subtime_1 << subtime_2 << subtime_3; break;
+ // ContextFrame: compiling material time
+ case QQmlProfilerService::SceneGraphContextFrame: ds << subtime_1; break;
+ // RenderLoop: syncTime, renderTime, swapTime
+ case QQmlProfilerService::SceneGraphRenderLoopFrame: ds << subtime_1 << subtime_2 << subtime_3; break;
+ // TexturePrepare: bind, convert, swizzle, upload, mipmap
+ case QQmlProfilerService::SceneGraphTexturePrepare: ds << subtime_1 << subtime_2 << subtime_3 << subtime_4 << subtime_5; break;
+ // TextureDeletion: deletionTime
+ case QQmlProfilerService::SceneGraphTextureDeletion: ds << subtime_1; break;
+ // PolishAndSync: polishTime, waitTime, syncTime, animationsTime,
+ case QQmlProfilerService::SceneGraphPolishAndSync: ds << subtime_1 << subtime_2 << subtime_3 << subtime_4; break;
+ // WindowsRenderLoop: GL time, make current time, SceneGraph time
+ case QQmlProfilerService::SceneGraphWindowsRenderShow: ds << subtime_1 << subtime_2 << subtime_3; break;
+ // WindowsAnimations: update time
+ case QQmlProfilerService::SceneGraphWindowsAnimations: ds << subtime_1; break;
+ // WindowsRenderWindow: polish time; always comes packed after a RenderLoop
+ case QQmlProfilerService::SceneGraphWindowsPolishFrame: ds << subtime_4; break;
+ default:break;
+ }
+ break;
+ case QQmlProfilerService::Complete: break;
}
- break;
- case QQmlProfilerService::SceneGraphFrame:
- switch (detailType) {
- // RendererFrame: preprocessTime, updateTime, bindingTime, renderTime
- case QQmlProfilerService::SceneGraphRendererFrame: ds << subtime_1 << subtime_2 << subtime_3 << subtime_4; break;
- // AdaptationLayerFrame: glyphCount (which is an integer), glyphRenderTime, glyphStoreTime
- case QQmlProfilerService::SceneGraphAdaptationLayerFrame: ds << (int)subtime_1 << subtime_2 << subtime_3; break;
- // ContextFrame: compiling material time
- case QQmlProfilerService::SceneGraphContextFrame: ds << subtime_1; break;
- // RenderLoop: syncTime, renderTime, swapTime
- case QQmlProfilerService::SceneGraphRenderLoopFrame: ds << subtime_1 << subtime_2 << subtime_3; break;
- // TexturePrepare: bind, convert, swizzle, upload, mipmap
- case QQmlProfilerService::SceneGraphTexturePrepare: ds << subtime_1 << subtime_2 << subtime_3 << subtime_4 << subtime_5; break;
- // TextureDeletion: deletionTime
- case QQmlProfilerService::SceneGraphTextureDeletion: ds << subtime_1; break;
- // PolishAndSync: polishTime, waitTime, syncTime, animationsTime,
- case QQmlProfilerService::SceneGraphPolishAndSync: ds << subtime_1 << subtime_2 << subtime_3 << subtime_4; break;
- // WindowsRenderLoop: GL time, make current time, SceneGraph time
- case QQmlProfilerService::SceneGraphWindowsRenderShow: ds << subtime_1 << subtime_2 << subtime_3; break;
- // WindowsAnimations: update time
- case QQmlProfilerService::SceneGraphWindowsAnimations: ds << subtime_1; break;
- // WindowsRenderWindow: polish time
- case QQmlProfilerService::SceneGraphWindowsPolishFrame: ds << subtime_1; break;
- default:break;
- }
- break;
- case QQmlProfilerService::Complete: break;
+ messages << data;
+ data.clear();
}
- messages << data;
- data.clear();
}
}
@@ -176,7 +183,7 @@ bool QQmlProfilerService::startProfilingImpl()
if (QQmlDebugService::isDebuggingEnabled() && !enabled) {
enabled = true;
QList<QByteArray> messages;
- QQmlProfilerData(m_timer.nsecsElapsed(), 1 << Event, StartTrace).toByteArrays(messages);
+ QQmlProfilerData(m_timer.nsecsElapsed(), 1 << Event, 1 << StartTrace).toByteArrays(messages);
QQmlDebugService::sendMessages(messages);
return true;
} else {
@@ -190,7 +197,7 @@ bool QQmlProfilerService::stopProfilingImpl()
enabled = false;
// We cannot use instance here as this is called from the debugger thread.
// It may be called before the QML engine (and the profiler) is ready.
- processMessage(QQmlProfilerData(m_timer.nsecsElapsed(), 1 << Event, EndTrace));
+ processMessage(QQmlProfilerData(m_timer.nsecsElapsed(), 1 << Event, 1 << EndTrace));
return true;
} else {
return false;
diff --git a/src/qml/debugger/qqmlprofilerservice_p.h b/src/qml/debugger/qqmlprofilerservice_p.h
index 20c023eb24..6d7c0dcb51 100644
--- a/src/qml/debugger/qqmlprofilerservice_p.h
+++ b/src/qml/debugger/qqmlprofilerservice_p.h
@@ -65,12 +65,20 @@
#include <QtCore/qstringbuilder.h>
#include <QtCore/qwaitcondition.h>
-#define Q_QML_PROFILE(Method)\
+#define Q_QML_PROFILE_IF_ENABLED(Code)\
if (QQmlProfilerService::enabled) {\
- QQmlProfilerService::Method;\
+ Code;\
} else\
(void)0
+#define Q_QML_PROFILE(Method)\
+ Q_QML_PROFILE_IF_ENABLED(QQmlProfilerService::Method)
+
+#define Q_QML_SG_PROFILE2(Type1, Type2, Params)\
+ Q_QML_PROFILE_IF_ENABLED((QQmlProfilerService::sceneGraphFrame<Type1, Type2> Params))
+
+#define Q_QML_SG_PROFILE1(Type, Params) Q_QML_SG_PROFILE2(Type, Type, Params)
+
QT_BEGIN_NAMESPACE
// This struct is somewhat dangerous to use:
@@ -230,9 +238,11 @@ public:
static bool startProfiling();
static bool stopProfiling();
- static void addEvent(EventType event)
+ template<EventType DetailType>
+ static void addEvent()
{
- instance->processMessage(QQmlProfilerData(instance->timestamp(), 1 << Event, event));
+ instance->processMessage(QQmlProfilerData(instance->timestamp(), 1 << Event,
+ 1 << DetailType));
}
static void animationFrame(qint64 delta)
@@ -241,38 +251,40 @@ public:
if (animCount > 0 && delta > 0) {
instance->processMessage(QQmlProfilerData(instance->timestamp(), 1 << Event,
- AnimationFrame, QString(), 0, 0,
+ 1 << AnimationFrame, QString(), 0, 0,
1000 / (int)delta /* trim fps to integer */,
animCount));
}
}
- static void sceneGraphFrame(SceneGraphFrameType frameType, qint64 value1, qint64 value2 = -1,
- qint64 value3 = -1, qint64 value4 = -1, qint64 value5 = -1)
+ template<SceneGraphFrameType FrameType1, SceneGraphFrameType FrameType2>
+ static void sceneGraphFrame(qint64 value1, qint64 value2 = -1, qint64 value3 = -1,
+ qint64 value4 = -1, qint64 value5 = -1)
{
instance->processMessage(QQmlProfilerData(instance->timestamp(), 1 << SceneGraphFrame,
- frameType, value1, value2, value3, value4,
- value5));
+ 1 << FrameType1 | 1 << FrameType2,
+ value1, value2, value3, value4, value5));
}
- static void pixmapEvent(PixmapEventType eventType, const QUrl &url)
+ template<PixmapEventType PixmapState>
+ static void pixmapStateChanged(const QUrl &url)
{
instance->processMessage(QQmlProfilerData(instance->timestamp(), 1 << PixmapCacheEvent,
- eventType, url));
+ 1 << PixmapState, url));
}
- static void pixmapEvent(PixmapEventType eventType, const QUrl &url, int count)
+ static void pixmapLoadingFinished(const QUrl &url, const QSize &size)
{
instance->processMessage(QQmlProfilerData(instance->timestamp(), 1 << PixmapCacheEvent,
- eventType, url, 0, 0, 0, count));
+ (1 << PixmapLoadingFinished) | ((size.width() > 0 && size.height() > 0) ? (1 << PixmapSizeKnown) : 0),
+ url, size.width(), size.height()));
}
- static void pixmapEvent(PixmapEventType eventType, const QUrl &url, const QSize &size)
+ template<PixmapEventType CountType>
+ static void pixmapCountChanged(const QUrl &url, int count)
{
- if (size.width() > 0 && size.height() > 0) {
- instance->processMessage(QQmlProfilerData(instance->timestamp(), 1 << PixmapCacheEvent,
- eventType, url, size.width(), size.height()));
- }
+ instance->processMessage(QQmlProfilerData(instance->timestamp(), 1 << PixmapCacheEvent,
+ 1 << CountType, url, 0, 0, 0, count));
}
qint64 timestamp() {return m_timer.nsecsElapsed();}
@@ -290,57 +302,57 @@ private:
bool startProfilingImpl();
bool stopProfilingImpl();
- static void startRange(RangeType range, const QString &fileName, int line, int column,
- BindingType bindingType = QmlBinding)
+ static void startBinding(const QString &fileName, int line, int column, BindingType bindingType)
{
instance->processMessage(QQmlProfilerData(instance->timestamp(),
- (1 << RangeStart | 1 << RangeLocation), range,
- fileName, line, column, 0, 0, bindingType));
+ (1 << RangeStart | 1 << RangeLocation),
+ 1 << Binding, fileName, line, column, 0, 0,
+ bindingType));
}
// Have toByteArrays() construct another RangeData event from the same QString later.
// This is somewhat pointless but important for backwards compatibility.
- static void startRangeWithData(RangeType range, const QString &name, int line, int column,
- BindingType bindingType = QmlBinding)
+ static void startCompiling(const QString &name)
{
- instance->processMessage(QQmlProfilerData(instance->timestamp(), (1 << RangeStart | 1 << RangeLocation | 1 << RangeData),
- range, name, line, column, 0, 0, bindingType));
+ instance->processMessage(QQmlProfilerData(instance->timestamp(),
+ (1 << RangeStart | 1 << RangeLocation | 1 << RangeData), 1 << Compiling,
+ name, 1, 1, 0, 0, QmlBinding));
}
- static void startRange(RangeType range, const QUrl &fileName, int line, int column,
- BindingType bindingType = QmlBinding)
+ static void startHandlingSignal(const QString &fileName, int line, int column)
{
instance->processMessage(QQmlProfilerData(instance->timestamp(),
(1 << RangeStart | 1 << RangeLocation),
- range, fileName, line, column, 0, 0,
- bindingType));
+ 1 << HandlingSignal, fileName, line, column, 0, 0,
+ QmlBinding));
}
- static void startRange(RangeType range, const QString &rData, const QUrl &fileName, int line,
- int column, BindingType bindingType = QmlBinding)
+ static void startCreating(const QString &typeName, const QUrl &fileName, int line, int column)
{
- instance->processMessage(QQmlProfilerData(instance->timestamp(), (1 << RangeStart | 1 << RangeLocation | 1 << RangeData),
- range, rData, fileName, line, column, 0, 0,
- bindingType));
+ instance->processMessage(QQmlProfilerData(instance->timestamp(),
+ (1 << RangeStart | 1 << RangeLocation | 1 << RangeData),
+ 1 << Creating, typeName, fileName, line, column,
+ 0, 0, QmlBinding));
}
- static void startRange(RangeType range, const QString &rData,
- BindingType bindingType = QmlBinding)
+ static void startCreating(const QString &typeName)
{
instance->processMessage(QQmlProfilerData(instance->timestamp(),
- (1 << RangeStart | 1 << RangeData), range,
- rData, 0, 0, 0, 0, bindingType));
+ (1 << RangeStart | 1 << RangeData), 1 << Creating,
+ typeName, 0, 0, 0, 0, QmlBinding));
}
- static void rangeLocation(RangeType range, const QUrl &fileName, int line, int column)
+ static void creatingLocation(const QUrl &fileName, int line, int column)
{
- instance->processMessage(QQmlProfilerData(instance->timestamp(), 1 << RangeLocation, range,
- fileName, line, column));
+ instance->processMessage(QQmlProfilerData(instance->timestamp(), 1 << RangeLocation,
+ 1 << Creating, fileName, line, column));
}
- static void endRange(RangeType range)
+ template<RangeType Range>
+ static void endRange()
{
- instance->processMessage(QQmlProfilerData(instance->timestamp(), 1 << RangeEnd, range));
+ instance->processMessage(QQmlProfilerData(instance->timestamp(), 1 << RangeEnd,
+ 1 << Range));
}
void sendMessages();
@@ -377,45 +389,41 @@ private:
struct QQmlBindingProfiler {
QQmlBindingProfiler(const QString &url, int line, int column, QQmlProfilerService::BindingType bindingType)
{
- Q_QML_PROFILE(startRange(QQmlProfilerService::Binding, url, line, column, bindingType));
+ Q_QML_PROFILE(startBinding(url, line, column, bindingType));
}
~QQmlBindingProfiler()
{
- Q_QML_PROFILE(endRange(QQmlProfilerService::Binding));
+ Q_QML_PROFILE(endRange<QQmlProfilerService::Binding>());
}
};
struct QQmlHandlingSignalProfiler {
QQmlHandlingSignalProfiler(QQmlBoundSignalExpression *expression)
{
- Q_QML_PROFILE(startRange(QQmlProfilerService::HandlingSignal,
- expression->sourceFile(), expression->lineNumber(), expression->columnNumber()));
+ Q_QML_PROFILE(startHandlingSignal(expression->sourceFile(), expression->lineNumber(),
+ expression->columnNumber()));
}
~QQmlHandlingSignalProfiler()
{
- Q_QML_PROFILE(endRange(QQmlProfilerService::HandlingSignal));
+ Q_QML_PROFILE(endRange<QQmlProfilerService::HandlingSignal>());
}
};
struct QQmlCompilingProfiler {
QQmlCompilingProfiler(const QString &name)
{
- Q_QML_PROFILE(startRangeWithData(QQmlProfilerService::Compiling, name, 1, 1));
+ Q_QML_PROFILE(startCompiling(name));
}
~QQmlCompilingProfiler()
{
- Q_QML_PROFILE(endRange(QQmlProfilerService::Compiling));
+ Q_QML_PROFILE(endRange<QQmlProfilerService::Compiling>());
}
};
-#define Q_QML_VME_PROFILE(Method)\
- if (QQmlProfilerService::enabled)\
- Method;\
- else\
- (void)0
+#define Q_QML_VME_PROFILE(Method) Q_QML_PROFILE_IF_ENABLED(Method)
struct QQmlVmeProfiler {
public:
@@ -434,9 +442,9 @@ public:
{
ranges.clear();
if (running)
- QQmlProfilerService::instance->endRange(QQmlProfilerService::Creating);
+ QQmlProfilerService::instance->endRange<QQmlProfilerService::Creating>();
for (int i = 0; i < backgroundRanges.count(); ++i) {
- QQmlProfilerService::instance->endRange(QQmlProfilerService::Creating);
+ QQmlProfilerService::instance->endRange<QQmlProfilerService::Creating>();
}
backgroundRanges.clear();
running = false;
@@ -445,10 +453,10 @@ public:
void startBackground(const QString &typeName)
{
if (running) {
- QQmlProfilerService::instance->endRange(QQmlProfilerService::Creating);
+ QQmlProfilerService::instance->endRange<QQmlProfilerService::Creating>();
running = false;
}
- QQmlProfilerService::instance->startRange(QQmlProfilerService::Creating, typeName);
+ QQmlProfilerService::instance->startCreating(typeName);
backgroundRanges.push(typeName);
}
@@ -456,14 +464,13 @@ public:
{
switchRange();
setCurrentRange(typeName, url, line, column);
- QQmlProfilerService::instance->startRange(QQmlProfilerService::Creating, typeName, url,
- line, column);
+ QQmlProfilerService::instance->startCreating(typeName, url, line, column);
}
void stop()
{
if (running) {
- QQmlProfilerService::instance->endRange(QQmlProfilerService::Creating);
+ QQmlProfilerService::instance->endRange<QQmlProfilerService::Creating>();
running = false;
}
}
@@ -473,9 +480,8 @@ public:
if (ranges.count() > 0) {
switchRange();
currentRange = ranges.pop();
- QQmlProfilerService::instance->startRange(QQmlProfilerService::Creating,
- currentRange.typeName, currentRange.url,
- currentRange.line, currentRange.column);
+ QQmlProfilerService::instance->startCreating(currentRange.typeName, currentRange.url,
+ currentRange.line, currentRange.column);
}
}
@@ -490,8 +496,7 @@ public:
if (backgroundRanges.count() > 0) {
switchRange();
setCurrentRange(backgroundRanges.pop(), url, line, column);
- QQmlProfilerService::instance->rangeLocation(
- QQmlProfilerService::Creating, url, line, column);
+ QQmlProfilerService::instance->creatingLocation(url, line, column);
}
}
@@ -500,7 +505,7 @@ private:
void switchRange()
{
if (running)
- QQmlProfilerService::instance->endRange(QQmlProfilerService::Creating);
+ QQmlProfilerService::instance->endRange<QQmlProfilerService::Creating>();
else
running = true;
}
diff --git a/src/quick/items/qquickview.cpp b/src/quick/items/qquickview.cpp
index f78ba3520c..1a3d225995 100644
--- a/src/quick/items/qquickview.cpp
+++ b/src/quick/items/qquickview.cpp
@@ -603,7 +603,7 @@ void QQuickView::resizeEvent(QResizeEvent *e)
/*! \reimp */
void QQuickView::keyPressEvent(QKeyEvent *e)
{
- Q_QML_PROFILE(addEvent(QQmlProfilerService::Key));
+ Q_QML_PROFILE(addEvent<QQmlProfilerService::Key>());
QQuickWindow::keyPressEvent(e);
}
@@ -611,7 +611,7 @@ void QQuickView::keyPressEvent(QKeyEvent *e)
/*! \reimp */
void QQuickView::keyReleaseEvent(QKeyEvent *e)
{
- Q_QML_PROFILE(addEvent(QQmlProfilerService::Key));
+ Q_QML_PROFILE(addEvent<QQmlProfilerService::Key>());
QQuickWindow::keyReleaseEvent(e);
}
@@ -619,7 +619,7 @@ void QQuickView::keyReleaseEvent(QKeyEvent *e)
/*! \reimp */
void QQuickView::mouseMoveEvent(QMouseEvent *e)
{
- Q_QML_PROFILE(addEvent(QQmlProfilerService::Mouse));
+ Q_QML_PROFILE(addEvent<QQmlProfilerService::Mouse>());
QQuickWindow::mouseMoveEvent(e);
}
@@ -627,7 +627,7 @@ void QQuickView::mouseMoveEvent(QMouseEvent *e)
/*! \reimp */
void QQuickView::mousePressEvent(QMouseEvent *e)
{
- Q_QML_PROFILE(addEvent(QQmlProfilerService::Mouse));
+ Q_QML_PROFILE(addEvent<QQmlProfilerService::Mouse>());
QQuickWindow::mousePressEvent(e);
}
@@ -635,7 +635,7 @@ void QQuickView::mousePressEvent(QMouseEvent *e)
/*! \reimp */
void QQuickView::mouseReleaseEvent(QMouseEvent *e)
{
- Q_QML_PROFILE(addEvent(QQmlProfilerService::Mouse));
+ Q_QML_PROFILE(addEvent<QQmlProfilerService::Mouse>());
QQuickWindow::mouseReleaseEvent(e);
}
diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
index 297bea6e6a..700ec051ff 100644
--- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
+++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
@@ -171,8 +171,7 @@ ShaderManager::Shader *ShaderManager::prepareMaterial(QSGMaterial *material)
if (qsg_render_timing)
qDebug(" - compiling material: %dms", (int) qsg_renderer_timer.elapsed());
- Q_QML_PROFILE(sceneGraphFrame(
- QQmlProfilerService::SceneGraphContextFrame,
+ Q_QML_SG_PROFILE1(QQmlProfilerService::SceneGraphContextFrame, (
qsg_renderer_timer.nsecsElapsed()));
#endif
@@ -208,8 +207,7 @@ ShaderManager::Shader *ShaderManager::prepareMaterialNoRewrite(QSGMaterial *mate
if (qsg_render_timing)
qDebug(" - compiling material: %dms", (int) qsg_renderer_timer.elapsed());
- Q_QML_PROFILE(sceneGraphFrame(
- QQmlProfilerService::SceneGraphContextFrame,
+ Q_QML_SG_PROFILE1(QQmlProfilerService::SceneGraphContextFrame, (
qsg_renderer_timer.nsecsElapsed()));
#endif
diff --git a/src/quick/scenegraph/coreapi/qsgrenderer.cpp b/src/quick/scenegraph/coreapi/qsgrenderer.cpp
index 44b80df15d..047891e17c 100644
--- a/src/quick/scenegraph/coreapi/qsgrenderer.cpp
+++ b/src/quick/scenegraph/coreapi/qsgrenderer.cpp
@@ -287,8 +287,7 @@ void QSGRenderer::renderScene(const QSGBindable &bindable)
int(renderTime / 1000000));
}
- Q_QML_PROFILE(sceneGraphFrame(
- QQmlProfilerService::SceneGraphRendererFrame,
+ Q_QML_SG_PROFILE1(QQmlProfilerService::SceneGraphRendererFrame, (
preprocessTime,
updatePassTime - preprocessTime,
bindTime - updatePassTime,
diff --git a/src/quick/scenegraph/qsgadaptationlayer.cpp b/src/quick/scenegraph/qsgadaptationlayer.cpp
index 8798208ea3..aa678b34a6 100644
--- a/src/quick/scenegraph/qsgadaptationlayer.cpp
+++ b/src/quick/scenegraph/qsgadaptationlayer.cpp
@@ -196,8 +196,7 @@ void QSGDistanceFieldGlyphCache::update()
(int) qsg_render_timer.elapsed());
}
- Q_QML_PROFILE(sceneGraphFrame(
- QQmlProfilerService::SceneGraphAdaptationLayerFrame,
+ Q_QML_SG_PROFILE1(QQmlProfilerService::SceneGraphAdaptationLayerFrame, (
count,
renderTime,
qsg_render_timer.nsecsElapsed() - renderTime));
diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp
index facb11d275..5559745621 100644
--- a/src/quick/scenegraph/qsgrenderloop.cpp
+++ b/src/quick/scenegraph/qsgrenderloop.cpp
@@ -342,8 +342,7 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window)
lastFrameTime = QTime::currentTime();
}
- Q_QML_PROFILE(sceneGraphFrame(
- QQmlProfilerService::SceneGraphRenderLoopFrame,
+ Q_QML_SG_PROFILE1(QQmlProfilerService::SceneGraphRenderLoopFrame, (
syncTime,
renderTime,
swapTime));
diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
index 98a88a8540..bc08b70557 100644
--- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp
+++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp
@@ -609,8 +609,7 @@ void QSGRenderThread::syncAndRender()
int((renderTime - syncTime)/1000000),
int(threadTimer.elapsed() - renderTime/1000000));
- Q_QML_PROFILE(sceneGraphFrame(
- QQmlProfilerService::SceneGraphRenderLoopFrame,
+ Q_QML_SG_PROFILE1(QQmlProfilerService::SceneGraphRenderLoopFrame, (
syncTime,
renderTime - syncTime,
threadTimer.nsecsElapsed() - renderTime));
@@ -1141,8 +1140,7 @@ void QSGThreadedRenderLoop::polishAndSync(Window *w)
int((syncTime - waitTime)/1000000),
int((timer.nsecsElapsed() - syncTime)/1000000));
- Q_QML_PROFILE(sceneGraphFrame(
- QQmlProfilerService::SceneGraphPolishAndSync,
+ Q_QML_SG_PROFILE1(QQmlProfilerService::SceneGraphPolishAndSync, (
polishTime,
waitTime - polishTime,
syncTime - waitTime,
diff --git a/src/quick/scenegraph/qsgwindowsrenderloop.cpp b/src/quick/scenegraph/qsgwindowsrenderloop.cpp
index 14569788b0..c3656eac7a 100644
--- a/src/quick/scenegraph/qsgwindowsrenderloop.cpp
+++ b/src/quick/scenegraph/qsgwindowsrenderloop.cpp
@@ -202,8 +202,7 @@ void QSGWindowsRenderLoop::show(QQuickWindow *window)
int((time_current - time_created)/1000000),
int((qsg_render_timer.nsecsElapsed() - time_current)/1000000));
}
- Q_QML_PROFILE(sceneGraphFrame(
- QQmlProfilerService::SceneGraphWindowsRenderShow,
+ Q_QML_SG_PROFILE1(QQmlProfilerService::SceneGraphWindowsRenderShow, (
time_created - time_start,
time_current - time_created,
qsg_render_timer.nsecsElapsed() - time_current));
@@ -405,8 +404,7 @@ void QSGWindowsRenderLoop::render()
qDebug("WindowsRenderLoop: animations=%d ms",
int((qsg_render_timer.nsecsElapsed() - time_start)/1000000));
}
- Q_QML_PROFILE(sceneGraphFrame(
- QQmlProfilerService::SceneGraphWindowsAnimations,
+ Q_QML_SG_PROFILE1(QQmlProfilerService::SceneGraphWindowsAnimations, (
qsg_render_timer.nsecsElapsed() - time_start));
#endif
@@ -469,12 +467,13 @@ void QSGWindowsRenderLoop::renderWindow(QQuickWindow *window)
int((time_rendered - time_synced)/1000000),
int((time_swapped - time_rendered)/1000000));
}
- Q_QML_PROFILE(sceneGraphFrame(QQmlProfilerService::SceneGraphWindowsPolishFrame,
- time_polished - time_start));
- Q_QML_PROFILE(sceneGraphFrame(QQmlProfilerService::SceneGraphRenderLoopFrame,
+
+ Q_QML_SG_PROFILE2(QQmlProfilerService::SceneGraphWindowsPolishFrame,
+ QQmlProfilerService::SceneGraphRenderLoopFrame, (
time_synced - time_polished,
time_rendered - time_synced,
- time_swapped - time_rendered));
+ time_swapped - time_rendered,
+ time_polished - time_start));
#endif
}
diff --git a/src/quick/scenegraph/util/qsgatlastexture.cpp b/src/quick/scenegraph/util/qsgatlastexture.cpp
index 0fce410b62..6e0fdc7290 100644
--- a/src/quick/scenegraph/util/qsgatlastexture.cpp
+++ b/src/quick/scenegraph/util/qsgatlastexture.cpp
@@ -381,8 +381,7 @@ bool Atlas::bind(QSGTexture::Filtering filtering)
(int) (qsg_renderer_timer.elapsed()));
}
- Q_QML_PROFILE(sceneGraphFrame(
- QQmlProfilerService::SceneGraphTexturePrepare,
+ Q_QML_SG_PROFILE1(QQmlProfilerService::SceneGraphTexturePrepare, (
0, // bind (not relevant)
0, // convert (not relevant)
0, // swizzle (not relevant)
diff --git a/src/quick/scenegraph/util/qsgtexture.cpp b/src/quick/scenegraph/util/qsgtexture.cpp
index 4243e71844..d84ccb7a1f 100644
--- a/src/quick/scenegraph/util/qsgtexture.cpp
+++ b/src/quick/scenegraph/util/qsgtexture.cpp
@@ -634,8 +634,7 @@ void QSGPlainTexture::bind()
m_texture_size.width(),
m_texture_size.height());
}
- Q_QML_PROFILE(sceneGraphFrame(
- QQmlProfilerService::SceneGraphTextureDeletion,
+ Q_QML_SG_PROFILE1(QQmlProfilerService::SceneGraphTextureDeletion, (
qsg_renderer_timer.nsecsElapsed()));
#endif
}
@@ -736,8 +735,7 @@ void QSGPlainTexture::bind()
}
- Q_QML_PROFILE(sceneGraphFrame(
- QQmlProfilerService::SceneGraphTexturePrepare,
+ Q_QML_SG_PROFILE1(QQmlProfilerService::SceneGraphTexturePrepare, (
bindTime,
convertTime - bindTime,
swizzleTime - convertTime,
diff --git a/src/quick/util/qquickpixmapcache.cpp b/src/quick/util/qquickpixmapcache.cpp
index 0260bd1683..af66ef26a4 100644
--- a/src/quick/util/qquickpixmapcache.cpp
+++ b/src/quick/util/qquickpixmapcache.cpp
@@ -519,7 +519,7 @@ void QQuickPixmapReader::processJobs()
runningJob->loading = true;
QUrl url = runningJob->url;
- Q_QML_PROFILE(pixmapEvent(QQmlProfilerService::PixmapLoadingStarted, url));
+ Q_QML_PROFILE(pixmapStateChanged<QQmlProfilerService::PixmapLoadingStarted>(url));
QSize requestSize = runningJob->requestSize;
locker.unlock();
@@ -897,11 +897,10 @@ bool QQuickPixmapReply::event(QEvent *event)
if (data->pixmapStatus == QQuickPixmap::Ready) {
data->textureFactory = de->textureFactory;
data->implicitSize = de->implicitSize;
- Q_QML_PROFILE(pixmapEvent(QQmlProfilerService::PixmapLoadingFinished, data->url));
- Q_QML_PROFILE(pixmapEvent(QQmlProfilerService::PixmapSizeKnown, url,
+ Q_QML_PROFILE(pixmapLoadingFinished(data->url,
data->requestSize.width() > 0 ? data->requestSize : data->implicitSize));
} else {
- Q_QML_PROFILE(pixmapEvent(QQmlProfilerService::PixmapLoadingError, data->url));
+ Q_QML_PROFILE(pixmapStateChanged<QQmlProfilerService::PixmapLoadingError>(data->url));
data->errorString = de->errorString;
data->removeFromCache(); // We don't continue to cache error'd pixmaps
}
@@ -927,7 +926,7 @@ int QQuickPixmapData::cost() const
void QQuickPixmapData::addref()
{
++refCount;
- Q_QML_PROFILE(pixmapEvent(QQmlProfilerService::PixmapReferenceCountChanged, url, refCount));
+ Q_QML_PROFILE(pixmapCountChanged<QQmlProfilerService::PixmapReferenceCountChanged>(url, refCount));
if (prevUnreferencedPtr)
pixmapStore()->referencePixmap(this);
}
@@ -936,7 +935,7 @@ void QQuickPixmapData::release()
{
Q_ASSERT(refCount > 0);
--refCount;
- Q_QML_PROFILE(pixmapEvent(QQmlProfilerService::PixmapReferenceCountChanged, url, refCount));
+ Q_QML_PROFILE(pixmapCountChanged<QQmlProfilerService::PixmapReferenceCountChanged>(url, refCount));
if (refCount == 0) {
if (reply) {
QQuickPixmapReply *cancelReply = reply;
@@ -967,7 +966,7 @@ void QQuickPixmapData::addToCache()
QQuickPixmapKey key = { &url, &requestSize };
pixmapStore()->m_cache.insert(key, this);
inCache = true;
- Q_QML_PROFILE(pixmapEvent(QQmlProfilerService::PixmapCacheCountChanged,
+ Q_QML_PROFILE(pixmapCountChanged<QQmlProfilerService::PixmapCacheCountChanged>(
url, pixmapStore()->m_cache.count()));
}
}
@@ -976,7 +975,7 @@ void QQuickPixmapData::removeFromCache()
{
if (inCache) {
QQuickPixmapKey key = { &url, &requestSize };
- Q_QML_PROFILE(pixmapEvent(QQmlProfilerService::PixmapCacheCountChanged,
+ Q_QML_PROFILE(pixmapCountChanged<QQmlProfilerService::PixmapCacheCountChanged>(
url, pixmapStore()->m_cache.count()));
pixmapStore()->m_cache.remove(key);
inCache = false;
@@ -1240,18 +1239,17 @@ void QQuickPixmap::load(QQmlEngine *engine, const QUrl &url, const QSize &reques
if (!(options & QQuickPixmap::Asynchronous)) {
bool ok = false;
- Q_QML_PROFILE(pixmapEvent(QQmlProfilerService::PixmapLoadingStarted, url));
+ Q_QML_PROFILE(pixmapStateChanged<QQmlProfilerService::PixmapLoadingStarted>(url));
d = createPixmapDataSync(this, engine, url, requestSize, &ok);
if (ok) {
- Q_QML_PROFILE(pixmapEvent(QQmlProfilerService::PixmapLoadingFinished, url));
- Q_QML_PROFILE(pixmapEvent(QQmlProfilerService::PixmapSizeKnown, url,
+ Q_QML_PROFILE(pixmapLoadingFinished(url,
d->requestSize.width() > 0 ? d->requestSize : d->implicitSize));
if (options & QQuickPixmap::Cache)
d->addToCache();
return;
}
if (d) { // loadable, but encountered error while loading
- Q_QML_PROFILE(pixmapEvent(QQmlProfilerService::PixmapLoadingError, url));
+ Q_QML_PROFILE(pixmapStateChanged<QQmlProfilerService::PixmapLoadingError>(url));
return;
}
}
diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
index acbc62807b..56ed65f54d 100644
--- a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
+++ b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
@@ -422,15 +422,15 @@ void tst_QQmlProfilerService::pixmapCacheData()
QCOMPARE(m_client->traceMessages[16].messageType, (int)QQmlProfilerClient::PixmapCacheEvent);
QCOMPARE(m_client->traceMessages[16].detailType, (int)QQmlProfilerClient::PixmapLoadingStarted);
- // image loaded
+ // image size
QCOMPARE(m_client->traceMessages[17].messageType, (int)QQmlProfilerClient::PixmapCacheEvent);
- QCOMPARE(m_client->traceMessages[17].detailType, (int)QQmlProfilerClient::PixmapLoadingFinished);
+ QCOMPARE(m_client->traceMessages[17].detailType, (int)QQmlProfilerClient::PixmapSizeKnown);
+ QCOMPARE(m_client->traceMessages[17].line, 2); // width
+ QCOMPARE(m_client->traceMessages[17].column, 2); // height
- // image size
+ // image loaded
QCOMPARE(m_client->traceMessages[18].messageType, (int)QQmlProfilerClient::PixmapCacheEvent);
- QCOMPARE(m_client->traceMessages[18].detailType, (int)QQmlProfilerClient::PixmapSizeKnown);
- QCOMPARE(m_client->traceMessages[18].line, 2); // width
- QCOMPARE(m_client->traceMessages[18].column, 2); // height
+ QCOMPARE(m_client->traceMessages[18].detailType, (int)QQmlProfilerClient::PixmapLoadingFinished);
// cache size
QCOMPARE(m_client->traceMessages[19].messageType, (int)QQmlProfilerClient::PixmapCacheEvent);