diff options
author | Christiaan Janssen <christiaan.janssen@nokia.com> | 2012-05-02 17:32:57 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-04 15:19:25 +0200 |
commit | 3b66a38e58fe030b6d2c4cd12c9884af660652a9 (patch) | |
tree | f5effe0e4d7aac0ed4073f0fc2c1e5bb99108534 /tools | |
parent | 6f3bda0dce945a5fc75d8ebad302820fe9979d9b (diff) |
QmlProfiler: storing binding type
Change-Id: If1f02e1e6f6ce6aba9874a63d01a08d57571f991
Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qmlprofiler/qmlprofilerapplication.cpp | 4 | ||||
-rw-r--r-- | tools/qmlprofiler/qmlprofilerclient.cpp | 15 | ||||
-rw-r--r-- | tools/qmlprofiler/qmlprofilerclient.h | 6 | ||||
-rw-r--r-- | tools/qmlprofiler/qmlprofilerdata.cpp | 11 | ||||
-rw-r--r-- | tools/qmlprofiler/qmlprofilerdata.h | 6 |
5 files changed, 32 insertions, 10 deletions
diff --git a/tools/qmlprofiler/qmlprofilerapplication.cpp b/tools/qmlprofiler/qmlprofilerapplication.cpp index 05518dd167..a7b85e1630 100644 --- a/tools/qmlprofiler/qmlprofilerapplication.cpp +++ b/tools/qmlprofiler/qmlprofilerapplication.cpp @@ -104,8 +104,8 @@ QmlProfilerApplication::QmlProfilerApplication(int &argc, char **argv) : connect(&m_qmlProfilerClient, SIGNAL(enabledChanged()), this, SLOT(traceClientEnabled())); connect(&m_qmlProfilerClient, SIGNAL(recordingChanged(bool)), this, SLOT(recordingChanged())); - connect(&m_qmlProfilerClient, SIGNAL(range(QQmlProfilerService::RangeType,qint64,qint64,QStringList,QmlEventLocation)), - &m_profilerData, SLOT(addQmlEvent(QQmlProfilerService::RangeType,qint64,qint64,QStringList,QmlEventLocation))); + 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(traceFinished(qint64)), &m_profilerData, SLOT(setTraceEndTime(qint64))); connect(&m_qmlProfilerClient, SIGNAL(traceStarted(qint64)), &m_profilerData, SLOT(setTraceStartTime(qint64))); connect(&m_qmlProfilerClient, SIGNAL(frame(qint64,int,int)), &m_profilerData, SLOT(addFrameEvent(qint64,int,int))); diff --git a/tools/qmlprofiler/qmlprofilerclient.cpp b/tools/qmlprofiler/qmlprofilerclient.cpp index 97ed90e890..103eab8402 100644 --- a/tools/qmlprofiler/qmlprofilerclient.cpp +++ b/tools/qmlprofiler/qmlprofilerclient.cpp @@ -118,6 +118,7 @@ public: QStack<qint64> rangeStartTimes[QQmlProfilerService::MaximumRangeType]; QStack<QStringList> rangeDatas[QQmlProfilerService::MaximumRangeType]; QStack<QmlEventLocation> rangeLocations[QQmlProfilerService::MaximumRangeType]; + QStack<QQmlProfilerService::BindingType> bindingTypes; int rangeCount[QQmlProfilerService::MaximumRangeType]; qint64 maximumTime; }; @@ -138,6 +139,7 @@ void QmlProfilerClient::clearData() { ::memset(d->rangeCount, 0, QQmlProfilerService::MaximumRangeType * sizeof(int)); + d->bindingTypes.clear(); ProfilerClient::clearData(); } @@ -195,6 +197,14 @@ void QmlProfilerClient::messageReceived(const QByteArray &data) 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 (!stream.atEnd()) + stream >> bindingType; + d->bindingTypes.push((QQmlProfilerService::BindingType)bindingType); + } } else if (messageType == QQmlProfilerService::RangeData) { QString data; stream >> data; @@ -232,8 +242,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) + bindingType = d->bindingTypes.pop(); emit this->range((QQmlProfilerService::RangeType)range, - startTime, time - startTime, data, location); + bindingType, startTime, time - startTime, data, location); if (d->rangeCount[range] == 0) { int count = d->rangeDatas[range].count() + d->rangeStartTimes[range].count() + diff --git a/tools/qmlprofiler/qmlprofilerclient.h b/tools/qmlprofiler/qmlprofilerclient.h index 2a8629d1fb..2c1fa4f3f3 100644 --- a/tools/qmlprofiler/qmlprofilerclient.h +++ b/tools/qmlprofiler/qmlprofilerclient.h @@ -97,8 +97,10 @@ public slots: signals: void traceFinished( qint64 time ); void traceStarted( qint64 time ); - void range(QQmlProfilerService::RangeType type, qint64 startTime, - qint64 length, const QStringList &data, + void range(QQmlProfilerService::RangeType type, + QQmlProfilerService::BindingType bindingType, + qint64 startTime, qint64 length, + const QStringList &data, const QmlEventLocation &location); void frame(qint64 time, int frameRate, int animationCount); diff --git a/tools/qmlprofiler/qmlprofilerdata.cpp b/tools/qmlprofiler/qmlprofilerdata.cpp index 38e64ff46e..c564079529 100644 --- a/tools/qmlprofiler/qmlprofilerdata.cpp +++ b/tools/qmlprofiler/qmlprofilerdata.cpp @@ -59,17 +59,19 @@ namespace Constants { struct QmlRangeEventData { QmlRangeEventData() {} // never called QmlRangeEventData(const QString &_displayName, + const QQmlProfilerService::BindingType &_bindingType, const QString &_eventHashStr, const QmlEventLocation &_location, const QString &_details, const QQmlProfilerService::RangeType &_eventType) : displayName(_displayName),eventHashStr(_eventHashStr),location(_location), - details(_details),eventType(_eventType) {} + details(_details),eventType(_eventType),bindingType(_bindingType) {} QString displayName; QString eventHashStr; QmlEventLocation location; QString details; QQmlProfilerService::RangeType eventType; + QQmlProfilerService::BindingType bindingType; }; struct QmlRangeEventStartInstance { @@ -221,6 +223,7 @@ qint64 QmlProfilerData::traceEndTime() const } void QmlProfilerData::addQmlEvent(QQmlProfilerService::RangeType type, + QQmlProfilerService::BindingType bindingType, qint64 startTime, qint64 duration, const QStringList &data, @@ -262,7 +265,7 @@ void QmlProfilerData::addQmlEvent(QQmlProfilerService::RangeType type, if (d->eventDescriptions.contains(eventHashStr)) { newEvent = d->eventDescriptions[eventHashStr]; } else { - newEvent = new QmlRangeEventData(displayName, eventHashStr, location, details, type); + newEvent = new QmlRangeEventData(displayName, bindingType, eventHashStr, location, details, type); d->eventDescriptions.insert(eventHashStr, newEvent); } @@ -283,7 +286,7 @@ void QmlProfilerData::addFrameEvent(qint64 time, int framerate, int animationcou if (d->eventDescriptions.contains(eventHashStr)) { newEvent = d->eventDescriptions[eventHashStr]; } else { - newEvent = new QmlRangeEventData(displayName, eventHashStr, QmlEventLocation(), details, QQmlProfilerService::Painting); + newEvent = new QmlRangeEventData(displayName, QQmlProfilerService::QmlBinding, eventHashStr, QmlEventLocation(), details, QQmlProfilerService::Painting); d->eventDescriptions.insert(eventHashStr, newEvent); } @@ -495,6 +498,8 @@ bool QmlProfilerData::save(const QString &filename) stream.writeTextElement(QStringLiteral("column"), QString::number(eventData->location.column)); } stream.writeTextElement(QStringLiteral("details"), eventData->details); + if (eventData->eventType == QQmlProfilerService::Binding) + stream.writeTextElement(QStringLiteral("bindingType"), QString::number((int)eventData->bindingType)); stream.writeEndElement(); } stream.writeEndElement(); // eventData diff --git a/tools/qmlprofiler/qmlprofilerdata.h b/tools/qmlprofiler/qmlprofilerdata.h index 66209a1830..170e77db23 100644 --- a/tools/qmlprofiler/qmlprofilerdata.h +++ b/tools/qmlprofiler/qmlprofilerdata.h @@ -82,8 +82,10 @@ public slots: void clear(); void setTraceEndTime(qint64 time); void setTraceStartTime(qint64 time); - void addQmlEvent(QQmlProfilerService::RangeType type, qint64 startTime, qint64 duration, - const QStringList &data, const QmlEventLocation &location); + void addQmlEvent(QQmlProfilerService::RangeType type, + QQmlProfilerService::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); |