aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2018-04-23 12:23:42 +0200
committerUlf Hermann <ulf.hermann@qt.io>2018-04-24 08:44:41 +0000
commit03739f2150d59248fb2c4b688c6352182f630f3e (patch)
tree6c17bf9b1dd97b7d29d54330d87830faa97dce09
parentbea27694ae60bc0273ee3a6f34a57168c9bf01a1 (diff)
Make QtQmlDebug independent of QtQml
This means QtQmlDebug needs its own qqmlprofilerdefintions.h. This is a good thing because this way we notice if we change the definitions in an incompatible way. The test uses QtQmlDebug after all. Also, qqmldebugserviceinterfaces_p.h is not available anymore, which means the service names have to be spelled out. This, also, is beneficial as it prevents us from accidentally changing the names. In the context of QmlDebug we don't need to namespace the profiler definitions, either. This simplifies some code. Task-number: QTBUG-60996 Change-Id: Ibb39e48c9b758687d68b8ce4431f45eb26939a09 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rw-r--r--src/qml/debugger/qqmlprofilerdefinitions_p.h27
-rw-r--r--src/qmldebug/qmldebug.pro5
-rw-r--r--src/qmldebug/qqmlenginecontrolclient.cpp3
-rw-r--r--src/qmldebug/qqmlprofilerclient.cpp1
-rw-r--r--src/qmldebug/qqmlprofilerclient_p.h4
-rw-r--r--src/qmldebug/qqmlprofilerclient_p_p.h6
-rw-r--r--src/qmldebug/qqmlprofilerclientdefinitions_p.h152
-rw-r--r--src/qmldebug/qqmlprofilerevent_p.h4
-rw-r--r--src/qmldebug/qqmlprofilereventtype.cpp26
-rw-r--r--src/qmldebug/qqmlprofilereventtype_p.h5
-rw-r--r--src/qmldebug/qqmlprofilertypedevent.cpp91
-rw-r--r--tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp84
-rw-r--r--tools/qmlprofiler/qmlprofiler.pro2
-rw-r--r--tools/qmlprofiler/qmlprofilerapplication.cpp5
-rw-r--r--tools/qmlprofiler/qmlprofilerclient.h2
-rw-r--r--tools/qmlprofiler/qmlprofilerdata.cpp110
-rw-r--r--tools/qmlprofiler/qmlprofilerdata.h6
17 files changed, 329 insertions, 204 deletions
diff --git a/src/qml/debugger/qqmlprofilerdefinitions_p.h b/src/qml/debugger/qqmlprofilerdefinitions_p.h
index f84a2c44e2..7b972c5d0d 100644
--- a/src/qml/debugger/qqmlprofilerdefinitions_p.h
+++ b/src/qml/debugger/qqmlprofilerdefinitions_p.h
@@ -96,11 +96,6 @@ struct QQmlProfilerDefinitions {
MaximumRangeType
};
- enum BindingType {
- QmlBinding,
- MaximumBindingType
- };
-
enum PixmapEventType {
PixmapSizeKnown,
PixmapReferenceCountChanged,
@@ -129,8 +124,6 @@ struct QQmlProfilerDefinitions {
NumGUIThreadFrameTypes = MaximumSceneGraphFrameType - NumRenderThreadFrameTypes
};
- typedef QV4::Profiling::MemoryType MemoryType;
-
enum ProfileFeature {
ProfileJavaScript,
ProfileMemory,
@@ -162,26 +155,6 @@ struct QQmlProfilerDefinitions {
MaximumInputEventType
};
-
- static ProfileFeature featureFromRangeType(RangeType range)
- {
- switch (range) {
- case Painting:
- return ProfilePainting;
- case Compiling:
- return ProfileCompiling;
- case Creating:
- return ProfileCreating;
- case Binding:
- return ProfileBinding;
- case HandlingSignal:
- return ProfileHandlingSignal;
- case Javascript:
- return ProfileJavaScript;
- default:
- return MaximumProfileFeature;
- }
- }
};
QT_END_NAMESPACE
diff --git a/src/qmldebug/qmldebug.pro b/src/qmldebug/qmldebug.pro
index 2539414d8f..2c1b71797d 100644
--- a/src/qmldebug/qmldebug.pro
+++ b/src/qmldebug/qmldebug.pro
@@ -1,5 +1,5 @@
TARGET = QtQmlDebug
-QT = core-private network packetprotocol-private qml-private
+QT = core-private network packetprotocol-private
CONFIG += static internal_module
load(qt_module)
@@ -28,4 +28,5 @@ HEADERS += \
qqmlprofilereventlocation_p.h \
qqmlprofilereventreceiver_p.h \
qqmlprofilereventtype_p.h \
- qqmlprofilertypedevent_p.h
+ qqmlprofilertypedevent_p.h \
+ qqmlprofilerclientdefinitions_p.h
diff --git a/src/qmldebug/qqmlenginecontrolclient.cpp b/src/qmldebug/qqmlenginecontrolclient.cpp
index 13f216ce38..45d672d4bc 100644
--- a/src/qmldebug/qqmlenginecontrolclient.cpp
+++ b/src/qmldebug/qqmlenginecontrolclient.cpp
@@ -41,7 +41,6 @@
#include "qqmlenginecontrolclient_p_p.h"
#include "qqmldebugconnection_p.h"
-#include <private/qqmldebugserviceinterfaces_p.h>
#include <private/qpacket_p.h>
QT_BEGIN_NAMESPACE
@@ -142,7 +141,7 @@ void QQmlEngineControlClient::messageReceived(const QByteArray &data)
}
QQmlEngineControlClientPrivate::QQmlEngineControlClientPrivate(QQmlDebugConnection *connection) :
- QQmlDebugClientPrivate(QQmlEngineControlService::s_key, connection)
+ QQmlDebugClientPrivate(QLatin1String("EngineControl"), connection)
{
}
diff --git a/src/qmldebug/qqmlprofilerclient.cpp b/src/qmldebug/qqmlprofilerclient.cpp
index d2a2d24f13..661b43f164 100644
--- a/src/qmldebug/qqmlprofilerclient.cpp
+++ b/src/qmldebug/qqmlprofilerclient.cpp
@@ -39,7 +39,6 @@
#include "qqmlprofilerclient_p_p.h"
#include "qqmldebugconnection_p.h"
-#include <private/qqmldebugserviceinterfaces_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/qmldebug/qqmlprofilerclient_p.h b/src/qmldebug/qqmlprofilerclient_p.h
index 68a32a1a5a..7b8e286f5b 100644
--- a/src/qmldebug/qqmlprofilerclient_p.h
+++ b/src/qmldebug/qqmlprofilerclient_p.h
@@ -43,8 +43,8 @@
#include "qqmldebugclient_p.h"
#include "qqmlprofilereventlocation_p.h"
#include "qqmlprofilereventreceiver_p.h"
+#include "qqmlprofilerclientdefinitions_p.h"
-#include <private/qqmlprofilerdefinitions_p.h>
#include <private/qpacket_p.h>
//
@@ -61,7 +61,7 @@
QT_BEGIN_NAMESPACE
class QQmlProfilerClientPrivate;
-class QQmlProfilerClient : public QQmlDebugClient, public QQmlProfilerDefinitions
+class QQmlProfilerClient : public QQmlDebugClient
{
Q_OBJECT
Q_DECLARE_PRIVATE(QQmlProfilerClient)
diff --git a/src/qmldebug/qqmlprofilerclient_p_p.h b/src/qmldebug/qqmlprofilerclient_p_p.h
index 0caef8e448..994c08cafc 100644
--- a/src/qmldebug/qqmlprofilerclient_p_p.h
+++ b/src/qmldebug/qqmlprofilerclient_p_p.h
@@ -45,10 +45,10 @@
#include "qqmlenginecontrolclient_p.h"
#include "qqmlprofilerclient_p.h"
#include "qqmlprofilertypedevent_p.h"
-
-#include <private/qqmlprofilerdefinitions_p.h>
+#include "qqmlprofilerclientdefinitions_p.h"
#include <QtCore/qqueue.h>
+#include <QtCore/qstack.h>
//
// W A R N I N G
@@ -63,7 +63,7 @@
QT_BEGIN_NAMESPACE
-class QQmlProfilerClientPrivate : public QQmlDebugClientPrivate, public QQmlProfilerDefinitions {
+class QQmlProfilerClientPrivate : public QQmlDebugClientPrivate {
Q_DECLARE_PUBLIC(QQmlProfilerClient)
public:
QQmlProfilerClientPrivate(QQmlDebugConnection *connection,
diff --git a/src/qmldebug/qqmlprofilerclientdefinitions_p.h b/src/qmldebug/qqmlprofilerclientdefinitions_p.h
new file mode 100644
index 0000000000..c8524574f6
--- /dev/null
+++ b/src/qmldebug/qqmlprofilerclientdefinitions_p.h
@@ -0,0 +1,152 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtQml module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQMLPROFILERCLIENTDEFINITIONS_P_H
+#define QQMLPROFILERCLIENTDEFINITIONS_P_H
+
+#include <QtCore/qglobal.h>
+
+QT_BEGIN_NAMESPACE
+
+enum Message {
+ Event,
+ RangeStart,
+ RangeData,
+ RangeLocation,
+ RangeEnd,
+ Complete, // end of transmission
+ PixmapCacheEvent,
+ SceneGraphFrame,
+ MemoryAllocation,
+ DebugMessage,
+
+ MaximumMessage
+};
+
+enum EventType {
+ FramePaint,
+ Mouse,
+ Key,
+ AnimationFrame,
+ EndTrace,
+ StartTrace,
+
+ MaximumEventType
+};
+
+enum RangeType {
+ Painting,
+ Compiling,
+ Creating,
+ Binding, //running a binding
+ HandlingSignal, //running a signal handler
+ Javascript,
+
+ MaximumRangeType
+};
+
+enum PixmapEventType {
+ PixmapSizeKnown,
+ PixmapReferenceCountChanged,
+ PixmapCacheCountChanged,
+ PixmapLoadingStarted,
+ PixmapLoadingFinished,
+ PixmapLoadingError,
+
+ MaximumPixmapEventType
+};
+
+enum SceneGraphFrameType {
+ SceneGraphRendererFrame, // Render Thread
+ SceneGraphAdaptationLayerFrame, // Render Thread
+ SceneGraphContextFrame, // Render Thread
+ SceneGraphRenderLoopFrame, // Render Thread
+ SceneGraphTexturePrepare, // Render Thread
+ SceneGraphTextureDeletion, // Render Thread
+ SceneGraphPolishAndSync, // GUI Thread
+ SceneGraphWindowsRenderShow, // Unused
+ SceneGraphWindowsAnimations, // GUI Thread
+ SceneGraphPolishFrame, // GUI Thread
+
+ MaximumSceneGraphFrameType,
+ NumRenderThreadFrameTypes = SceneGraphPolishAndSync,
+ NumGUIThreadFrameTypes = MaximumSceneGraphFrameType - NumRenderThreadFrameTypes
+};
+
+enum MemoryType {
+ HeapPage,
+ LargeItem,
+ SmallItem
+};
+
+enum ProfileFeature {
+ ProfileJavaScript,
+ ProfileMemory,
+ ProfilePixmapCache,
+ ProfileSceneGraph,
+ ProfileAnimations,
+ ProfilePainting,
+ ProfileCompiling,
+ ProfileCreating,
+ ProfileBinding,
+ ProfileHandlingSignal,
+ ProfileInputEvents,
+ ProfileDebugMessages,
+
+ MaximumProfileFeature
+};
+
+enum InputEventType {
+ InputKeyPress,
+ InputKeyRelease,
+ InputKeyUnknown,
+
+ InputMousePress,
+ InputMouseRelease,
+ InputMouseMove,
+ InputMouseDoubleClick,
+ InputMouseWheel,
+ InputMouseUnknown,
+
+ MaximumInputEventType
+};
+
+QT_END_NAMESPACE
+
+#endif // QQMLPROFILERCLIENTDEFINITIONS_P_H
diff --git a/src/qmldebug/qqmlprofilerevent_p.h b/src/qmldebug/qqmlprofilerevent_p.h
index 49a0c9e347..1e205d8dbb 100644
--- a/src/qmldebug/qqmlprofilerevent_p.h
+++ b/src/qmldebug/qqmlprofilerevent_p.h
@@ -40,7 +40,7 @@
#ifndef QQMLPROFILEREVENT_P_H
#define QQMLPROFILEREVENT_P_H
-#include <private/qqmlprofilerdefinitions_p.h>
+#include "qqmlprofilerclientdefinitions_p.h"
#include <QtCore/qstring.h>
#include <QtCore/qbytearray.h>
@@ -63,7 +63,7 @@
QT_BEGIN_NAMESPACE
-struct QQmlProfilerEvent : public QQmlProfilerDefinitions {
+struct QQmlProfilerEvent {
QQmlProfilerEvent() :
m_timestamp(-1), m_typeIndex(-1), m_dataType(Inline8Bit), m_dataLength(0)
{}
diff --git a/src/qmldebug/qqmlprofilereventtype.cpp b/src/qmldebug/qqmlprofilereventtype.cpp
index b0aad3fc5b..c92e914d74 100644
--- a/src/qmldebug/qqmlprofilereventtype.cpp
+++ b/src/qmldebug/qqmlprofilereventtype.cpp
@@ -38,6 +38,7 @@
****************************************************************************/
#include "qqmlprofilereventtype_p.h"
+#include "qqmlprofilerclientdefinitions_p.h"
#include <QtCore/qdatastream.h>
@@ -49,8 +50,8 @@ QDataStream &operator>>(QDataStream &stream, QQmlProfilerEventType &type)
quint8 rangeType;
stream >> type.m_displayName >> type.m_data >> type.m_location >> message >> rangeType
>> type.m_detailType;
- type.m_message = static_cast<QQmlProfilerDefinitions::Message>(message);
- type.m_rangeType = static_cast<QQmlProfilerDefinitions::RangeType>(rangeType);
+ type.m_message = static_cast<Message>(message);
+ type.m_rangeType = static_cast<RangeType>(rangeType);
return stream;
}
@@ -61,7 +62,7 @@ QDataStream &operator<<(QDataStream &stream, const QQmlProfilerEventType &type)
<< type.m_detailType;
}
-QQmlProfilerDefinitions::ProfileFeature QQmlProfilerEventType::feature() const
+ProfileFeature QQmlProfilerEventType::feature() const
{
switch (m_message) {
case Event: {
@@ -84,7 +85,24 @@ QQmlProfilerDefinitions::ProfileFeature QQmlProfilerEventType::feature() const
case DebugMessage:
return ProfileDebugMessages;
default:
- return featureFromRangeType(m_rangeType);
+ break;
+ }
+
+ switch (m_rangeType) {
+ case Painting:
+ return ProfilePainting;
+ case Compiling:
+ return ProfileCompiling;
+ case Creating:
+ return ProfileCreating;
+ case Binding:
+ return ProfileBinding;
+ case HandlingSignal:
+ return ProfileHandlingSignal;
+ case Javascript:
+ return ProfileJavaScript;
+ default:
+ return MaximumProfileFeature;
}
}
diff --git a/src/qmldebug/qqmlprofilereventtype_p.h b/src/qmldebug/qqmlprofilereventtype_p.h
index 7bd67f9ca8..7189df53ef 100644
--- a/src/qmldebug/qqmlprofilereventtype_p.h
+++ b/src/qmldebug/qqmlprofilereventtype_p.h
@@ -41,8 +41,7 @@
#define QQMLPROFILEREVENTTYPE_P_H
#include "qqmlprofilereventlocation_p.h"
-
-#include <private/qqmlprofilerdefinitions_p.h>
+#include "qqmlprofilerclientdefinitions_p.h"
#include <QtCore/qstring.h>
#include <QtCore/qmetatype.h>
@@ -61,7 +60,7 @@
QT_BEGIN_NAMESPACE
-class QQmlProfilerEventType : public QQmlProfilerDefinitions {
+class QQmlProfilerEventType {
public:
QQmlProfilerEventType(Message message = MaximumMessage, RangeType rangeType = MaximumRangeType,
int detailType = -1,
diff --git a/src/qmldebug/qqmlprofilertypedevent.cpp b/src/qmldebug/qqmlprofilertypedevent.cpp
index 9b00481e17..31a36bd052 100644
--- a/src/qmldebug/qqmlprofilertypedevent.cpp
+++ b/src/qmldebug/qqmlprofilertypedevent.cpp
@@ -38,6 +38,8 @@
****************************************************************************/
#include "qqmlprofilertypedevent_p.h"
+#include "qqmlprofilerclientdefinitions_p.h"
+
#include <QtCore/qvarlengtharray.h>
QT_BEGIN_NAMESPACE
@@ -50,15 +52,15 @@ QDataStream &operator>>(QDataStream &stream, QQmlProfilerTypedEvent &event)
stream >> time >> messageType;
- if (messageType < 0 || messageType > QQmlProfilerDefinitions::MaximumMessage)
- messageType = QQmlProfilerDefinitions::MaximumMessage;
+ if (messageType < 0 || messageType > MaximumMessage)
+ messageType = MaximumMessage;
- QQmlProfilerDefinitions::RangeType rangeType = QQmlProfilerDefinitions::MaximumRangeType;
+ RangeType rangeType = MaximumRangeType;
if (!stream.atEnd()) {
stream >> subtype;
- rangeType = static_cast<QQmlProfilerDefinitions::RangeType>(subtype);
- if (rangeType < 0 || rangeType > QQmlProfilerDefinitions::MaximumRangeType)
- rangeType = QQmlProfilerDefinitions::MaximumRangeType;
+ rangeType = static_cast<RangeType>(subtype);
+ if (rangeType < 0 || rangeType > MaximumRangeType)
+ rangeType = MaximumRangeType;
} else {
subtype = -1;
}
@@ -68,13 +70,13 @@ QDataStream &operator>>(QDataStream &stream, QQmlProfilerTypedEvent &event)
event.serverTypeId = 0;
switch (messageType) {
- case QQmlProfilerDefinitions::Event: {
+ case Event: {
event.type = QQmlProfilerEventType(
- static_cast<QQmlProfilerDefinitions::Message>(messageType),
- QQmlProfilerDefinitions::MaximumRangeType, subtype);
+ static_cast<Message>(messageType),
+ MaximumRangeType, subtype);
switch (subtype) {
- case QQmlProfilerDefinitions::StartTrace:
- case QQmlProfilerDefinitions::EndTrace: {
+ case StartTrace:
+ case EndTrace: {
QVarLengthArray<qint32> engineIds;
while (!stream.atEnd()) {
qint32 id;
@@ -84,7 +86,7 @@ QDataStream &operator>>(QDataStream &stream, QQmlProfilerTypedEvent &event)
event.event.setNumbers<QVarLengthArray<qint32>, qint32>(engineIds);
break;
}
- case QQmlProfilerDefinitions::AnimationFrame: {
+ case AnimationFrame: {
qint32 frameRate, animationCount;
qint32 threadId;
stream >> frameRate >> animationCount;
@@ -96,11 +98,9 @@ QDataStream &operator>>(QDataStream &stream, QQmlProfilerTypedEvent &event)
event.event.setNumbers<qint32>({frameRate, animationCount, threadId});
break;
}
- case QQmlProfilerDefinitions::Mouse:
- case QQmlProfilerDefinitions::Key:
- int inputType = (subtype == QQmlProfilerDefinitions::Key
- ? QQmlProfilerDefinitions::InputKeyUnknown
- : QQmlProfilerDefinitions::InputMouseUnknown);
+ case Mouse:
+ case Key:
+ int inputType = (subtype == Key ? InputKeyUnknown : InputMouseUnknown);
if (!stream.atEnd())
stream >> inputType;
qint32 a = -1;
@@ -116,13 +116,13 @@ QDataStream &operator>>(QDataStream &stream, QQmlProfilerTypedEvent &event)
break;
}
- case QQmlProfilerDefinitions::Complete: {
+ case Complete: {
event.type = QQmlProfilerEventType(
- static_cast<QQmlProfilerDefinitions::Message>(messageType),
- QQmlProfilerDefinitions::MaximumRangeType, subtype);
+ static_cast<Message>(messageType),
+ MaximumRangeType, subtype);
break;
}
- case QQmlProfilerDefinitions::SceneGraphFrame: {
+ case SceneGraphFrame: {
QVarLengthArray<qint64> params;
qint64 param;
@@ -132,41 +132,40 @@ QDataStream &operator>>(QDataStream &stream, QQmlProfilerTypedEvent &event)
}
event.type = QQmlProfilerEventType(
- static_cast<QQmlProfilerDefinitions::Message>(messageType),
- QQmlProfilerDefinitions::MaximumRangeType, subtype);
+ static_cast<Message>(messageType),
+ MaximumRangeType, subtype);
event.event.setNumbers<QVarLengthArray<qint64>, qint64>(params);
break;
}
- case QQmlProfilerDefinitions::PixmapCacheEvent: {
+ case PixmapCacheEvent: {
qint32 width = 0, height = 0, refcount = 0;
QString filename;
stream >> filename;
- if (subtype == QQmlProfilerDefinitions::PixmapReferenceCountChanged
- || subtype == QQmlProfilerDefinitions::PixmapCacheCountChanged) {
+ if (subtype == PixmapReferenceCountChanged || subtype == PixmapCacheCountChanged) {
stream >> refcount;
- } else if (subtype == QQmlProfilerDefinitions::PixmapSizeKnown) {
+ } else if (subtype == PixmapSizeKnown) {
stream >> width >> height;
refcount = 1;
}
event.type = QQmlProfilerEventType(
- static_cast<QQmlProfilerDefinitions::Message>(messageType),
- QQmlProfilerDefinitions::MaximumRangeType, subtype,
+ static_cast<Message>(messageType),
+ MaximumRangeType, subtype,
QQmlProfilerEventLocation(filename, 0, 0));
event.event.setNumbers<qint32>({width, height, refcount});
break;
}
- case QQmlProfilerDefinitions::MemoryAllocation: {
+ case MemoryAllocation: {
qint64 delta;
stream >> delta;
event.type = QQmlProfilerEventType(
- static_cast<QQmlProfilerDefinitions::Message>(messageType),
- QQmlProfilerDefinitions::MaximumRangeType, subtype);
+ static_cast<Message>(messageType),
+ MaximumRangeType, subtype);
event.event.setNumbers<qint64>({delta});
break;
}
- case QQmlProfilerDefinitions::RangeStart: {
+ case RangeStart: {
if (!stream.atEnd()) {
qint64 typeId;
stream >> typeId;
@@ -175,22 +174,22 @@ QDataStream &operator>>(QDataStream &stream, QQmlProfilerTypedEvent &event)
// otherwise it's the old binding type of 4 bytes
}
- event.type = QQmlProfilerEventType(QQmlProfilerDefinitions::MaximumMessage, rangeType, -1);
- event.event.setRangeStage(QQmlProfilerDefinitions::RangeStart);
+ event.type = QQmlProfilerEventType(MaximumMessage, rangeType, -1);
+ event.event.setRangeStage(RangeStart);
break;
}
- case QQmlProfilerDefinitions::RangeData: {
+ case RangeData: {
QString data;
stream >> data;
- event.type = QQmlProfilerEventType(QQmlProfilerDefinitions::MaximumMessage, rangeType, -1,
+ event.type = QQmlProfilerEventType(MaximumMessage, rangeType, -1,
QQmlProfilerEventLocation(), data);
- event.event.setRangeStage(QQmlProfilerDefinitions::RangeData);
+ event.event.setRangeStage(RangeData);
if (!stream.atEnd())
stream >> event.serverTypeId;
break;
}
- case QQmlProfilerDefinitions::RangeLocation: {
+ case RangeLocation: {
QString filename;
qint32 line = 0;
qint32 column = 0;
@@ -202,21 +201,21 @@ QDataStream &operator>>(QDataStream &stream, QQmlProfilerTypedEvent &event)
stream >> event.serverTypeId;
}
- event.type = QQmlProfilerEventType(QQmlProfilerDefinitions::MaximumMessage, rangeType, -1,
+ event.type = QQmlProfilerEventType(MaximumMessage, rangeType, -1,
QQmlProfilerEventLocation(filename, line, column));
- event.event.setRangeStage(QQmlProfilerDefinitions::RangeLocation);
+ event.event.setRangeStage(RangeLocation);
break;
}
- case QQmlProfilerDefinitions::RangeEnd: {
- event.type = QQmlProfilerEventType(QQmlProfilerDefinitions::MaximumMessage, rangeType, -1);
- event.event.setRangeStage(QQmlProfilerDefinitions::RangeEnd);
+ case RangeEnd: {
+ event.type = QQmlProfilerEventType(MaximumMessage, rangeType, -1);
+ event.event.setRangeStage(RangeEnd);
break;
}
default:
event.event.setNumbers<char>({});
event.type = QQmlProfilerEventType(
- static_cast<QQmlProfilerDefinitions::Message>(messageType),
- QQmlProfilerDefinitions::MaximumRangeType, subtype);
+ static_cast<Message>(messageType),
+ MaximumRangeType, subtype);
break;
}
diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
index 562804bc45..a6fbdf41e4 100644
--- a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
+++ b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
@@ -40,7 +40,7 @@
#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/qpa/qplatformintegration.h>
-class QQmlProfilerTestClient : public QQmlProfilerEventReceiver, public QQmlProfilerDefinitions
+class QQmlProfilerTestClient : public QQmlProfilerEventReceiver
{
Q_OBJECT
@@ -229,8 +229,8 @@ private:
bool m_isComplete = false;
// Don't use ({...}) here as MSVC will interpret that as the "QVector(int size)" ctor.
- const QVector<qint64> m_rangeStart = (QVector<qint64>() << QQmlProfilerDefinitions::RangeStart);
- const QVector<qint64> m_rangeEnd = (QVector<qint64>() << QQmlProfilerDefinitions::RangeEnd);
+ const QVector<qint64> m_rangeStart = (QVector<qint64>() << RangeStart);
+ const QVector<qint64> m_rangeEnd = (QVector<qint64>() << RangeEnd);
};
#define VERIFY(type, position, expected, checks, numbers) \
@@ -247,7 +247,7 @@ QQmlDebugTest::ConnectResult tst_QQmlProfilerService::connect(
// ### Still using qmlscene due to QTBUG-33377
return QQmlDebugTest::connect(
QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene",
- restrictServices ? QQmlDebuggingEnabler::profilerServices().join(',') : QString(),
+ restrictServices ? "CanvasFrameRate,EngineControl,DebugMessages" : QString(),
testFile(file), block);
}
@@ -272,15 +272,11 @@ void tst_QQmlProfilerService::checkTraceReceived()
QVector<qint64> numbers;
// must start with "StartTrace"
- QQmlProfilerEventType expected(QQmlProfilerDefinitions::Event,
- QQmlProfilerDefinitions::MaximumRangeType,
- QQmlProfilerDefinitions::StartTrace);
+ QQmlProfilerEventType expected(Event, MaximumRangeType, StartTrace);
VERIFY(MessageListAsynchronous, 0, expected, CheckMessageType | CheckDetailType, numbers);
// must end with "EndTrace"
- expected = QQmlProfilerEventType(QQmlProfilerDefinitions::Event,
- QQmlProfilerDefinitions::MaximumRangeType,
- QQmlProfilerDefinitions::EndTrace);
+ expected = QQmlProfilerEventType(Event, MaximumRangeType, EndTrace);
VERIFY(MessageListAsynchronous, m_client->asynchronousMessages.length() - 1, expected,
CheckMessageType | CheckDetailType, numbers);
}
@@ -299,15 +295,15 @@ void tst_QQmlProfilerService::checkJsHeap()
const qint64 amount = message.number<qint64>(0);
const QQmlProfilerEventType &type = m_client->types.at(message.typeIndex());
switch (type.detailType()) {
- case QV4::Profiling::HeapPage:
+ case HeapPage:
allocated += amount;
seen_alloc = true;
break;
- case QV4::Profiling::SmallItem:
+ case SmallItem:
used += amount;
seen_small = true;
break;
- case QV4::Profiling::LargeItem:
+ case LargeItem:
allocated += amount;
used += amount;
seen_large = true;
@@ -548,28 +544,27 @@ void tst_QQmlProfilerService::pixmapCacheData()
checkTraceReceived();
checkJsHeap();
- auto createType = [](QQmlProfilerDefinitions::PixmapEventType type) {
- return QQmlProfilerEventType(QQmlProfilerDefinitions::PixmapCacheEvent,
- QQmlProfilerDefinitions::MaximumRangeType, type);
+ auto createType = [](PixmapEventType type) {
+ return QQmlProfilerEventType(PixmapCacheEvent, MaximumRangeType, type);
};
QVector<qint64> numbers;
// image starting to load
- VERIFY(MessageListPixmap, 0, createType(QQmlProfilerDefinitions::PixmapLoadingStarted),
+ VERIFY(MessageListPixmap, 0, createType(PixmapLoadingStarted),
CheckMessageType | CheckDetailType, numbers);
// image size
numbers = QVector<qint64>({2, 2, 1});
- VERIFY(MessageListPixmap, 1, createType(QQmlProfilerDefinitions::PixmapSizeKnown),
+ VERIFY(MessageListPixmap, 1, createType(PixmapSizeKnown),
CheckMessageType | CheckDetailType | CheckNumbers, numbers);
// image loaded
- VERIFY(MessageListPixmap, 2, createType(QQmlProfilerDefinitions::PixmapLoadingFinished),
+ VERIFY(MessageListPixmap, 2, createType(PixmapLoadingFinished),
CheckMessageType | CheckDetailType, numbers);
// cache size
- VERIFY(MessageListPixmap, 3, createType(QQmlProfilerDefinitions::PixmapCacheCountChanged),
+ VERIFY(MessageListPixmap, 3, createType(PixmapCacheCountChanged),
CheckMessageType | CheckDetailType, numbers);
}
@@ -597,8 +592,8 @@ void tst_QQmlProfilerService::scenegraphData()
if (QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL)) {
foreach (const QQmlProfilerEvent &msg, m_client->asynchronousMessages) {
const QQmlProfilerEventType &type = m_client->types.at(msg.typeIndex());
- if (type.message() == QQmlProfilerDefinitions::SceneGraphFrame) {
- if (type.detailType() == QQmlProfilerDefinitions::SceneGraphContextFrame) {
+ if (type.message() == SceneGraphFrame) {
+ if (type.detailType() == SceneGraphContextFrame) {
contextFrameTime = msg.timestamp();
break;
}
@@ -610,7 +605,7 @@ void tst_QQmlProfilerService::scenegraphData()
#endif
foreach (const QQmlProfilerEvent &msg, m_client->asynchronousMessages) {
const QQmlProfilerEventType &type = m_client->types.at(msg.typeIndex());
- if (type.detailType() == QQmlProfilerDefinitions::SceneGraphRendererFrame) {
+ if (type.detailType() == SceneGraphRendererFrame) {
QVERIFY(msg.timestamp() >= contextFrameTime);
renderFrameTime = msg.timestamp();
break;
@@ -621,7 +616,7 @@ void tst_QQmlProfilerService::scenegraphData()
foreach (const QQmlProfilerEvent &msg, m_client->asynchronousMessages) {
const QQmlProfilerEventType &type = m_client->types.at(msg.typeIndex());
- if (type.detailType() == QQmlProfilerDefinitions::SceneGraphRenderLoopFrame) {
+ if (type.detailType() == SceneGraphRenderLoopFrame) {
if (msg.timestamp() >= contextFrameTime) {
// Make sure SceneGraphRenderLoopFrame is not between SceneGraphContextFrame and
// SceneGraphRendererFrame. A SceneGraphRenderLoopFrame before everything else is
@@ -664,8 +659,7 @@ void tst_QQmlProfilerService::signalSourceLocation()
auto createType = [](int line, int column) {
return QQmlProfilerEventType(
- QQmlProfilerDefinitions::MaximumMessage,
- QQmlProfilerDefinitions::HandlingSignal, -1,
+ MaximumMessage, HandlingSignal, -1,
QQmlProfilerEventLocation(QLatin1String("signalSourceLocation.qml"), line,
column));
};
@@ -684,23 +678,21 @@ void tst_QQmlProfilerService::javascript()
checkTraceReceived();
checkJsHeap();
- VERIFY(MessageListJavaScript, 2, QQmlProfilerEventType(QQmlProfilerDefinitions::MaximumMessage,
- QQmlProfilerDefinitions::Javascript),
+ VERIFY(MessageListJavaScript, 2, QQmlProfilerEventType(MaximumMessage, Javascript),
CheckMessageType | CheckDetailType | CheckNumbers, m_rangeStart);
VERIFY(MessageListJavaScript, 3,
- QQmlProfilerEventType(QQmlProfilerDefinitions::MaximumMessage,
- QQmlProfilerDefinitions::Javascript, -1,
- QQmlProfilerEventLocation(QLatin1String("javascript.qml"), 4, 5)),
+ QQmlProfilerEventType(
+ MaximumMessage, Javascript, -1,
+ QQmlProfilerEventLocation(QLatin1String("javascript.qml"), 4, 5)),
CheckType | CheckNumbers, m_rangeStart);
VERIFY(MessageListJavaScript, 4, QQmlProfilerEventType(
- QQmlProfilerDefinitions::MaximumMessage, QQmlProfilerDefinitions::Javascript, -1,
+ MaximumMessage, Javascript, -1,
QQmlProfilerEventLocation(), QLatin1String("something")),
CheckMessageType | CheckDetailType | CheckDataEndsWith | CheckNumbers, m_rangeStart);
- VERIFY(MessageListJavaScript, 10, QQmlProfilerEventType(QQmlProfilerDefinitions::MaximumMessage,
- QQmlProfilerDefinitions::Javascript),
+ VERIFY(MessageListJavaScript, 10, QQmlProfilerEventType(MaximumMessage, Javascript),
CheckMessageType | CheckDetailType | CheckNumbers, m_rangeEnd);
}
@@ -726,8 +718,7 @@ void tst_QQmlProfilerService::translationBinding()
checkTraceReceived();
checkJsHeap();
- const QQmlProfilerEventType type(QQmlProfilerDefinitions::MaximumMessage,
- QQmlProfilerDefinitions::Binding);
+ const QQmlProfilerEventType type(MaximumMessage, Binding);
VERIFY(MessageListQML, 4, type, CheckDetailType | CheckMessageType | CheckNumbers,
m_rangeStart);
@@ -746,7 +737,7 @@ void tst_QQmlProfilerService::memory()
int smallItems = 0;
for (auto message : m_client->jsHeapMessages) {
const QQmlProfilerEventType &type = m_client->types[message.typeIndex()];
- if (type.detailType() == QV4::Profiling::SmallItem)
+ if (type.detailType() == SmallItem)
++smallItems;
}
@@ -756,8 +747,7 @@ void tst_QQmlProfilerService::memory()
static bool hasCompileEvents(const QVector<QQmlProfilerEventType> &types)
{
for (const QQmlProfilerEventType &type : types) {
- if (type.message() == QQmlProfilerDefinitions::MaximumMessage
- && type.rangeType() == QQmlProfilerDefinitions::Compiling)
+ if (type.message() == MaximumMessage && type.rangeType() == Compiling)
return true;
}
return false;
@@ -776,29 +766,29 @@ void tst_QQmlProfilerService::compile()
checkTraceReceived();
checkJsHeap();
- QQmlProfilerDefinitions::Message rangeStage = QQmlProfilerDefinitions::MaximumMessage;
+ Message rangeStage = MaximumMessage;
for (auto message : m_client->qmlMessages) {
const QQmlProfilerEventType &type = m_client->types[message.typeIndex()];
- if (type.rangeType() == QQmlProfilerDefinitions::Compiling) {
+ if (type.rangeType() == Compiling) {
switch (rangeStage) {
- case QQmlProfilerDefinitions::MaximumMessage:
- QCOMPARE(message.rangeStage(), QQmlProfilerDefinitions::RangeStart);
+ case MaximumMessage:
+ QCOMPARE(message.rangeStage(), RangeStart);
break;
- case QQmlProfilerDefinitions::RangeStart:
- QCOMPARE(message.rangeStage(), QQmlProfilerDefinitions::RangeEnd);
+ case RangeStart:
+ QCOMPARE(message.rangeStage(), RangeEnd);
break;
default:
QFAIL("Wrong range stage");
}
rangeStage = message.rangeStage();
- QCOMPARE(type.message(), QQmlProfilerDefinitions::MaximumMessage);
+ QCOMPARE(type.message(), MaximumMessage);
QCOMPARE(type.location().filename(), testFileUrl("test.qml").toString());
QCOMPARE(type.location().line(), 0);
QCOMPARE(type.location().column(), 0);
}
}
- QCOMPARE(rangeStage, QQmlProfilerDefinitions::RangeEnd);
+ QCOMPARE(rangeStage, RangeEnd);
}
QTEST_MAIN(tst_QQmlProfilerService)
diff --git a/tools/qmlprofiler/qmlprofiler.pro b/tools/qmlprofiler/qmlprofiler.pro
index a2522e9267..28e316b23a 100644
--- a/tools/qmlprofiler/qmlprofiler.pro
+++ b/tools/qmlprofiler/qmlprofiler.pro
@@ -1,4 +1,4 @@
-QT = qml-private network core qmldebug-private
+QT = network core qmldebug-private
CONFIG += no_import_scan
SOURCES += main.cpp \
diff --git a/tools/qmlprofiler/qmlprofilerapplication.cpp b/tools/qmlprofiler/qmlprofilerapplication.cpp
index 3ab6741afa..0b63a91e5b 100644
--- a/tools/qmlprofiler/qmlprofilerapplication.cpp
+++ b/tools/qmlprofiler/qmlprofilerapplication.cpp
@@ -70,8 +70,7 @@ static const char *features[] = {
"debugmessages"
};
-Q_STATIC_ASSERT(sizeof(features) ==
- QQmlProfilerDefinitions::MaximumProfileFeature * sizeof(char *));
+Q_STATIC_ASSERT(sizeof(features) == MaximumProfileFeature * sizeof(char *));
QmlProfilerApplication::QmlProfilerApplication(int &argc, char **argv) :
QCoreApplication(argc, argv),
@@ -164,7 +163,7 @@ void QmlProfilerApplication::parseArguments()
parser.addOption(record);
QStringList featureList;
- for (int i = 0; i < QQmlProfilerDefinitions::MaximumProfileFeature; ++i)
+ for (int i = 0; i < MaximumProfileFeature; ++i)
featureList << QLatin1String(features[i]);
QCommandLineOption include(QLatin1String("include"),
diff --git a/tools/qmlprofiler/qmlprofilerclient.h b/tools/qmlprofiler/qmlprofilerclient.h
index b9d8ce241f..30f4a51751 100644
--- a/tools/qmlprofiler/qmlprofilerclient.h
+++ b/tools/qmlprofiler/qmlprofilerclient.h
@@ -30,7 +30,7 @@
#define QMLPROFILERCLIENT_H
#include <private/qqmlprofilerclient_p.h>
-#include <private/qqmlprofilerdefinitions_p.h>
+#include <private/qqmlprofilerclientdefinitions_p.h>
#include <private/qqmlprofilereventlocation_p.h>
class QmlProfilerData;
diff --git a/tools/qmlprofiler/qmlprofilerdata.cpp b/tools/qmlprofiler/qmlprofilerdata.cpp
index 32e03298da..d5662a0182 100644
--- a/tools/qmlprofiler/qmlprofilerdata.cpp
+++ b/tools/qmlprofiler/qmlprofilerdata.cpp
@@ -50,8 +50,7 @@ static const char *RANGE_TYPE_STRINGS[] = {
"Javascript"
};
-Q_STATIC_ASSERT(sizeof(RANGE_TYPE_STRINGS) ==
- QQmlProfilerDefinitions::MaximumRangeType * sizeof(const char *));
+Q_STATIC_ASSERT(sizeof(RANGE_TYPE_STRINGS) == MaximumRangeType * sizeof(const char *));
static const char *MESSAGE_STRINGS[] = {
"Event",
@@ -66,8 +65,7 @@ static const char *MESSAGE_STRINGS[] = {
"DebugMessage"
};
-Q_STATIC_ASSERT(sizeof(MESSAGE_STRINGS) ==
- QQmlProfilerDefinitions::MaximumMessage * sizeof(const char *));
+Q_STATIC_ASSERT(sizeof(MESSAGE_STRINGS) == MaximumMessage * sizeof(const char *));
/////////////////////////////////////////////////////////////////
class QmlProfilerDataPrivate
@@ -113,7 +111,7 @@ void QmlProfilerData::clear()
setState(Empty);
}
-QString QmlProfilerData::qmlRangeTypeAsString(QQmlProfilerDefinitions::RangeType type)
+QString QmlProfilerData::qmlRangeTypeAsString(RangeType type)
{
if (type * sizeof(char *) < sizeof(RANGE_TYPE_STRINGS))
return QLatin1String(RANGE_TYPE_STRINGS[type]);
@@ -121,7 +119,7 @@ QString QmlProfilerData::qmlRangeTypeAsString(QQmlProfilerDefinitions::RangeType
return QString::number(type);
}
-QString QmlProfilerData::qmlMessageAsString(QQmlProfilerDefinitions::Message type)
+QString QmlProfilerData::qmlMessageAsString(Message type)
{
if (type * sizeof(char *) < sizeof(MESSAGE_STRINGS))
return QLatin1String(MESSAGE_STRINGS[type]);
@@ -178,13 +176,13 @@ void QmlProfilerData::addEventType(const QQmlProfilerEventType &type)
QString displayName;
switch (type.message()) {
- case QQmlProfilerDefinitions::Event: {
+ case Event: {
switch (type.detailType()) {
- case QQmlProfilerDefinitions::Mouse:
- case QQmlProfilerDefinitions::Key:
+ case Mouse:
+ case Key:
displayName = QString::fromLatin1("Input:%1").arg(type.detailType());
break;
- case QQmlProfilerDefinitions::AnimationFrame:
+ case AnimationFrame:
displayName = QString::fromLatin1("AnimationFrame");
break;
default:
@@ -192,29 +190,29 @@ void QmlProfilerData::addEventType(const QQmlProfilerEventType &type)
}
break;
}
- case QQmlProfilerDefinitions::RangeStart:
- case QQmlProfilerDefinitions::RangeData:
- case QQmlProfilerDefinitions::RangeLocation:
- case QQmlProfilerDefinitions::RangeEnd:
- case QQmlProfilerDefinitions::Complete:
+ case RangeStart:
+ case RangeData:
+ case RangeLocation:
+ case RangeEnd:
+ case Complete:
Q_UNREACHABLE();
break;
- case QQmlProfilerDefinitions::PixmapCacheEvent: {
+ case PixmapCacheEvent: {
const QString filePath = QUrl(type.location().filename()).path();
displayName = filePath.midRef(filePath.lastIndexOf(QLatin1Char('/')) + 1)
+ QLatin1Char(':') + QString::number(type.detailType());
break;
}
- case QQmlProfilerDefinitions::SceneGraphFrame:
+ case SceneGraphFrame:
displayName = QString::fromLatin1("SceneGraph:%1").arg(type.detailType());
break;
- case QQmlProfilerDefinitions::MemoryAllocation:
+ case MemoryAllocation:
displayName = QString::fromLatin1("MemoryAllocation:%1").arg(type.detailType());
break;
- case QQmlProfilerDefinitions::DebugMessage:
+ case DebugMessage:
displayName = QString::fromLatin1("DebugMessage:%1").arg(type.detailType());
break;
- case QQmlProfilerDefinitions::MaximumMessage: {
+ case MaximumMessage: {
const QQmlProfilerEventLocation eventLocation = type.location();
// generate hash
if (eventLocation.filename().isEmpty()) {
@@ -241,21 +239,21 @@ void QmlProfilerData::computeQmlTime()
for (const QQmlProfilerEvent &event : qAsConst(d->events)) {
const QQmlProfilerEventType &type = d->eventTypes.at(event.typeIndex());
- if (type.message() != QQmlProfilerDefinitions::MaximumMessage)
+ if (type.message() != MaximumMessage)
continue;
switch (type.rangeType()) {
- case QQmlProfilerDefinitions::Compiling:
- case QQmlProfilerDefinitions::Creating:
- case QQmlProfilerDefinitions::Binding:
- case QQmlProfilerDefinitions::HandlingSignal:
- case QQmlProfilerDefinitions::Javascript:
+ case Compiling:
+ case Creating:
+ case Binding:
+ case HandlingSignal:
+ case Javascript:
switch (event.rangeStage()) {
- case QQmlProfilerDefinitions::RangeStart:
+ case RangeStart:
if (level++ == 0)
level0Start = event.timestamp();
break;
- case QQmlProfilerDefinitions::RangeEnd:
+ case RangeEnd:
if (--level == 0)
d->qmlMeasuredTime += event.timestamp() - level0Start;
break;
@@ -430,8 +428,7 @@ bool QmlProfilerData::save(const QString &filename)
if (!eventData.displayName().isEmpty())
stream.writeTextElement("displayname", eventData.displayName());
- stream.writeTextElement("type",
- eventData.rangeType() == QQmlProfilerDefinitions::MaximumRangeType
+ stream.writeTextElement("type", eventData.rangeType() == MaximumRangeType
? qmlMessageAsString(eventData.message())
: qmlRangeTypeAsString(eventData.rangeType()));
@@ -444,25 +441,25 @@ bool QmlProfilerData::save(const QString &filename)
stream.writeTextElement("column", location.column());
if (!eventData.data().isEmpty())
stream.writeTextElement("details", eventData.data());
- if (eventData.rangeType() == QQmlProfilerDefinitions::Binding)
+ if (eventData.rangeType() == Binding)
stream.writeTextElement("bindingType", eventData.detailType());
- else if (eventData.message() == QQmlProfilerDefinitions::Event) {
+ else if (eventData.message() == Event) {
switch (eventData.detailType()) {
- case QQmlProfilerDefinitions::AnimationFrame:
+ case AnimationFrame:
stream.writeTextElement("animationFrame", eventData.detailType());
break;
- case QQmlProfilerDefinitions::Key:
+ case Key:
stream.writeTextElement("keyEvent", eventData.detailType());
break;
- case QQmlProfilerDefinitions::Mouse:
+ case Mouse:
stream.writeTextElement("mouseEvent", eventData.detailType());
break;
}
- } else if (eventData.message() == QQmlProfilerDefinitions::PixmapCacheEvent)
+ } else if (eventData.message() == PixmapCacheEvent)
stream.writeTextElement("cacheEventType", eventData.detailType());
- else if (eventData.message() == QQmlProfilerDefinitions::SceneGraphFrame)
+ else if (eventData.message() == SceneGraphFrame)
stream.writeTextElement("sgEventType", eventData.detailType());
- else if (eventData.message() == QQmlProfilerDefinitions::MemoryAllocation)
+ else if (eventData.message() == MemoryAllocation)
stream.writeTextElement("memoryEventType", eventData.detailType());
stream.writeEndElement();
}
@@ -477,50 +474,49 @@ bool QmlProfilerData::save(const QString &filename)
if (duration != 0)
stream.writeAttribute("duration", duration);
stream.writeAttribute("eventIndex", event.typeIndex());
- if (type.message() == QQmlProfilerDefinitions::Event) {
- if (type.detailType() == QQmlProfilerDefinitions::AnimationFrame) {
+ if (type.message() == Event) {
+ if (type.detailType() == AnimationFrame) {
// special: animation frame
stream.writeAttribute("framerate", event, 0);
stream.writeAttribute("animationcount", event, 1);
stream.writeAttribute("thread", event, 2);
- } else if (type.detailType() == QQmlProfilerDefinitions::Key ||
- type.detailType() == QQmlProfilerDefinitions::Mouse) {
+ } else if (type.detailType() == Key || type.detailType() == Mouse) {
// numerical value here, to keep the format a bit more compact
stream.writeAttribute("type", event, 0);
stream.writeAttribute("data1", event, 1);
stream.writeAttribute("data2", event, 2);
}
- } else if (type.message() == QQmlProfilerDefinitions::PixmapCacheEvent) {
+ } else if (type.message() == PixmapCacheEvent) {
// special: pixmap cache event
- if (type.detailType() == QQmlProfilerDefinitions::PixmapSizeKnown) {
+ if (type.detailType() == PixmapSizeKnown) {
stream.writeAttribute("width", event, 0);
stream.writeAttribute("height", event, 1);
- } else if (type.detailType() == QQmlProfilerDefinitions::PixmapReferenceCountChanged
- || type.detailType() == QQmlProfilerDefinitions::PixmapCacheCountChanged) {
+ } else if (type.detailType() == PixmapReferenceCountChanged
+ || type.detailType() == PixmapCacheCountChanged) {
stream.writeAttribute("refCount", event, 1);
}
- } else if (type.message() == QQmlProfilerDefinitions::SceneGraphFrame) {
+ } else if (type.message() == SceneGraphFrame) {
stream.writeAttribute("timing1", event, 0, false);
stream.writeAttribute("timing2", event, 1, false);
stream.writeAttribute("timing3", event, 2, false);
stream.writeAttribute("timing4", event, 3, false);
stream.writeAttribute("timing5", event, 4, false);
- } else if (type.message() == QQmlProfilerDefinitions::MemoryAllocation) {
+ } else if (type.message() == MemoryAllocation) {
stream.writeAttribute("amount", event, 0);
}
stream.writeEndElement();
};
QQueue<QQmlProfilerEvent> pointEvents;
- QQueue<QQmlProfilerEvent> rangeStarts[QQmlProfilerDefinitions::MaximumRangeType];
- QStack<qint64> rangeEnds[QQmlProfilerDefinitions::MaximumRangeType];
+ QQueue<QQmlProfilerEvent> rangeStarts[MaximumRangeType];
+ QStack<qint64> rangeEnds[MaximumRangeType];
int level = 0;
auto sendPending = [&]() {
forever {
- int minimum = QQmlProfilerDefinitions::MaximumRangeType;
+ int minimum = MaximumRangeType;
qint64 minimumTime = std::numeric_limits<qint64>::max();
- for (int i = 0; i < QQmlProfilerDefinitions::MaximumRangeType; ++i) {
+ for (int i = 0; i < MaximumRangeType; ++i) {
const QQueue<QQmlProfilerEvent> &starts = rangeStarts[i];
if (starts.isEmpty())
continue;
@@ -529,7 +525,7 @@ bool QmlProfilerData::save(const QString &filename)
minimum = i;
}
}
- if (minimum == QQmlProfilerDefinitions::MaximumRangeType)
+ if (minimum == MaximumRangeType)
break;
while (!pointEvents.isEmpty() && pointEvents.front().timestamp() < minimumTime)
@@ -543,15 +539,15 @@ bool QmlProfilerData::save(const QString &filename)
for (const QQmlProfilerEvent &event : qAsConst(d->events)) {
const QQmlProfilerEventType &type = d->eventTypes.at(event.typeIndex());
- if (type.rangeType() != QQmlProfilerDefinitions::MaximumRangeType) {
+ if (type.rangeType() != MaximumRangeType) {
QQueue<QQmlProfilerEvent> &starts = rangeStarts[type.rangeType()];
switch (event.rangeStage()) {
- case QQmlProfilerDefinitions::RangeStart: {
+ case RangeStart: {
++level;
starts.enqueue(event);
break;
}
- case QQmlProfilerDefinitions::RangeEnd: {
+ case RangeEnd: {
QStack<qint64> &ends = rangeEnds[type.rangeType()];
if (starts.length() > ends.length()) {
ends.push(event.timestamp());
@@ -571,7 +567,7 @@ bool QmlProfilerData::save(const QString &filename)
}
}
- for (int i = 0; i < QQmlProfilerDefinitions::MaximumRangeType; ++i) {
+ for (int i = 0; i < MaximumRangeType; ++i) {
while (rangeEnds[i].length() < rangeStarts[i].length()) {
rangeEnds[i].push(d->traceEndTime);
--level;
diff --git a/tools/qmlprofiler/qmlprofilerdata.h b/tools/qmlprofiler/qmlprofilerdata.h
index 2be0b73aee..16ebc37f28 100644
--- a/tools/qmlprofiler/qmlprofilerdata.h
+++ b/tools/qmlprofiler/qmlprofilerdata.h
@@ -29,7 +29,7 @@
#ifndef QMLPROFILERDATA_H
#define QMLPROFILERDATA_H
-#include <private/qqmlprofilerdefinitions_p.h>
+#include <private/qqmlprofilerclientdefinitions_p.h>
#include <private/qqmlprofilereventlocation_p.h>
#include <private/qqmlprofilereventreceiver_p.h>
@@ -55,8 +55,8 @@ public:
void addEvent(const QQmlProfilerEvent &event) override;
static QString getHashStringForQmlEvent(const QQmlProfilerEventLocation &location, int eventType);
- static QString qmlRangeTypeAsString(QQmlProfilerDefinitions::RangeType type);
- static QString qmlMessageAsString(QQmlProfilerDefinitions::Message type);
+ static QString qmlRangeTypeAsString(RangeType type);
+ static QString qmlMessageAsString(Message type);
qint64 traceStartTime() const;
qint64 traceEndTime() const;