diff options
-rw-r--r-- | src/qml/debugger/qqmlprofilerdefinitions_p.h | 3 | ||||
-rw-r--r-- | tools/qmlprofiler/qmlprofilerapplication.cpp | 4 | ||||
-rw-r--r-- | tools/qmlprofiler/qmlprofilerclient.cpp | 6 | ||||
-rw-r--r-- | tools/qmlprofiler/qmlprofilerclient.h | 1 | ||||
-rw-r--r-- | tools/qmlprofiler/qmlprofilerdata.cpp | 23 | ||||
-rw-r--r-- | tools/qmlprofiler/qmlprofilerdata.h | 1 |
6 files changed, 38 insertions, 0 deletions
diff --git a/src/qml/debugger/qqmlprofilerdefinitions_p.h b/src/qml/debugger/qqmlprofilerdefinitions_p.h index 689a06a0d1..f05a7feec9 100644 --- a/src/qml/debugger/qqmlprofilerdefinitions_p.h +++ b/src/qml/debugger/qqmlprofilerdefinitions_p.h @@ -43,6 +43,7 @@ #define QQMLPROFILERDEFINITIONS_P_H #include <private/qtqmlglobal_p.h> +#include <private/qv4profiling_p.h> // // W A R N I N G @@ -127,6 +128,8 @@ struct QQmlProfilerDefinitions { MaximumSceneGraphFrameType }; + + typedef QV4::Profiling::MemoryType MemoryType; }; QT_END_NAMESPACE diff --git a/tools/qmlprofiler/qmlprofilerapplication.cpp b/tools/qmlprofiler/qmlprofilerapplication.cpp index e235f6cd03..9828074303 100644 --- a/tools/qmlprofiler/qmlprofilerapplication.cpp +++ b/tools/qmlprofiler/qmlprofilerapplication.cpp @@ -117,6 +117,10 @@ QmlProfilerApplication::QmlProfilerApplication(int &argc, char **argv) : QmlEventLocation,int,int,int)), &m_profilerData, SLOT(addPixmapCacheEvent(QQmlProfilerService::PixmapEventType,qint64, QmlEventLocation,int,int,int))); + connect(&m_qmlProfilerClient, SIGNAL(memoryAllocation(QQmlProfilerService::MemoryType,qint64, + qint64)), + &m_profilerData, SLOT(addMemoryEvent(QQmlProfilerService::MemoryType,qint64, + qint64))); connect(&m_qmlProfilerClient, SIGNAL(complete()), this, SLOT(qmlComplete())); diff --git a/tools/qmlprofiler/qmlprofilerclient.cpp b/tools/qmlprofiler/qmlprofilerclient.cpp index 9322158280..14fc817807 100644 --- a/tools/qmlprofiler/qmlprofilerclient.cpp +++ b/tools/qmlprofiler/qmlprofilerclient.cpp @@ -216,6 +216,12 @@ void QmlProfilerClient::messageReceived(const QByteArray &data) emit pixmapCache((QQmlProfilerService::PixmapEventType)pixEvTy, time, QmlEventLocation(pixUrl,0,0), width, height, refcount); d->maximumTime = qMax(time, d->maximumTime); + } else if (messageType == QQmlProfilerService::MemoryAllocation) { + int type; + qint64 delta; + stream >> type >> delta; + emit memoryAllocation((QQmlProfilerService::MemoryType)type, time, delta); + d->maximumTime = qMax(time, d->maximumTime); } else { int range; stream >> range; diff --git a/tools/qmlprofiler/qmlprofilerclient.h b/tools/qmlprofiler/qmlprofilerclient.h index 67e5046f12..cdf80ff05a 100644 --- a/tools/qmlprofiler/qmlprofilerclient.h +++ b/tools/qmlprofiler/qmlprofilerclient.h @@ -108,6 +108,7 @@ signals: qint64 numericData4, qint64 numericData5); void pixmapCache(QQmlProfilerService::PixmapEventType, qint64 time, const QmlEventLocation &location, int width, int height, int refCount); + void memoryAllocation(QQmlProfilerService::MemoryType type, qint64 time, qint64 amount); protected: virtual void messageReceived(const QByteArray &); diff --git a/tools/qmlprofiler/qmlprofilerdata.cpp b/tools/qmlprofiler/qmlprofilerdata.cpp index bf2d05ed7b..85efab94cd 100644 --- a/tools/qmlprofiler/qmlprofilerdata.cpp +++ b/tools/qmlprofiler/qmlprofilerdata.cpp @@ -378,6 +378,24 @@ void QmlProfilerData::addPixmapCacheEvent(QQmlProfilerDefinitions::PixmapEventTy d->startInstanceList.append(rangeEventStartInstance); } +void QmlProfilerData::addMemoryEvent(QQmlProfilerService::MemoryType type, qint64 time, + qint64 size) +{ + setState(AcquiringData); + QString eventHashStr = QString::fromLatin1("MemoryAllocation:%1").arg(type); + QmlRangeEventData *newEvent; + if (d->eventDescriptions.contains(eventHashStr)) { + newEvent = d->eventDescriptions[eventHashStr]; + } else { + newEvent = new QmlRangeEventData(eventHashStr, type, eventHashStr, QmlEventLocation(), + QString(), QQmlProfilerService::MemoryAllocation, + QQmlProfilerService::MaximumRangeType); + d->eventDescriptions.insert(eventHashStr, newEvent); + } + QmlRangeEventStartInstance rangeEventStartInstance(time, size, 0, 0, 0, 0, newEvent); + d->startInstanceList.append(rangeEventStartInstance); +} + QString QmlProfilerData::rootEventName() { return tr("<program>"); @@ -589,6 +607,9 @@ bool QmlProfilerData::save(const QString &filename) else if (eventData->message == QQmlProfilerService::SceneGraphFrame) stream.writeTextElement(QStringLiteral("sgEventType"), QString::number((int)eventData->detailType)); + else if (eventData->message == QQmlProfilerService::MemoryAllocation) + stream.writeTextElement(QStringLiteral("memoryEventType"), + QString::number((int)eventData->detailType)); stream.writeEndElement(); } stream.writeEndElement(); // eventData @@ -636,6 +657,8 @@ 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) { + stream.writeAttribute(QStringLiteral("amount"), QString::number(event.numericData1)); } stream.writeEndElement(); } diff --git a/tools/qmlprofiler/qmlprofilerdata.h b/tools/qmlprofiler/qmlprofilerdata.h index 47da0effbf..675c241abc 100644 --- a/tools/qmlprofiler/qmlprofilerdata.h +++ b/tools/qmlprofiler/qmlprofilerdata.h @@ -95,6 +95,7 @@ public slots: qint64 numericData4, qint64 numericData5); void addPixmapCacheEvent(QQmlProfilerService::PixmapEventType type, qint64 time, const QmlEventLocation &location, int width, int height, int refcount); + void addMemoryEvent(QQmlProfilerService::MemoryType type, qint64 time, qint64 size); void complete(); bool save(const QString &filename); |