aboutsummaryrefslogtreecommitdiffstats
path: root/tools/qmlprofiler
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@theqtcompany.com>2015-07-08 16:03:51 +0200
committerUlf Hermann <ulf.hermann@theqtcompany.com>2015-07-23 08:26:04 +0000
commit30ead66c6238b4eea4867a540975e4ad8f343dbc (patch)
treea22d382054b099ba1210a84a2a38d2ec19751d4f /tools/qmlprofiler
parent1e2e356f0f4f9f7dd424bc69cff0dce956f528e5 (diff)
qmlprofiler: Use QQmlProfilerDefinitions for accessing definitions
Change-Id: I6def7dd8a0ce0db22ad4829029d8510f5869c813 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'tools/qmlprofiler')
-rw-r--r--tools/qmlprofiler/qmlprofilerapplication.cpp22
-rw-r--r--tools/qmlprofiler/qmlprofilerclient.cpp115
-rw-r--r--tools/qmlprofiler/qmlprofilerclient.h14
-rw-r--r--tools/qmlprofiler/qmlprofilerdata.cpp106
-rw-r--r--tools/qmlprofiler/qmlprofilerdata.h18
5 files changed, 144 insertions, 131 deletions
diff --git a/tools/qmlprofiler/qmlprofilerapplication.cpp b/tools/qmlprofiler/qmlprofilerapplication.cpp
index 8633810790..188373ccc6 100644
--- a/tools/qmlprofiler/qmlprofilerapplication.cpp
+++ b/tools/qmlprofiler/qmlprofilerapplication.cpp
@@ -97,26 +97,26 @@ QmlProfilerApplication::QmlProfilerApplication(int &argc, char **argv) :
connect(&m_connection, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(connectionError(QAbstractSocket::SocketError)));
connect(&m_qmlProfilerClient, SIGNAL(enabledChanged()), this, SLOT(traceClientEnabled()));
- connect(&m_qmlProfilerClient, SIGNAL(range(QQmlProfilerService::RangeType,QQmlProfilerService::BindingType,qint64,qint64,QStringList,QmlEventLocation)),
- &m_profilerData, SLOT(addQmlEvent(QQmlProfilerService::RangeType,QQmlProfilerService::BindingType,qint64,qint64,QStringList,QmlEventLocation)));
+ connect(&m_qmlProfilerClient, SIGNAL(range(QQmlProfilerDefinitions::RangeType,QQmlProfilerDefinitions::BindingType,qint64,qint64,QStringList,QmlEventLocation)),
+ &m_profilerData, SLOT(addQmlEvent(QQmlProfilerDefinitions::RangeType,QQmlProfilerDefinitions::BindingType,qint64,qint64,QStringList,QmlEventLocation)));
connect(&m_qmlProfilerClient, SIGNAL(traceFinished(qint64)), &m_profilerData, SLOT(setTraceEndTime(qint64)));
connect(&m_qmlProfilerClient, SIGNAL(traceStarted(qint64)), &m_profilerData, SLOT(setTraceStartTime(qint64)));
connect(&m_qmlProfilerClient, SIGNAL(traceStarted(qint64)), this, SLOT(notifyTraceStarted()));
connect(&m_qmlProfilerClient, SIGNAL(frame(qint64,int,int,int)), &m_profilerData, SLOT(addFrameEvent(qint64,int,int,int)));
- connect(&m_qmlProfilerClient, SIGNAL(sceneGraphFrame(QQmlProfilerService::SceneGraphFrameType,
+ connect(&m_qmlProfilerClient, SIGNAL(sceneGraphFrame(QQmlProfilerDefinitions::SceneGraphFrameType,
qint64,qint64,qint64,qint64,qint64,qint64)),
- &m_profilerData, SLOT(addSceneGraphFrameEvent(QQmlProfilerService::SceneGraphFrameType,
+ &m_profilerData, SLOT(addSceneGraphFrameEvent(QQmlProfilerDefinitions::SceneGraphFrameType,
qint64,qint64,qint64,qint64,qint64,qint64)));
- connect(&m_qmlProfilerClient, SIGNAL(pixmapCache(QQmlProfilerService::PixmapEventType,qint64,
+ connect(&m_qmlProfilerClient, SIGNAL(pixmapCache(QQmlProfilerDefinitions::PixmapEventType,qint64,
QmlEventLocation,int,int,int)),
- &m_profilerData, SLOT(addPixmapCacheEvent(QQmlProfilerService::PixmapEventType,qint64,
+ &m_profilerData, SLOT(addPixmapCacheEvent(QQmlProfilerDefinitions::PixmapEventType,qint64,
QmlEventLocation,int,int,int)));
- connect(&m_qmlProfilerClient, SIGNAL(memoryAllocation(QQmlProfilerService::MemoryType,qint64,
+ connect(&m_qmlProfilerClient, SIGNAL(memoryAllocation(QQmlProfilerDefinitions::MemoryType,qint64,
qint64)),
- &m_profilerData, SLOT(addMemoryEvent(QQmlProfilerService::MemoryType,qint64,
+ &m_profilerData, SLOT(addMemoryEvent(QQmlProfilerDefinitions::MemoryType,qint64,
qint64)));
- connect(&m_qmlProfilerClient, SIGNAL(inputEvent(QQmlProfilerService::EventType,qint64)),
- &m_profilerData, SLOT(addInputEvent(QQmlProfilerService::EventType,qint64)));
+ connect(&m_qmlProfilerClient, SIGNAL(inputEvent(QQmlProfilerDefinitions::EventType,qint64)),
+ &m_profilerData, SLOT(addInputEvent(QQmlProfilerDefinitions::EventType,qint64)));
connect(&m_qmlProfilerClient, SIGNAL(complete()), this, SLOT(qmlComplete()));
@@ -184,7 +184,7 @@ void QmlProfilerApplication::parseArguments()
parser.addOption(record);
QStringList featureList;
- for (int i = 0; i < QQmlProfilerService::MaximumProfileFeature; ++i)
+ for (int i = 0; i < QQmlProfilerDefinitions::MaximumProfileFeature; ++i)
featureList << QLatin1String(features[i]);
QCommandLineOption include(QLatin1String("include"),
diff --git a/tools/qmlprofiler/qmlprofilerclient.cpp b/tools/qmlprofiler/qmlprofilerclient.cpp
index 4976a5a0d9..4bebd74579 100644
--- a/tools/qmlprofiler/qmlprofilerclient.cpp
+++ b/tools/qmlprofiler/qmlprofilerclient.cpp
@@ -35,6 +35,7 @@
#include <QtCore/QStack>
#include <QtCore/QStringList>
+#include <QtCore/QDataStream>
ProfilerClient::ProfilerClient(const QString &clientName,
QQmlDebugConnection *client)
@@ -73,16 +74,15 @@ public:
QmlProfilerClientPrivate()
: inProgressRanges(0) , features(std::numeric_limits<quint64>::max())
{
- ::memset(rangeCount, 0,
- QQmlProfilerService::MaximumRangeType * sizeof(int));
+ ::memset(rangeCount, 0, QQmlProfilerDefinitions::MaximumRangeType * sizeof(int));
}
qint64 inProgressRanges;
- QStack<qint64> rangeStartTimes[QQmlProfilerService::MaximumRangeType];
- QStack<QStringList> rangeDatas[QQmlProfilerService::MaximumRangeType];
- QStack<QmlEventLocation> rangeLocations[QQmlProfilerService::MaximumRangeType];
- QStack<QQmlProfilerService::BindingType> bindingTypes;
- int rangeCount[QQmlProfilerService::MaximumRangeType];
+ QStack<qint64> rangeStartTimes[QQmlProfilerDefinitions::MaximumRangeType];
+ QStack<QStringList> rangeDatas[QQmlProfilerDefinitions::MaximumRangeType];
+ QStack<QmlEventLocation> rangeLocations[QQmlProfilerDefinitions::MaximumRangeType];
+ QStack<QQmlProfilerDefinitions::BindingType> bindingTypes;
+ int rangeCount[QQmlProfilerDefinitions::MaximumRangeType];
quint64 features;
};
@@ -106,8 +106,7 @@ void QmlProfilerClient::setFeatures(quint64 features)
void QmlProfilerClient::clearData()
{
- ::memset(d->rangeCount, 0,
- QQmlProfilerService::MaximumRangeType * sizeof(int));
+ ::memset(d->rangeCount, 0, QQmlProfilerDefinitions::MaximumRangeType * sizeof(int));
d->bindingTypes.clear();
ProfilerClient::clearData();
}
@@ -120,24 +119,24 @@ void QmlProfilerClient::sendRecordingStatus(bool record)
sendMessage(ba);
}
-inline QQmlProfilerService::ProfileFeature featureFromRangeType(
- QQmlProfilerService::RangeType range)
+inline QQmlProfilerDefinitions::ProfileFeature featureFromRangeType(
+ QQmlProfilerDefinitions::RangeType range)
{
switch (range) {
- case QQmlProfilerService::Painting:
- return QQmlProfilerService::ProfilePainting;
- case QQmlProfilerService::Compiling:
- return QQmlProfilerService::ProfileCompiling;
- case QQmlProfilerService::Creating:
- return QQmlProfilerService::ProfileCreating;
- case QQmlProfilerService::Binding:
- return QQmlProfilerService::ProfileBinding;
- case QQmlProfilerService::HandlingSignal:
- return QQmlProfilerService::ProfileHandlingSignal;
- case QQmlProfilerService::Javascript:
- return QQmlProfilerService::ProfileJavaScript;
+ case QQmlProfilerDefinitions::Painting:
+ return QQmlProfilerDefinitions::ProfilePainting;
+ case QQmlProfilerDefinitions::Compiling:
+ return QQmlProfilerDefinitions::ProfileCompiling;
+ case QQmlProfilerDefinitions::Creating:
+ return QQmlProfilerDefinitions::ProfileCreating;
+ case QQmlProfilerDefinitions::Binding:
+ return QQmlProfilerDefinitions::ProfileBinding;
+ case QQmlProfilerDefinitions::HandlingSignal:
+ return QQmlProfilerDefinitions::ProfileHandlingSignal;
+ case QQmlProfilerDefinitions::Javascript:
+ return QQmlProfilerDefinitions::ProfileJavaScript;
default:
- return QQmlProfilerService::MaximumProfileFeature;
+ return QQmlProfilerDefinitions::MaximumProfileFeature;
}
}
@@ -154,17 +153,17 @@ void QmlProfilerClient::messageReceived(const QByteArray &data)
stream >> time >> messageType;
- if (messageType >= QQmlProfilerService::MaximumMessage)
+ if (messageType >= QQmlProfilerDefinitions::MaximumMessage)
return;
- if (messageType == QQmlProfilerService::Event) {
+ if (messageType == QQmlProfilerDefinitions::Event) {
int event;
stream >> event;
- if (event == QQmlProfilerService::EndTrace) {
+ if (event == QQmlProfilerDefinitions::EndTrace) {
emit this->traceFinished(time);
- } else if (event == QQmlProfilerService::AnimationFrame) {
- if (!(d->features & one << QQmlProfilerService::ProfileAnimations))
+ } else if (event == QQmlProfilerDefinitions::AnimationFrame) {
+ if (!(d->features & one << QQmlProfilerDefinitions::ProfileAnimations))
return;
int frameRate, animationCount;
int threadId = 0;
@@ -172,17 +171,18 @@ void QmlProfilerClient::messageReceived(const QByteArray &data)
if (!stream.atEnd())
stream >> threadId;
emit this->frame(time, frameRate, animationCount, threadId);
- } else if (event == QQmlProfilerService::StartTrace) {
+ } else if (event == QQmlProfilerDefinitions::StartTrace) {
emit this->traceStarted(time);
- } else if (event == QQmlProfilerService::Key || event == QQmlProfilerService::Mouse) {
- if (!(d->features & one << QQmlProfilerService::ProfileInputEvents))
+ } else if (event == QQmlProfilerDefinitions::Key ||
+ event == QQmlProfilerDefinitions::Mouse) {
+ if (!(d->features & one << QQmlProfilerDefinitions::ProfileInputEvents))
return;
- emit this->inputEvent((QQmlProfilerService::EventType)event, time);
+ emit this->inputEvent((QQmlProfilerDefinitions::EventType)event, time);
}
- } else if (messageType == QQmlProfilerService::Complete) {
+ } else if (messageType == QQmlProfilerDefinitions::Complete) {
emit complete();
- } else if (messageType == QQmlProfilerService::SceneGraphFrame) {
- if (!(d->features & one << QQmlProfilerService::ProfileSceneGraph))
+ } else if (messageType == QQmlProfilerDefinitions::SceneGraphFrame) {
+ if (!(d->features & one << QQmlProfilerDefinitions::ProfileSceneGraph))
return;
int sgEventType;
int count = 0;
@@ -194,54 +194,54 @@ void QmlProfilerClient::messageReceived(const QByteArray &data)
}
while (count<5)
params[count++] = 0;
- emit sceneGraphFrame((QQmlProfilerService::SceneGraphFrameType)sgEventType, time,
+ emit sceneGraphFrame((QQmlProfilerDefinitions::SceneGraphFrameType)sgEventType, time,
params[0], params[1], params[2], params[3], params[4]);
- } else if (messageType == QQmlProfilerService::PixmapCacheEvent) {
- if (!(d->features & one << QQmlProfilerService::ProfilePixmapCache))
+ } else if (messageType == QQmlProfilerDefinitions::PixmapCacheEvent) {
+ if (!(d->features & one << QQmlProfilerDefinitions::ProfilePixmapCache))
return;
int pixEvTy, width = 0, height = 0, refcount = 0;
QString pixUrl;
stream >> pixEvTy >> pixUrl;
- if (pixEvTy == (int)QQmlProfilerService::PixmapReferenceCountChanged ||
- pixEvTy == (int)QQmlProfilerService::PixmapCacheCountChanged) {
+ if (pixEvTy == (int)QQmlProfilerDefinitions::PixmapReferenceCountChanged ||
+ pixEvTy == (int)QQmlProfilerDefinitions::PixmapCacheCountChanged) {
stream >> refcount;
- } else if (pixEvTy == (int)QQmlProfilerService::PixmapSizeKnown) {
+ } else if (pixEvTy == (int)QQmlProfilerDefinitions::PixmapSizeKnown) {
stream >> width >> height;
refcount = 1;
}
- emit pixmapCache((QQmlProfilerService::PixmapEventType)pixEvTy, time,
+ emit pixmapCache((QQmlProfilerDefinitions::PixmapEventType)pixEvTy, time,
QmlEventLocation(pixUrl,0,0), width, height, refcount);
- } else if (messageType == QQmlProfilerService::MemoryAllocation) {
- if (!(d->features & one << QQmlProfilerService::ProfileMemory))
+ } else if (messageType == QQmlProfilerDefinitions::MemoryAllocation) {
+ if (!(d->features & one << QQmlProfilerDefinitions::ProfileMemory))
return;
int type;
qint64 delta;
stream >> type >> delta;
- emit memoryAllocation((QQmlProfilerService::MemoryType)type, time, delta);
+ emit memoryAllocation((QQmlProfilerDefinitions::MemoryType)type, time, delta);
} else {
int range;
stream >> range;
- if (range >= QQmlProfilerService::MaximumRangeType)
+ if (range >= QQmlProfilerDefinitions::MaximumRangeType)
return;
if (!(d->features & one << featureFromRangeType(
- static_cast<QQmlProfilerService::RangeType>(range))))
+ static_cast<QQmlProfilerDefinitions::RangeType>(range))))
return;
- if (messageType == QQmlProfilerService::RangeStart) {
+ if (messageType == QQmlProfilerDefinitions::RangeStart) {
d->rangeStartTimes[range].push(time);
d->inProgressRanges |= (static_cast<qint64>(1) << range);
++d->rangeCount[range];
// read binding type
- if (range == (int)QQmlProfilerService::Binding) {
- int bindingType = (int)QQmlProfilerService::QmlBinding;
+ if (range == (int)QQmlProfilerDefinitions::Binding) {
+ int bindingType = (int)QQmlProfilerDefinitions::QmlBinding;
if (!stream.atEnd())
stream >> bindingType;
- d->bindingTypes.push((QQmlProfilerService::BindingType)bindingType);
+ d->bindingTypes.push((QQmlProfilerDefinitions::BindingType)bindingType);
}
- } else if (messageType == QQmlProfilerService::RangeData) {
+ } else if (messageType == QQmlProfilerDefinitions::RangeData) {
QString data;
stream >> data;
@@ -252,7 +252,7 @@ void QmlProfilerClient::messageReceived(const QByteArray &data)
d->rangeDatas[range][count-1] << data;
}
- } else if (messageType == QQmlProfilerService::RangeLocation) {
+ } else if (messageType == QQmlProfilerDefinitions::RangeLocation) {
QString fileName;
int line;
int column = -1;
@@ -277,10 +277,11 @@ void QmlProfilerClient::messageReceived(const QByteArray &data)
d->rangeLocations[range].pop() : QmlEventLocation();
qint64 startTime = d->rangeStartTimes[range].pop();
- QQmlProfilerService::BindingType bindingType = QQmlProfilerService::QmlBinding;
- if (range == (int)QQmlProfilerService::Binding)
+ QQmlProfilerDefinitions::BindingType bindingType =
+ QQmlProfilerDefinitions::QmlBinding;
+ if (range == (int)QQmlProfilerDefinitions::Binding)
bindingType = d->bindingTypes.pop();
- emit this->range((QQmlProfilerService::RangeType)range,
+ emit this->range((QQmlProfilerDefinitions::RangeType)range,
bindingType, startTime, time - startTime, data, location);
if (d->rangeCount[range] == 0) {
int count = d->rangeDatas[range].count() +
diff --git a/tools/qmlprofiler/qmlprofilerclient.h b/tools/qmlprofiler/qmlprofilerclient.h
index f41ebbd4c9..731ab99973 100644
--- a/tools/qmlprofiler/qmlprofilerclient.h
+++ b/tools/qmlprofiler/qmlprofilerclient.h
@@ -35,8 +35,8 @@
#define QMLPROFILERCLIENT_H
#include "qqmldebugclient.h"
-#include <QtQml/private/qqmlprofilerservice_p.h>
#include "qmlprofilereventlocation.h"
+#include <QtQml/private/qqmlprofilerdefinitions_p.h>
class ProfilerClientPrivate;
class ProfilerClient : public QQmlDebugClient
@@ -83,19 +83,19 @@ public slots:
signals:
void traceFinished( qint64 time );
void traceStarted( qint64 time );
- void range(QQmlProfilerService::RangeType type,
- QQmlProfilerService::BindingType bindingType,
+ void range(QQmlProfilerDefinitions::RangeType type,
+ QQmlProfilerDefinitions::BindingType bindingType,
qint64 startTime, qint64 length,
const QStringList &data,
const QmlEventLocation &location);
void frame(qint64 time, int frameRate, int animationCount, int threadId);
- void sceneGraphFrame(QQmlProfilerService::SceneGraphFrameType type, qint64 time,
+ void sceneGraphFrame(QQmlProfilerDefinitions::SceneGraphFrameType type, qint64 time,
qint64 numericData1, qint64 numericData2, qint64 numericData3,
qint64 numericData4, qint64 numericData5);
- void pixmapCache(QQmlProfilerService::PixmapEventType, qint64 time,
+ void pixmapCache(QQmlProfilerDefinitions::PixmapEventType, qint64 time,
const QmlEventLocation &location, int width, int height, int refCount);
- void memoryAllocation(QQmlProfilerService::MemoryType type, qint64 time, qint64 amount);
- void inputEvent(QQmlProfilerService::EventType, qint64 time);
+ void memoryAllocation(QQmlProfilerDefinitions::MemoryType type, qint64 time, qint64 amount);
+ void inputEvent(QQmlProfilerDefinitions::EventType, qint64 time);
protected:
virtual void messageReceived(const QByteArray &);
diff --git a/tools/qmlprofiler/qmlprofilerdata.cpp b/tools/qmlprofiler/qmlprofilerdata.cpp
index 347c51c13b..5d49dc6708 100644
--- a/tools/qmlprofiler/qmlprofilerdata.cpp
+++ b/tools/qmlprofiler/qmlprofilerdata.cpp
@@ -72,16 +72,16 @@ struct QmlRangeEventData {
QmlRangeEventData() {} // never called
QmlRangeEventData(const QString &_displayName, int _detailType, const QString &_eventHashStr,
const QmlEventLocation &_location, const QString &_details,
- QQmlProfilerService::Message _message,
- QQmlProfilerService::RangeType _rangeType)
+ QQmlProfilerDefinitions::Message _message,
+ QQmlProfilerDefinitions::RangeType _rangeType)
: displayName(_displayName), eventHashStr(_eventHashStr), location(_location),
details(_details), message(_message), rangeType(_rangeType), detailType(_detailType) {}
QString displayName;
QString eventHashStr;
QmlEventLocation location;
QString details;
- QQmlProfilerService::Message message;
- QQmlProfilerService::RangeType rangeType;
+ QQmlProfilerDefinitions::Message message;
+ QQmlProfilerDefinitions::RangeType rangeType;
int detailType; // can be BindingType, PixmapCacheEventType or SceneGraphFrameType
};
@@ -208,7 +208,7 @@ QString QmlProfilerData::getHashStringForV8Event(const QString &displayName, con
return QString(QStringLiteral("%1:%2")).arg(displayName, function);
}
-QString QmlProfilerData::qmlRangeTypeAsString(QQmlProfilerService::RangeType type)
+QString QmlProfilerData::qmlRangeTypeAsString(QQmlProfilerDefinitions::RangeType type)
{
if (type * sizeof(QString) < sizeof(RANGE_TYPE_STRINGS))
return QLatin1String(RANGE_TYPE_STRINGS[type]);
@@ -216,7 +216,7 @@ QString QmlProfilerData::qmlRangeTypeAsString(QQmlProfilerService::RangeType typ
return QString::number(type);
}
-QString QmlProfilerData::qmlMessageAsString(QQmlProfilerService::Message type)
+QString QmlProfilerData::qmlMessageAsString(QQmlProfilerDefinitions::Message type)
{
if (type * sizeof(QString) < sizeof(MESSAGE_STRINGS))
return QLatin1String(MESSAGE_STRINGS[type]);
@@ -246,8 +246,8 @@ qint64 QmlProfilerData::traceEndTime() const
return d->traceEndTime;
}
-void QmlProfilerData::addQmlEvent(QQmlProfilerService::RangeType type,
- QQmlProfilerService::BindingType bindingType,
+void QmlProfilerData::addQmlEvent(QQmlProfilerDefinitions::RangeType type,
+ QQmlProfilerDefinitions::BindingType bindingType,
qint64 startTime,
qint64 duration,
const QStringList &data,
@@ -290,7 +290,7 @@ void QmlProfilerData::addQmlEvent(QQmlProfilerService::RangeType type,
newEvent = d->eventDescriptions[eventHashStr];
} else {
newEvent = new QmlRangeEventData(displayName, bindingType, eventHashStr, location, details,
- QQmlProfilerService::MaximumMessage, type);
+ QQmlProfilerDefinitions::MaximumMessage, type);
d->eventDescriptions.insert(eventHashStr, newEvent);
}
@@ -311,11 +311,11 @@ void QmlProfilerData::addFrameEvent(qint64 time, int framerate, int animationcou
if (d->eventDescriptions.contains(eventHashStr)) {
newEvent = d->eventDescriptions[eventHashStr];
} else {
- newEvent = new QmlRangeEventData(displayName, QQmlProfilerService::AnimationFrame,
+ newEvent = new QmlRangeEventData(displayName, QQmlProfilerDefinitions::AnimationFrame,
eventHashStr,
QmlEventLocation(), details,
- QQmlProfilerService::Event,
- QQmlProfilerService::MaximumRangeType);
+ QQmlProfilerDefinitions::Event,
+ QQmlProfilerDefinitions::MaximumRangeType);
d->eventDescriptions.insert(eventHashStr, newEvent);
}
@@ -325,7 +325,10 @@ void QmlProfilerData::addFrameEvent(qint64 time, int framerate, int animationcou
d->startInstanceList.append(rangeEventStartInstance);
}
-void QmlProfilerData::addSceneGraphFrameEvent(QQmlProfilerDefinitions::SceneGraphFrameType type, qint64 time, qint64 numericData1, qint64 numericData2, qint64 numericData3, qint64 numericData4, qint64 numericData5)
+void QmlProfilerData::addSceneGraphFrameEvent(QQmlProfilerDefinitions::SceneGraphFrameType type,
+ qint64 time, qint64 numericData1, qint64 numericData2,
+ qint64 numericData3, qint64 numericData4,
+ qint64 numericData5)
{
setState(AcquiringData);
@@ -336,8 +339,8 @@ void QmlProfilerData::addSceneGraphFrameEvent(QQmlProfilerDefinitions::SceneGrap
} else {
newEvent = new QmlRangeEventData(QStringLiteral("<SceneGraph>"), type, eventHashStr,
QmlEventLocation(), QString(),
- QQmlProfilerService::SceneGraphFrame,
- QQmlProfilerService::MaximumRangeType);
+ QQmlProfilerDefinitions::SceneGraphFrame,
+ QQmlProfilerDefinitions::MaximumRangeType);
d->eventDescriptions.insert(eventHashStr, newEvent);
}
@@ -362,8 +365,8 @@ void QmlProfilerData::addPixmapCacheEvent(QQmlProfilerDefinitions::PixmapEventTy
newEvent = d->eventDescriptions[eventHashStr];
} else {
newEvent = new QmlRangeEventData(eventHashStr, type, eventHashStr, location, QString(),
- QQmlProfilerService::PixmapCacheEvent,
- QQmlProfilerService::MaximumRangeType);
+ QQmlProfilerDefinitions::PixmapCacheEvent,
+ QQmlProfilerDefinitions::MaximumRangeType);
d->eventDescriptions.insert(eventHashStr, newEvent);
}
@@ -372,7 +375,7 @@ void QmlProfilerData::addPixmapCacheEvent(QQmlProfilerDefinitions::PixmapEventTy
d->startInstanceList.append(rangeEventStartInstance);
}
-void QmlProfilerData::addMemoryEvent(QQmlProfilerService::MemoryType type, qint64 time,
+void QmlProfilerData::addMemoryEvent(QQmlProfilerDefinitions::MemoryType type, qint64 time,
qint64 size)
{
setState(AcquiringData);
@@ -382,8 +385,8 @@ void QmlProfilerData::addMemoryEvent(QQmlProfilerService::MemoryType type, qint6
newEvent = d->eventDescriptions[eventHashStr];
} else {
newEvent = new QmlRangeEventData(eventHashStr, type, eventHashStr, QmlEventLocation(),
- QString(), QQmlProfilerService::MemoryAllocation,
- QQmlProfilerService::MaximumRangeType);
+ QString(), QQmlProfilerDefinitions::MemoryAllocation,
+ QQmlProfilerDefinitions::MaximumRangeType);
d->eventDescriptions.insert(eventHashStr, newEvent);
}
QmlRangeEventStartInstance rangeEventStartInstance(time, size, 0, 0, 0, 0, newEvent);
@@ -401,8 +404,8 @@ void QmlProfilerData::addInputEvent(QQmlProfilerDefinitions::EventType type, qin
newEvent = d->eventDescriptions[eventHashStr];
} else {
newEvent = new QmlRangeEventData(QString(), type, eventHashStr, QmlEventLocation(),
- QString(), QQmlProfilerService::Event,
- QQmlProfilerService::MaximumRangeType);
+ QString(), QQmlProfilerDefinitions::Event,
+ QQmlProfilerDefinitions::MaximumRangeType);
d->eventDescriptions.insert(eventHashStr, newEvent);
}
@@ -489,7 +492,7 @@ void QmlProfilerData::computeQmlTime()
for (int i = 0; i < d->startInstanceList.count(); i++) {
qint64 st = d->startInstanceList[i].startTime;
- if (d->startInstanceList[i].data->rangeType == QQmlProfilerService::Painting) {
+ if (d->startInstanceList[i].data->rangeType == QQmlProfilerDefinitions::Painting) {
continue;
}
@@ -601,9 +604,10 @@ bool QmlProfilerData::save(const QString &filename)
foreach (const QmlRangeEventData *eventData, d->eventDescriptions.values()) {
stream.writeStartElement(QStringLiteral("event"));
- stream.writeAttribute(QStringLiteral("index"), QString::number(d->eventDescriptions.keys().indexOf(eventData->eventHashStr)));
+ stream.writeAttribute(QStringLiteral("index"), QString::number(
+ d->eventDescriptions.keys().indexOf(eventData->eventHashStr)));
stream.writeTextElement(QStringLiteral("displayname"), eventData->displayName);
- if (eventData->rangeType != QQmlProfilerService::MaximumRangeType)
+ if (eventData->rangeType != QQmlProfilerDefinitions::MaximumRangeType)
stream.writeTextElement(QStringLiteral("type"),
qmlRangeTypeAsString(eventData->rangeType));
else
@@ -611,35 +615,37 @@ bool QmlProfilerData::save(const QString &filename)
qmlMessageAsString(eventData->message));
if (!eventData->location.filename.isEmpty()) {
stream.writeTextElement(QStringLiteral("filename"), eventData->location.filename);
- stream.writeTextElement(QStringLiteral("line"), QString::number(eventData->location.line));
- stream.writeTextElement(QStringLiteral("column"), QString::number(eventData->location.column));
+ stream.writeTextElement(QStringLiteral("line"),
+ QString::number(eventData->location.line));
+ stream.writeTextElement(QStringLiteral("column"),
+ QString::number(eventData->location.column));
}
stream.writeTextElement(QStringLiteral("details"), eventData->details);
- if (eventData->rangeType == QQmlProfilerService::Binding)
+ if (eventData->rangeType == QQmlProfilerDefinitions::Binding)
stream.writeTextElement(QStringLiteral("bindingType"),
QString::number((int)eventData->detailType));
- else if (eventData->message == QQmlProfilerService::Event) {
+ else if (eventData->message == QQmlProfilerDefinitions::Event) {
switch (eventData->detailType) {
- case QQmlProfilerService::AnimationFrame:
+ case QQmlProfilerDefinitions::AnimationFrame:
stream.writeTextElement(QStringLiteral("animationFrame"),
QString::number((int)eventData->detailType));
break;
- case QQmlProfilerService::Key:
+ case QQmlProfilerDefinitions::Key:
stream.writeTextElement(QStringLiteral("keyEvent"),
QString::number((int)eventData->detailType));
break;
- case QQmlProfilerService::Mouse:
+ case QQmlProfilerDefinitions::Mouse:
stream.writeTextElement(QStringLiteral("mouseEvent"),
QString::number((int)eventData->detailType));
break;
}
- } else if (eventData->message == QQmlProfilerService::PixmapCacheEvent)
+ } else if (eventData->message == QQmlProfilerDefinitions::PixmapCacheEvent)
stream.writeTextElement(QStringLiteral("cacheEventType"),
QString::number((int)eventData->detailType));
- else if (eventData->message == QQmlProfilerService::SceneGraphFrame)
+ else if (eventData->message == QQmlProfilerDefinitions::SceneGraphFrame)
stream.writeTextElement(QStringLiteral("sgEventType"),
QString::number((int)eventData->detailType));
- else if (eventData->message == QQmlProfilerService::MemoryAllocation)
+ else if (eventData->message == QQmlProfilerDefinitions::MemoryAllocation)
stream.writeTextElement(QStringLiteral("memoryEventType"),
QString::number((int)eventData->detailType));
stream.writeEndElement();
@@ -653,26 +659,30 @@ bool QmlProfilerData::save(const QString &filename)
if (event.duration >= 0)
stream.writeAttribute(QStringLiteral("duration"),
QString::number(event.duration));
- stream.writeAttribute(QStringLiteral("eventIndex"), QString::number(d->eventDescriptions.keys().indexOf(event.data->eventHashStr)));
- if (event.data->message == QQmlProfilerService::Event &&
- event.data->detailType == QQmlProfilerService::AnimationFrame) {
+ stream.writeAttribute(QStringLiteral("eventIndex"), QString::number(
+ d->eventDescriptions.keys().indexOf(event.data->eventHashStr)));
+ if (event.data->message == QQmlProfilerDefinitions::Event &&
+ event.data->detailType == QQmlProfilerDefinitions::AnimationFrame) {
// special: animation frame
stream.writeAttribute(QStringLiteral("framerate"), QString::number(event.frameRate));
- stream.writeAttribute(QStringLiteral("animationcount"), QString::number(event.animationCount));
+ stream.writeAttribute(QStringLiteral("animationcount"),
+ QString::number(event.animationCount));
stream.writeAttribute(QStringLiteral("thread"), QString::number(event.threadId));
- } else if (event.data->message == QQmlProfilerService::PixmapCacheEvent) {
+ } else if (event.data->message == QQmlProfilerDefinitions::PixmapCacheEvent) {
// special: pixmap cache event
- if (event.data->detailType == QQmlProfilerService::PixmapSizeKnown) {
+ if (event.data->detailType == QQmlProfilerDefinitions::PixmapSizeKnown) {
stream.writeAttribute(QStringLiteral("width"),
QString::number(event.numericData1));
stream.writeAttribute(QStringLiteral("height"),
QString::number(event.numericData2));
- } else if (event.data->detailType == QQmlProfilerService::PixmapReferenceCountChanged ||
- event.data->detailType == QQmlProfilerService::PixmapCacheCountChanged) {
+ } else if (event.data->detailType ==
+ QQmlProfilerDefinitions::PixmapReferenceCountChanged ||
+ event.data->detailType ==
+ QQmlProfilerDefinitions::PixmapCacheCountChanged) {
stream.writeAttribute(QStringLiteral("refCount"),
QString::number(event.numericData3));
}
- } else if (event.data->message == QQmlProfilerService::SceneGraphFrame) {
+ } else if (event.data->message == QQmlProfilerDefinitions::SceneGraphFrame) {
// special: scenegraph frame events
if (event.numericData1 > 0)
stream.writeAttribute(QStringLiteral("timing1"),
@@ -689,7 +699,7 @@ bool QmlProfilerData::save(const QString &filename)
if (event.numericData5 > 0)
stream.writeAttribute(QStringLiteral("timing5"),
QString::number(event.numericData5));
- } else if (event.data->message == QQmlProfilerService::MemoryAllocation) {
+ } else if (event.data->message == QQmlProfilerDefinitions::MemoryAllocation) {
stream.writeAttribute(QStringLiteral("amount"), QString::number(event.numericData1));
}
stream.writeEndElement();
@@ -700,7 +710,8 @@ bool QmlProfilerData::save(const QString &filename)
stream.writeAttribute(QStringLiteral("totalTime"), QString::number(d->v8MeasuredTime));
foreach (QV8EventInfo *v8event, d->v8EventHash.values()) {
stream.writeStartElement(QStringLiteral("event"));
- stream.writeAttribute(QStringLiteral("index"), QString::number(d->v8EventHash.keys().indexOf(v8event->eventHashStr)));
+ stream.writeAttribute(QStringLiteral("index"),QString::number(
+ d->v8EventHash.keys().indexOf(v8event->eventHashStr)));
stream.writeTextElement(QStringLiteral("displayname"), v8event->displayName);
stream.writeTextElement(QStringLiteral("functionname"), v8event->functionName);
if (!v8event->fileName.isEmpty()) {
@@ -719,7 +730,8 @@ bool QmlProfilerData::save(const QString &filename)
}
stream.writeAttribute(QStringLiteral("list"), childrenIndexes.join(QString(", ")));
- stream.writeAttribute(QStringLiteral("childrenTimes"), childrenTimes.join(QString(", ")));
+ stream.writeAttribute(QStringLiteral("childrenTimes"),
+ childrenTimes.join(QString(", ")));
stream.writeEndElement();
}
stream.writeEndElement();
diff --git a/tools/qmlprofiler/qmlprofilerdata.h b/tools/qmlprofiler/qmlprofilerdata.h
index ef8ef10929..91c16c3222 100644
--- a/tools/qmlprofiler/qmlprofilerdata.h
+++ b/tools/qmlprofiler/qmlprofilerdata.h
@@ -34,9 +34,9 @@
#ifndef QMLPROFILERDATA_H
#define QMLPROFILERDATA_H
-#include <QtQml/private/qqmlprofilerservice_p.h>
#include "qmlprofilereventlocation.h"
+#include <QtQml/private/qqmlprofilerdefinitions_p.h>
#include <QObject>
class QmlProfilerDataPrivate;
@@ -56,8 +56,8 @@ public:
static QString getHashStringForQmlEvent(const QmlEventLocation &location, int eventType);
static QString getHashStringForV8Event(const QString &displayName, const QString &function);
- static QString qmlRangeTypeAsString(QQmlProfilerService::RangeType type);
- static QString qmlMessageAsString(QQmlProfilerService::Message type);
+ static QString qmlRangeTypeAsString(QQmlProfilerDefinitions::RangeType type);
+ static QString qmlMessageAsString(QQmlProfilerDefinitions::Message type);
static QString rootEventName();
static QString rootEventDescription();
@@ -75,20 +75,20 @@ public slots:
void clear();
void setTraceEndTime(qint64 time);
void setTraceStartTime(qint64 time);
- void addQmlEvent(QQmlProfilerService::RangeType type,
- QQmlProfilerService::BindingType bindingType,
+ void addQmlEvent(QQmlProfilerDefinitions::RangeType type,
+ QQmlProfilerDefinitions::BindingType bindingType,
qint64 startTime, qint64 duration, const QStringList &data,
const QmlEventLocation &location);
void addV8Event(int depth, const QString &function, const QString &filename,
int lineNumber, double totalTime, double selfTime);
void addFrameEvent(qint64 time, int framerate, int animationcount, int threadId);
- void addSceneGraphFrameEvent(QQmlProfilerService::SceneGraphFrameType type, qint64 time,
+ void addSceneGraphFrameEvent(QQmlProfilerDefinitions::SceneGraphFrameType type, qint64 time,
qint64 numericData1, qint64 numericData2, qint64 numericData3,
qint64 numericData4, qint64 numericData5);
- void addPixmapCacheEvent(QQmlProfilerService::PixmapEventType type, qint64 time,
+ void addPixmapCacheEvent(QQmlProfilerDefinitions::PixmapEventType type, qint64 time,
const QmlEventLocation &location, int width, int height, int refcount);
- void addMemoryEvent(QQmlProfilerService::MemoryType type, qint64 time, qint64 size);
- void addInputEvent(QQmlProfilerService::EventType type, qint64 time);
+ void addMemoryEvent(QQmlProfilerDefinitions::MemoryType type, qint64 time, qint64 size);
+ void addInputEvent(QQmlProfilerDefinitions::EventType type, qint64 time);
void complete();
bool save(const QString &filename);