aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2018-04-26 12:02:19 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2018-04-26 12:02:19 +0000
commit9f295f526d1280bf179a9fc17384e926fe7984b4 (patch)
treeeac119280334130a1b519e8e38e2e23f5ae3e203 /tools
parent0f4212cbdf1756833ddd22db4b3c6d92bc80f203 (diff)
parent1169242f14f9e27cbe4e3360dd47d0825eaf9e60 (diff)
Merge "Merge remote-tracking branch 'origin/5.11' into dev" into refs/staging/dev
Diffstat (limited to 'tools')
-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
5 files changed, 60 insertions, 65 deletions
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 64cd4ec87f..6732766b46 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),
@@ -168,7 +167,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 b4b4ad2b2f..7355688222 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;