aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@theqtcompany.com>2015-09-17 13:39:00 +0200
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2015-10-30 20:07:53 +0000
commit57430b2bdad32150e0ed8ceb6893430363ee6670 (patch)
tree73820f2c3696577b23595f30e5d11588a944447c /tools
parentcdb0ddeffd1bab0afd4c763e44431b11c8e8e0b0 (diff)
Move QML profiler client to qmldebug
Change-Id: I506909b68be6cbad631d1645673c2d38460aed33 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/qmlprofiler/qmlprofiler.pro3
-rw-r--r--tools/qmlprofiler/qmlprofilerapplication.cpp32
-rw-r--r--tools/qmlprofiler/qmlprofilerclient.cpp310
-rw-r--r--tools/qmlprofiler/qmlprofilerclient.h55
-rw-r--r--tools/qmlprofiler/qmlprofilerdata.cpp31
-rw-r--r--tools/qmlprofiler/qmlprofilerdata.h10
-rw-r--r--tools/qmlprofiler/qmlprofilereventlocation.h53
7 files changed, 168 insertions, 326 deletions
diff --git a/tools/qmlprofiler/qmlprofiler.pro b/tools/qmlprofiler/qmlprofiler.pro
index 84e298fe9b..a65e25c657 100644
--- a/tools/qmlprofiler/qmlprofiler.pro
+++ b/tools/qmlprofiler/qmlprofiler.pro
@@ -12,7 +12,6 @@ HEADERS += \
commandlistener.h \
constants.h \
qmlprofilerdata.h \
- qmlprofilerclient.h \
- qmlprofilereventlocation.h
+ qmlprofilerclient.h
load(qt_tool)
diff --git a/tools/qmlprofiler/qmlprofilerapplication.cpp b/tools/qmlprofiler/qmlprofilerapplication.cpp
index 04d0ede54a..cd34cd603f 100644
--- a/tools/qmlprofiler/qmlprofilerapplication.cpp
+++ b/tools/qmlprofiler/qmlprofilerapplication.cpp
@@ -84,7 +84,7 @@ QmlProfilerApplication::QmlProfilerApplication(int &argc, char **argv) :
m_verbose(false),
m_recording(true),
m_interactive(false),
- m_qmlProfilerClient(&m_connection),
+ m_qmlProfilerClient(&m_connection, &m_profilerData),
m_connectionAttempts(0)
{
m_connectTimer.setInterval(1000);
@@ -94,30 +94,8 @@ QmlProfilerApplication::QmlProfilerApplication(int &argc, char **argv) :
connect(&m_qmlProfilerClient, SIGNAL(enabledChanged(bool)),
this, SLOT(traceClientEnabledChanged(bool)));
- 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(QQmlProfilerDefinitions::SceneGraphFrameType,
- qint64,qint64,qint64,qint64,qint64,qint64)),
- &m_profilerData, SLOT(addSceneGraphFrameEvent(QQmlProfilerDefinitions::SceneGraphFrameType,
- qint64,qint64,qint64,qint64,qint64,qint64)));
- connect(&m_qmlProfilerClient, SIGNAL(pixmapCache(QQmlProfilerDefinitions::PixmapEventType,qint64,
- QmlEventLocation,int,int,int)),
- &m_profilerData, SLOT(addPixmapCacheEvent(QQmlProfilerDefinitions::PixmapEventType,qint64,
- QmlEventLocation,int,int,int)));
- connect(&m_qmlProfilerClient, SIGNAL(memoryAllocation(QQmlProfilerDefinitions::MemoryType,qint64,
- qint64)),
- &m_profilerData, SLOT(addMemoryEvent(QQmlProfilerDefinitions::MemoryType,qint64,
- qint64)));
- connect(&m_qmlProfilerClient, SIGNAL(inputEvent(QQmlProfilerDefinitions::InputEventType,qint64,
- int,int)),
- &m_profilerData, SLOT(addInputEvent(QQmlProfilerDefinitions::InputEventType,qint64,int,
- int)));
-
- connect(&m_qmlProfilerClient, SIGNAL(complete()), &m_profilerData, SLOT(complete()));
+ connect(&m_qmlProfilerClient, SIGNAL(recordingStarted()), this, SLOT(notifyTraceStarted()));
+ connect(&m_qmlProfilerClient, SIGNAL(error(QString)), this, SLOT(logError(QString)));
connect(&m_profilerData, SIGNAL(error(QString)), this, SLOT(logError(QString)));
connect(&m_profilerData, SIGNAL(dataReady()), this, SLOT(traceFinished()));
@@ -557,7 +535,7 @@ void QmlProfilerApplication::processFinished()
if (!m_interactive)
exit(exitCode);
else
- m_qmlProfilerClient.clearData();
+ m_qmlProfilerClient.clearPendingData();
}
void QmlProfilerApplication::traceClientEnabledChanged(bool enabled)
@@ -583,7 +561,7 @@ void QmlProfilerApplication::traceFinished()
prompt(tr("Application stopped recording."), false);
}
- m_qmlProfilerClient.clearData();
+ m_qmlProfilerClient.clearPendingData();
}
void QmlProfilerApplication::prompt(const QString &line, bool ready)
diff --git a/tools/qmlprofiler/qmlprofilerclient.cpp b/tools/qmlprofiler/qmlprofilerclient.cpp
index 5e63529d35..018f1ec803 100644
--- a/tools/qmlprofiler/qmlprofilerclient.cpp
+++ b/tools/qmlprofiler/qmlprofilerclient.cpp
@@ -32,6 +32,9 @@
****************************************************************************/
#include "qmlprofilerclient.h"
+#include "qmlprofilerdata.h"
+
+#include <private/qqmlprofilerclient_p_p.h>
#include <QtCore/QStack>
#include <QtCore/QStringList>
@@ -39,43 +42,38 @@
#include <limits>
-class QmlProfilerClientPrivate
+class QmlProfilerClientPrivate : public QQmlProfilerClientPrivate
{
+ Q_DECLARE_PUBLIC(QmlProfilerClient)
public:
- QmlProfilerClientPrivate()
- : inProgressRanges(0) , features(std::numeric_limits<quint64>::max()), enabled(false)
- {
- ::memset(rangeCount, 0, QQmlProfilerDefinitions::MaximumRangeType * sizeof(int));
- }
+ QmlProfilerClientPrivate(QQmlDebugConnection *connection, QmlProfilerData *data);
+
+ QmlProfilerData *data;
qint64 inProgressRanges;
QStack<qint64> rangeStartTimes[QQmlProfilerDefinitions::MaximumRangeType];
QStack<QStringList> rangeDatas[QQmlProfilerDefinitions::MaximumRangeType];
- QStack<QmlEventLocation> rangeLocations[QQmlProfilerDefinitions::MaximumRangeType];
+ QStack<QQmlEventLocation> rangeLocations[QQmlProfilerDefinitions::MaximumRangeType];
int rangeCount[QQmlProfilerDefinitions::MaximumRangeType];
- quint64 features;
bool enabled;
};
-QmlProfilerClient::QmlProfilerClient(QQmlDebugConnection *client)
- : QQmlDebugClient(QStringLiteral("CanvasFrameRate"), client),
- d(new QmlProfilerClientPrivate)
+QmlProfilerClientPrivate::QmlProfilerClientPrivate(QQmlDebugConnection *connection,
+ QmlProfilerData *data) :
+ QQmlProfilerClientPrivate(connection), data(data), inProgressRanges(0), enabled(false)
{
+ ::memset(rangeCount, 0, QQmlProfilerDefinitions::MaximumRangeType * sizeof(int));
}
-QmlProfilerClient::~QmlProfilerClient()
+QmlProfilerClient::QmlProfilerClient(QQmlDebugConnection *connection, QmlProfilerData *data) :
+ QQmlProfilerClient(*(new QmlProfilerClientPrivate(connection, data)))
{
- delete d;
}
-void QmlProfilerClient::setFeatures(quint64 features)
-{
- d->features = features;
-}
-
-void QmlProfilerClient::clearData()
+void QmlProfilerClient::clearPendingData()
{
+ Q_D(QmlProfilerClient);
for (int i = 0; i < QQmlProfilerDefinitions::MaximumRangeType; ++i) {
d->rangeCount[i] = 0;
d->rangeDatas[i].clear();
@@ -83,202 +81,126 @@ void QmlProfilerClient::clearData()
}
}
-void QmlProfilerClient::sendRecordingStatus(bool record)
-{
- QByteArray ba;
- QDataStream stream(&ba, QIODevice::WriteOnly);
- stream << record << -1 << d->features;
- sendMessage(ba);
-}
-
-inline QQmlProfilerDefinitions::ProfileFeature featureFromRangeType(
- QQmlProfilerDefinitions::RangeType range)
-{
- switch (range) {
- 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 QQmlProfilerDefinitions::MaximumProfileFeature;
- }
-}
-
void QmlProfilerClient::stateChanged(State state)
{
+ Q_D(QmlProfilerClient);
if ((d->enabled && state != Enabled) || (!d->enabled && state == Enabled)) {
d->enabled = (state == Enabled);
emit enabledChanged(d->enabled);
}
}
-void QmlProfilerClient::messageReceived(const QByteArray &data)
+void QmlProfilerClient::traceStarted(qint64 time, int engineId)
{
- QByteArray rwData = data;
- QDataStream stream(&rwData, QIODevice::ReadOnly);
-
- // Force all the 1 << <FLAG> expressions to be done in 64 bit, to silence some warnings
- const quint64 one = static_cast<quint64>(1);
-
- qint64 time;
- int messageType;
-
- stream >> time >> messageType;
-
- if (messageType >= QQmlProfilerDefinitions::MaximumMessage)
- return;
-
- if (messageType == QQmlProfilerDefinitions::Event) {
- int event;
- stream >> event;
-
- if (event == QQmlProfilerDefinitions::EndTrace) {
- emit this->traceFinished(time);
- } else if (event == QQmlProfilerDefinitions::AnimationFrame) {
- if (!(d->features & one << QQmlProfilerDefinitions::ProfileAnimations))
- return;
- int frameRate, animationCount;
- int threadId = 0;
- stream >> frameRate >> animationCount;
- if (!stream.atEnd())
- stream >> threadId;
- emit this->frame(time, frameRate, animationCount, threadId);
- } else if (event == QQmlProfilerDefinitions::StartTrace) {
- emit this->traceStarted(time);
- } else if (event == QQmlProfilerDefinitions::Key ||
- event == QQmlProfilerDefinitions::Mouse) {
- if (!(d->features & one << QQmlProfilerDefinitions::ProfileInputEvents))
- return;
-
- int type;
- if (!stream.atEnd()) {
- stream >> type;
- } else {
- type = (event == QQmlProfilerDefinitions::Key) ?
- QQmlProfilerDefinitions::InputKeyUnknown :
- QQmlProfilerDefinitions::InputMouseUnknown;
- }
+ Q_UNUSED(engineId);
+ Q_D(QmlProfilerClient);
+ d->data->setTraceStartTime(time);
+ emit recordingStarted();
+}
- int a = 0;
- if (!stream.atEnd())
- stream >> a;
+void QmlProfilerClient::traceFinished(qint64 time, int engineId)
+{
+ Q_UNUSED(engineId);
+ Q_D(QmlProfilerClient);
+ d->data->setTraceEndTime(time);
+}
- int b = 0;
- if (!stream.atEnd())
- stream >> b;
+void QmlProfilerClient::rangeStart(QQmlProfilerDefinitions::RangeType type, qint64 startTime)
+{
+ Q_D(QmlProfilerClient);
+ d->rangeStartTimes[type].push(startTime);
+ d->inProgressRanges |= (static_cast<qint64>(1) << type);
+ ++d->rangeCount[type];
+}
- emit inputEvent(static_cast<QQmlProfilerDefinitions::InputEventType>(type), time, a, b);
- }
- } else if (messageType == QQmlProfilerDefinitions::Complete) {
- emit complete();
- } else if (messageType == QQmlProfilerDefinitions::SceneGraphFrame) {
- if (!(d->features & one << QQmlProfilerDefinitions::ProfileSceneGraph))
- return;
- int sgEventType;
- int count = 0;
- qint64 params[5];
+void QmlProfilerClient::rangeData(QQmlProfilerDefinitions::RangeType type, qint64 time,
+ const QString &data)
+{
+ Q_UNUSED(time);
+ Q_D(QmlProfilerClient);
+ int count = d->rangeCount[type];
+ if (count > 0) {
+ while (d->rangeDatas[type].count() < count)
+ d->rangeDatas[type].push(QStringList());
+ d->rangeDatas[type][count - 1] << data;
+ }
+}
- stream >> sgEventType;
- while (!stream.atEnd()) {
- stream >> params[count++];
- }
- while (count<5)
- params[count++] = 0;
- emit sceneGraphFrame((QQmlProfilerDefinitions::SceneGraphFrameType)sgEventType, time,
- params[0], params[1], params[2], params[3], params[4]);
- } 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)QQmlProfilerDefinitions::PixmapReferenceCountChanged ||
- pixEvTy == (int)QQmlProfilerDefinitions::PixmapCacheCountChanged) {
- stream >> refcount;
- } else if (pixEvTy == (int)QQmlProfilerDefinitions::PixmapSizeKnown) {
- stream >> width >> height;
- refcount = 1;
- }
- emit pixmapCache((QQmlProfilerDefinitions::PixmapEventType)pixEvTy, time,
- QmlEventLocation(pixUrl,0,0), width, height, refcount);
- } else if (messageType == QQmlProfilerDefinitions::MemoryAllocation) {
- if (!(d->features & one << QQmlProfilerDefinitions::ProfileMemory))
- return;
- int type;
- qint64 delta;
- stream >> type >> delta;
- emit memoryAllocation((QQmlProfilerDefinitions::MemoryType)type, time, delta);
- } else {
- int range;
- stream >> range;
+void QmlProfilerClient::rangeLocation(QQmlProfilerDefinitions::RangeType type, qint64 time,
+ const QQmlEventLocation &location)
+{
+ Q_UNUSED(time);
+ Q_D(QmlProfilerClient);
+ if (d->rangeCount[type] > 0)
+ d->rangeLocations[type].push(location);
+}
- if (range >= QQmlProfilerDefinitions::MaximumRangeType)
- return;
+void QmlProfilerClient::rangeEnd(QQmlProfilerDefinitions::RangeType type, qint64 endTime)
+{
+ Q_D(QmlProfilerClient);
- if (!(d->features & one << featureFromRangeType(
- static_cast<QQmlProfilerDefinitions::RangeType>(range))))
- return;
+ if (d->rangeCount[type] == 0) {
+ emit error(tr("Spurious range end detected."));
+ return;
+ }
- if (messageType == QQmlProfilerDefinitions::RangeStart) {
- d->rangeStartTimes[range].push(time);
- d->inProgressRanges |= (static_cast<qint64>(1) << range);
- ++d->rangeCount[range];
+ --d->rangeCount[type];
+ if (d->inProgressRanges & (static_cast<qint64>(1) << type))
+ d->inProgressRanges &= ~(static_cast<qint64>(1) << type);
+ QStringList data = d->rangeDatas[type].count() ? d->rangeDatas[type].pop() : QStringList();
+ QQmlEventLocation location = d->rangeLocations[type].count() ? d->rangeLocations[type].pop() :
+ QQmlEventLocation();
+ qint64 startTime = d->rangeStartTimes[type].pop();
+
+ if (d->rangeCount[type] == 0 && d->rangeDatas[type].count() + d->rangeStartTimes[type].count()
+ + d->rangeLocations[type].count() != 0) {
+ emit error(tr("Incorrectly nested range data"));
+ return;
+ }
- } else if (messageType == QQmlProfilerDefinitions::RangeData) {
- QString data;
- stream >> data;
+ d->data->addQmlEvent(type, QQmlProfilerDefinitions::QmlBinding, startTime, endTime - startTime,
+ data, location);
+}
- int count = d->rangeCount[range];
- if (count > 0) {
- while (d->rangeDatas[range].count() < count)
- d->rangeDatas[range].push(QStringList());
- d->rangeDatas[range][count-1] << data;
- }
+void QmlProfilerClient::animationFrame(qint64 time, int frameRate, int animationCount, int threadId)
+{
+ Q_D(QmlProfilerClient);
+ d->data->addFrameEvent(time, frameRate, animationCount, threadId);
+}
- } else if (messageType == QQmlProfilerDefinitions::RangeLocation) {
- QString fileName;
- int line;
- int column = -1;
- stream >> fileName >> line;
+void QmlProfilerClient::sceneGraphEvent(QQmlProfilerDefinitions::SceneGraphFrameType type,
+ qint64 time, qint64 numericData1, qint64 numericData2,
+ qint64 numericData3, qint64 numericData4,
+ qint64 numericData5)
+{
+ Q_D(QmlProfilerClient);
+ d->data->addSceneGraphFrameEvent(type, time, numericData1, numericData2, numericData3,
+ numericData4, numericData5);
+}
- if (!stream.atEnd())
- stream >> column;
+void QmlProfilerClient::pixmapCacheEvent(QQmlProfilerDefinitions::PixmapEventType type, qint64 time,
+ const QString &url, int numericData1, int numericData2)
+{
+ Q_D(QmlProfilerClient);
+ d->data->addPixmapCacheEvent(type, time, url, numericData1, numericData2);
+}
- if (d->rangeCount[range] > 0) {
- d->rangeLocations[range].push(QmlEventLocation(fileName, line,
- column));
- }
- } else {
- if (d->rangeCount[range] > 0) {
- --d->rangeCount[range];
- if (d->inProgressRanges & (static_cast<qint64>(1) << range))
- d->inProgressRanges &= ~(static_cast<qint64>(1) << range);
+void QmlProfilerClient::memoryAllocation(QQmlProfilerDefinitions::MemoryType type, qint64 time,
+ qint64 amount)
+{
+ Q_D(QmlProfilerClient);
+ d->data->addMemoryEvent(type, time, amount);
+}
- QStringList data = d->rangeDatas[range].count() ?
- d->rangeDatas[range].pop() : QStringList();
- QmlEventLocation location = d->rangeLocations[range].count() ?
- d->rangeLocations[range].pop() : QmlEventLocation();
+void QmlProfilerClient::inputEvent(QQmlProfilerDefinitions::InputEventType type, qint64 time,
+ int a, int b)
+{
+ Q_D(QmlProfilerClient);
+ d->data->addInputEvent(type, time, a, b);
+}
- qint64 startTime = d->rangeStartTimes[range].pop();
- emit this->range((QQmlProfilerDefinitions::RangeType)range,
- QQmlProfilerDefinitions::QmlBinding, startTime, time - startTime,
- data, location);
- if (d->rangeCount[range] == 0) {
- int count = d->rangeDatas[range].count() +
- d->rangeStartTimes[range].count() +
- d->rangeLocations[range].count();
- if (count != 0)
- qWarning() << "incorrectly nested data";
- }
- }
- }
- }
+void QmlProfilerClient::complete()
+{
+ Q_D(QmlProfilerClient);
+ d->data->complete();
}
diff --git a/tools/qmlprofiler/qmlprofilerclient.h b/tools/qmlprofiler/qmlprofilerclient.h
index bc267c7c88..fc4dad639d 100644
--- a/tools/qmlprofiler/qmlprofilerclient.h
+++ b/tools/qmlprofiler/qmlprofilerclient.h
@@ -34,50 +34,45 @@
#ifndef QMLPROFILERCLIENT_H
#define QMLPROFILERCLIENT_H
-#include "qmlprofilereventlocation.h"
-
-#include <private/qqmldebugclient_p.h>
+#include <private/qqmleventlocation_p.h>
+#include <private/qqmlprofilerclient_p.h>
#include <private/qqmlprofilerdefinitions_p.h>
-class QmlProfilerClient : public QQmlDebugClient
+class QmlProfilerData;
+class QmlProfilerClientPrivate;
+class QmlProfilerClient : public QQmlProfilerClient
{
Q_OBJECT
+ Q_DECLARE_PRIVATE(QmlProfilerClient)
public:
- QmlProfilerClient(QQmlDebugConnection *client);
- ~QmlProfilerClient();
+ QmlProfilerClient(QQmlDebugConnection *connection, QmlProfilerData *data);
+ void clearPendingData();
- void setFeatures(quint64 features);
- void clearData();
+signals:
+ void enabledChanged(bool enabled);
+ void recordingStarted();
+ void error(const QString &error);
-public slots:
- void sendRecordingStatus(bool record);
+private:
+ virtual void stateChanged(State state);
-signals:
- void traceFinished( qint64 time );
- void traceStarted( qint64 time );
- 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(QQmlProfilerDefinitions::SceneGraphFrameType type, qint64 time,
+ void traceStarted(qint64 time, int engineId);
+ void traceFinished(qint64 time, int engineId);
+ void rangeStart(QQmlProfilerDefinitions::RangeType type, qint64 startTime);
+ void rangeData(QQmlProfilerDefinitions::RangeType type, qint64 time, const QString &data);
+ void rangeLocation(QQmlProfilerDefinitions::RangeType type, qint64 time,
+ const QQmlEventLocation &location);
+ void rangeEnd(QQmlProfilerDefinitions::RangeType type, qint64 endTime);
+ void animationFrame(qint64 time, int frameRate, int animationCount, int threadId);
+ void sceneGraphEvent(QQmlProfilerDefinitions::SceneGraphFrameType type, qint64 time,
qint64 numericData1, qint64 numericData2, qint64 numericData3,
qint64 numericData4, qint64 numericData5);
- void pixmapCache(QQmlProfilerDefinitions::PixmapEventType, qint64 time,
- const QmlEventLocation &location, int width, int height, int refCount);
+ void pixmapCacheEvent(QQmlProfilerDefinitions::PixmapEventType type, qint64 time,
+ const QString &url, int numericData1, int numericData2);
void memoryAllocation(QQmlProfilerDefinitions::MemoryType type, qint64 time, qint64 amount);
void inputEvent(QQmlProfilerDefinitions::InputEventType type, qint64 time, int a, int b);
void complete();
- void enabledChanged(bool enabled);
-
-protected:
- virtual void stateChanged(State state);
- virtual void messageReceived(const QByteArray &);
-
-private:
- class QmlProfilerClientPrivate *d;
};
#endif // QMLPROFILERCLIENT_H
diff --git a/tools/qmlprofiler/qmlprofilerdata.cpp b/tools/qmlprofiler/qmlprofilerdata.cpp
index 4ed1a434a3..9465e4931d 100644
--- a/tools/qmlprofiler/qmlprofilerdata.cpp
+++ b/tools/qmlprofiler/qmlprofilerdata.cpp
@@ -73,14 +73,14 @@ Q_STATIC_ASSERT(sizeof(MESSAGE_STRINGS) ==
struct QmlRangeEventData {
QmlRangeEventData() {} // never called
QmlRangeEventData(const QString &_displayName, int _detailType, const QString &_eventHashStr,
- const QmlEventLocation &_location, const QString &_details,
+ const QQmlEventLocation &_location, const QString &_details,
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;
+ QQmlEventLocation location;
QString details;
QQmlProfilerDefinitions::Message message;
QQmlProfilerDefinitions::RangeType rangeType;
@@ -175,7 +175,7 @@ void QmlProfilerData::clear()
setState(Empty);
}
-QString QmlProfilerData::getHashStringForQmlEvent(const QmlEventLocation &location, int eventType)
+QString QmlProfilerData::getHashStringForQmlEvent(const QQmlEventLocation &location, int eventType)
{
return QString(QStringLiteral("%1:%2:%3:%4")).arg(
location.filename,
@@ -227,7 +227,7 @@ void QmlProfilerData::addQmlEvent(QQmlProfilerDefinitions::RangeType type,
qint64 startTime,
qint64 duration,
const QStringList &data,
- const QmlEventLocation &location)
+ const QQmlEventLocation &location)
{
setState(AcquiringData);
@@ -247,7 +247,7 @@ void QmlProfilerData::addQmlEvent(QQmlProfilerDefinitions::RangeType type,
details = details.mid(details.lastIndexOf(QLatin1Char('/')) + 1);
}
- QmlEventLocation eventLocation = location;
+ QQmlEventLocation eventLocation = location;
QString displayName, eventHashStr;
// generate hash
if (eventLocation.filename.isEmpty()) {
@@ -289,7 +289,7 @@ void QmlProfilerData::addFrameEvent(qint64 time, int framerate, int animationcou
} else {
newEvent = new QmlRangeEventData(displayName, QQmlProfilerDefinitions::AnimationFrame,
eventHashStr,
- QmlEventLocation(), details,
+ QQmlEventLocation(), details,
QQmlProfilerDefinitions::Event,
QQmlProfilerDefinitions::MaximumRangeType);
d->eventDescriptions.insert(eventHashStr, newEvent);
@@ -314,7 +314,7 @@ void QmlProfilerData::addSceneGraphFrameEvent(QQmlProfilerDefinitions::SceneGrap
newEvent = d->eventDescriptions[eventHashStr];
} else {
newEvent = new QmlRangeEventData(QStringLiteral("<SceneGraph>"), type, eventHashStr,
- QmlEventLocation(), QString(),
+ QQmlEventLocation(), QString(),
QQmlProfilerDefinitions::SceneGraphFrame,
QQmlProfilerDefinitions::MaximumRangeType);
d->eventDescriptions.insert(eventHashStr, newEvent);
@@ -327,12 +327,12 @@ void QmlProfilerData::addSceneGraphFrameEvent(QQmlProfilerDefinitions::SceneGrap
}
void QmlProfilerData::addPixmapCacheEvent(QQmlProfilerDefinitions::PixmapEventType type,
- qint64 time, const QmlEventLocation &location,
- int width, int height, int refcount)
+ qint64 time, const QString &location,
+ int numericData1, int numericData2)
{
setState(AcquiringData);
- QString filePath = QUrl(location.filename).path();
+ QString filePath = QUrl(location).path();
QString eventHashStr = filePath.mid(filePath.lastIndexOf(QLatin1Char('/')) + 1) +
QStringLiteral(":") + QString::number(type);
@@ -340,13 +340,14 @@ void QmlProfilerData::addPixmapCacheEvent(QQmlProfilerDefinitions::PixmapEventTy
if (d->eventDescriptions.contains(eventHashStr)) {
newEvent = d->eventDescriptions[eventHashStr];
} else {
- newEvent = new QmlRangeEventData(eventHashStr, type, eventHashStr, location, QString(),
+ newEvent = new QmlRangeEventData(eventHashStr, type, eventHashStr,
+ QQmlEventLocation(location, -1, -1), QString(),
QQmlProfilerDefinitions::PixmapCacheEvent,
QQmlProfilerDefinitions::MaximumRangeType);
d->eventDescriptions.insert(eventHashStr, newEvent);
}
- QmlRangeEventStartInstance rangeEventStartInstance(time, width, height, refcount, 0, 0,
+ QmlRangeEventStartInstance rangeEventStartInstance(time, numericData1, numericData2, 0, 0, 0,
newEvent);
d->startInstanceList.append(rangeEventStartInstance);
}
@@ -360,7 +361,7 @@ void QmlProfilerData::addMemoryEvent(QQmlProfilerDefinitions::MemoryType type, q
if (d->eventDescriptions.contains(eventHashStr)) {
newEvent = d->eventDescriptions[eventHashStr];
} else {
- newEvent = new QmlRangeEventData(eventHashStr, type, eventHashStr, QmlEventLocation(),
+ newEvent = new QmlRangeEventData(eventHashStr, type, eventHashStr, QQmlEventLocation(),
QString(), QQmlProfilerDefinitions::MemoryAllocation,
QQmlProfilerDefinitions::MaximumRangeType);
d->eventDescriptions.insert(eventHashStr, newEvent);
@@ -392,7 +393,7 @@ void QmlProfilerData::addInputEvent(QQmlProfilerDefinitions::InputEventType type
if (d->eventDescriptions.contains(eventHashStr)) {
newEvent = d->eventDescriptions[eventHashStr];
} else {
- newEvent = new QmlRangeEventData(QString(), eventType, eventHashStr, QmlEventLocation(),
+ newEvent = new QmlRangeEventData(QString(), eventType, eventHashStr, QQmlEventLocation(),
QString(), QQmlProfilerDefinitions::Event,
QQmlProfilerDefinitions::MaximumRangeType);
d->eventDescriptions.insert(eventHashStr, newEvent);
@@ -612,7 +613,7 @@ bool QmlProfilerData::save(const QString &filename)
event.data->detailType ==
QQmlProfilerDefinitions::PixmapCacheCountChanged) {
stream.writeAttribute(QStringLiteral("refCount"),
- QString::number(event.numericData3));
+ QString::number(event.numericData1));
}
} else if (event.data->message == QQmlProfilerDefinitions::SceneGraphFrame) {
// special: scenegraph frame events
diff --git a/tools/qmlprofiler/qmlprofilerdata.h b/tools/qmlprofiler/qmlprofilerdata.h
index b931409917..345f7f2d12 100644
--- a/tools/qmlprofiler/qmlprofilerdata.h
+++ b/tools/qmlprofiler/qmlprofilerdata.h
@@ -34,9 +34,9 @@
#ifndef QMLPROFILERDATA_H
#define QMLPROFILERDATA_H
-#include "qmlprofilereventlocation.h"
+#include <private/qqmleventlocation_p.h>
+#include <private/qqmlprofilerdefinitions_p.h>
-#include <QtQml/private/qqmlprofilerdefinitions_p.h>
#include <QObject>
class QmlProfilerDataPrivate;
@@ -54,7 +54,7 @@ public:
explicit QmlProfilerData(QObject *parent = 0);
~QmlProfilerData();
- static QString getHashStringForQmlEvent(const QmlEventLocation &location, int eventType);
+ static QString getHashStringForQmlEvent(const QQmlEventLocation &location, int eventType);
static QString qmlRangeTypeAsString(QQmlProfilerDefinitions::RangeType type);
static QString qmlMessageAsString(QQmlProfilerDefinitions::Message type);
@@ -75,13 +75,13 @@ public slots:
void addQmlEvent(QQmlProfilerDefinitions::RangeType type,
QQmlProfilerDefinitions::BindingType bindingType,
qint64 startTime, qint64 duration, const QStringList &data,
- const QmlEventLocation &location);
+ const QQmlEventLocation &location);
void addFrameEvent(qint64 time, int framerate, int animationcount, int threadId);
void addSceneGraphFrameEvent(QQmlProfilerDefinitions::SceneGraphFrameType type, qint64 time,
qint64 numericData1, qint64 numericData2, qint64 numericData3,
qint64 numericData4, qint64 numericData5);
void addPixmapCacheEvent(QQmlProfilerDefinitions::PixmapEventType type, qint64 time,
- const QmlEventLocation &location, int width, int height, int refcount);
+ const QString &location, int numericData1, int numericData2);
void addMemoryEvent(QQmlProfilerDefinitions::MemoryType type, qint64 time, qint64 size);
void addInputEvent(QQmlProfilerDefinitions::InputEventType type, qint64 time, int a, int b);
diff --git a/tools/qmlprofiler/qmlprofilereventlocation.h b/tools/qmlprofiler/qmlprofilereventlocation.h
deleted file mode 100644
index ebf9f2eed6..0000000000
--- a/tools/qmlprofiler/qmlprofilereventlocation.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtQml module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMLPROFILEREVENTLOCATION_H
-#define QMLPROFILEREVENTLOCATION_H
-
-#include <QString>
-
-struct QmlEventLocation
-{
- QmlEventLocation() : line(-1), column(-1) {}
- QmlEventLocation(const QString &file, int lineNumber, int columnNumber)
- : filename(file), line(lineNumber), column(columnNumber) {}
- QString filename;
- int line;
- int column;
-};
-
-QT_BEGIN_NAMESPACE
-Q_DECLARE_TYPEINFO(QmlEventLocation, Q_MOVABLE_TYPE);
-QT_END_NAMESPACE
-
-#endif // QMLPROFILEREVENTLOCATION_H