diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2013-06-24 11:26:22 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2013-06-24 11:48:46 +0200 |
commit | 1a9759855639b9e2b3cdc0687d3381dcbf6c9815 (patch) | |
tree | b2da51f6eddddb83c2d97cdcfac24d38d2e67a4e /src/qml/debugger/qqmlprofilerservice_p.h | |
parent | 8217ec1b888f3ff93f004801b018c5f85362c484 (diff) | |
parent | e1fc2793aef53b84a3f1e19b6d6bdf1141340074 (diff) |
Merge branch 'dev' of ssh://codereview.qt-project.org/qt/qtdeclarative into wip/v4
Conflicts:
src/imports/qtquick2/plugins.qmltypes
src/qml/debugger/qv8debugservice.cpp
src/qml/qml/qml.pri
src/qml/qml/qqmlcompiler.cpp
src/qml/qml/qqmlcomponent.cpp
src/qml/qml/qqmlcontext.cpp
src/qml/qml/qqmldata_p.h
src/qml/qml/qqmlengine_p.h
src/qml/qml/qqmljavascriptexpression.cpp
src/qml/qml/qqmlxmlhttprequest.cpp
src/qml/qml/v4/qv4bindings.cpp
src/qml/qml/v4/qv4irbuilder.cpp
src/qml/qml/v4/qv4jsonobject_p.h
src/qml/qml/v8/qqmlbuiltinfunctions.cpp
src/qml/qml/v8/qv8bindings.cpp
src/qml/qml/v8/qv8contextwrapper.cpp
src/qml/qml/v8/qv8listwrapper.cpp
src/qml/qml/v8/qv8qobjectwrapper.cpp
src/qml/qml/v8/qv8qobjectwrapper_p.h
src/qml/qml/v8/qv8sequencewrapper_p_p.h
src/qml/qml/v8/qv8typewrapper.cpp
src/qml/qml/v8/qv8valuetypewrapper.cpp
src/qml/types/qqmldelegatemodel.cpp
src/quick/items/context2d/qquickcanvasitem.cpp
src/quick/items/context2d/qquickcontext2d.cpp
sync.profile
tests/auto/qml/qjsengine/tst_qjsengine.cpp
tests/benchmarks/qml/animation/animation.pro
tools/qmlprofiler/qmlprofiler.pro
Change-Id: I18a76b8a81d87523247fa03a44ca334b1a2360c9
Diffstat (limited to 'src/qml/debugger/qqmlprofilerservice_p.h')
-rw-r--r-- | src/qml/debugger/qqmlprofilerservice_p.h | 98 |
1 files changed, 93 insertions, 5 deletions
diff --git a/src/qml/debugger/qqmlprofilerservice_p.h b/src/qml/debugger/qqmlprofilerservice_p.h index a50fb5ea08..fb08a30c6a 100644 --- a/src/qml/debugger/qqmlprofilerservice_p.h +++ b/src/qml/debugger/qqmlprofilerservice_p.h @@ -74,12 +74,18 @@ struct Q_AUTOTEST_EXPORT QQmlProfilerData //### QString detailData; //used by RangeData and RangeLocation - int line; //used by RangeLocation - int column; //used by RangeLocation + int line; //used by RangeLocation, also as "width" for pixmaps + int column; //used by RangeLocation, also as "height" for pixmaps int framerate; //used by animation events - int animationcount; //used by animation events + int animationcount; //used by animation events, also as "cache/reference count" for pixmaps int bindingType; + qint64 subtime_1; + qint64 subtime_2; + qint64 subtime_3; + qint64 subtime_4; + qint64 subtime_5; + QByteArray toByteArray() const; }; @@ -99,6 +105,8 @@ public: RangeLocation, RangeEnd, Complete, // end of transmission + PixmapCacheEvent, + SceneGraphFrame, MaximumMessage }; @@ -132,14 +140,43 @@ public: MaximumBindingType }; + enum PixmapEventType { + PixmapSizeKnown, + PixmapReferenceCountChanged, + PixmapCacheCountChanged, + PixmapLoadingStarted, + PixmapLoadingFinished, + PixmapLoadingError, + + MaximumPixmapEventType + }; + + enum SceneGraphFrameType { + SceneGraphRendererFrame, + SceneGraphAdaptationLayerFrame, + SceneGraphContextFrame, + SceneGraphRenderLoopFrame, + SceneGraphTexturePrepare, + SceneGraphTextureDeletion, + SceneGraphPolishAndSync, + SceneGraphWindowsRenderShow, + SceneGraphWindowsAnimations, + SceneGraphWindowsPolishFrame, + + MaximumSceneGraphFrameType + }; + static void initialize(); static bool startProfiling(); static bool stopProfiling(); static void sendStartedProfilingMessage(); + static bool profilingEnabled(); + static void addEvent(EventType); static void animationFrame(qint64); + static void sceneGraphFrame(SceneGraphFrameType frameType, qint64 value1, qint64 value2 = -1, qint64 value3 = -1, qint64 value4 = -1, qint64 value5 = -1); static void sendProfilingData(); QQmlProfilerService(); @@ -163,15 +200,22 @@ private: void rangeLocation(RangeType, const QUrl &, int, int); void endRange(RangeType); + // overloading depending on parameters + void pixmapEventImpl(PixmapEventType eventType, const QUrl &url); + void pixmapEventImpl(PixmapEventType eventType, const QUrl &url, int width, int height); + void pixmapEventImpl(PixmapEventType eventType, const QUrl &url, int count); + + void sceneGraphFrameImpl(SceneGraphFrameType frameType, qint64 value1, qint64 value2, qint64 value3, qint64 value4, qint64 value5); + - bool profilingEnabled(); void setProfilingEnabled(bool enable); void sendMessages(); void processMessage(const QQmlProfilerData &); +public: + static bool enabled; private: QElapsedTimer m_timer; - bool m_enabled; QVector<QQmlProfilerData> m_data; QMutex m_dataMutex; QMutex m_initializeMutex; @@ -183,6 +227,7 @@ private: friend struct QQmlHandlingSignalProfiler; friend struct QQmlObjectCreatingProfiler; friend struct QQmlCompilingProfiler; + friend struct QQmlPixmapProfiler; }; // @@ -288,6 +333,49 @@ struct QQmlCompilingProfiler { bool enabled; }; +struct QQmlPixmapProfiler { + QQmlPixmapProfiler() { + QQmlProfilerService *instance = QQmlProfilerService::instance; + enabled = instance ? + instance->profilingEnabled() : false; + } + + ~QQmlPixmapProfiler() {} + + void startLoading(const QUrl &pixmapUrl) { + if (enabled) { + QQmlProfilerService::instance->pixmapEventImpl(QQmlProfilerService::PixmapLoadingStarted, pixmapUrl); + } + } + void finishLoading(const QUrl &pixmapUrl) { + if (enabled) { + QQmlProfilerService::instance->pixmapEventImpl(QQmlProfilerService::PixmapLoadingFinished, pixmapUrl); + } + } + void errorLoading(const QUrl &pixmapUrl) { + if (enabled) { + QQmlProfilerService::instance->pixmapEventImpl(QQmlProfilerService::PixmapLoadingError, pixmapUrl); + } + } + void cacheCountChanged(const QUrl &pixmapUrl, int cacheCount) { + if (enabled) { + QQmlProfilerService::instance->pixmapEventImpl(QQmlProfilerService::PixmapCacheCountChanged, pixmapUrl, cacheCount); + } + } + void referenceCountChanged(const QUrl &pixmapUrl, int referenceCount) { + if (enabled) { + QQmlProfilerService::instance->pixmapEventImpl(QQmlProfilerService::PixmapReferenceCountChanged, pixmapUrl, referenceCount); + } + } + void setSize(const QUrl &pixmapUrl, int width, int height) { + if (enabled) { + QQmlProfilerService::instance->pixmapEventImpl(QQmlProfilerService::PixmapSizeKnown, pixmapUrl, width, height); + } + } + + bool enabled; +}; + QT_END_NAMESPACE #endif // QQMLPROFILERSERVICE_P_H |