aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/debugger
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2014-10-09 18:13:54 +0200
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2014-10-09 18:14:56 +0200
commite1dfb78667bd7e8dc418e12a9669404adea7e2cb (patch)
tree16f40a9852281a63c1f98af21c680bddedaa5258 /src/qml/debugger
parent28949c9699014b4f7abba396c28dea207b29821e (diff)
parent26bbd784d67d151eee531e5ff57977a5353549f5 (diff)
Merge remote-tracking branch 'origin/5.4' into dev
Conflicts: src/quick/items/context2d/qquickcanvasitem.cpp src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp src/quick/scenegraph/coreapi/qsgrenderer.cpp src/quick/scenegraph/qsgadaptationlayer.cpp src/quick/scenegraph/qsgrenderloop.cpp src/quick/scenegraph/qsgthreadedrenderloop.cpp src/quick/scenegraph/qsgwindowsrenderloop.cpp src/quick/scenegraph/util/qsgatlastexture.cpp src/quick/scenegraph/util/qsgtexture.cpp src/quick/util/qquickprofiler_p.h Change-Id: Ie274c3baf72a8a0711c87d67238d68e2b2887429
Diffstat (limited to 'src/qml/debugger')
-rw-r--r--src/qml/debugger/qqmlabstractprofileradapter.cpp10
-rw-r--r--src/qml/debugger/qqmlabstractprofileradapter_p.h13
-rw-r--r--src/qml/debugger/qqmlenginedebugservice.cpp8
-rw-r--r--src/qml/debugger/qqmlenginedebugservice_p.h2
-rw-r--r--src/qml/debugger/qqmlprofiler.cpp14
-rw-r--r--src/qml/debugger/qqmlprofiler_p.h41
-rw-r--r--src/qml/debugger/qqmlprofilerdefinitions_p.h16
-rw-r--r--src/qml/debugger/qqmlprofilerservice.cpp25
-rw-r--r--src/qml/debugger/qqmlprofilerservice_p.h4
-rw-r--r--src/qml/debugger/qv4profileradapter.cpp7
10 files changed, 85 insertions, 55 deletions
diff --git a/src/qml/debugger/qqmlabstractprofileradapter.cpp b/src/qml/debugger/qqmlabstractprofileradapter.cpp
index 1267503226..165772335a 100644
--- a/src/qml/debugger/qqmlabstractprofileradapter.cpp
+++ b/src/qml/debugger/qqmlabstractprofileradapter.cpp
@@ -69,13 +69,13 @@ QT_BEGIN_NAMESPACE
* If the profiler's thread is waiting for an initial start signal we can emit the signal over a
* \c Qt::DirectConnection to avoid the delay of the event loop.
*/
-void QQmlAbstractProfilerAdapter::startProfiling()
+void QQmlAbstractProfilerAdapter::startProfiling(quint64 features)
{
if (waiting)
- emit profilingEnabledWhileWaiting();
+ emit profilingEnabledWhileWaiting(features);
else
- emit profilingEnabled();
- running = true;
+ emit profilingEnabled(features);
+ featuresEnabled = features;
}
/*!
@@ -90,7 +90,7 @@ void QQmlAbstractProfilerAdapter::stopProfiling() {
emit profilingDisabledWhileWaiting();
else
emit profilingDisabled();
- running = false;
+ featuresEnabled = 0;
}
/*!
diff --git a/src/qml/debugger/qqmlabstractprofileradapter_p.h b/src/qml/debugger/qqmlabstractprofileradapter_p.h
index f06d51e8f7..03f6645178 100644
--- a/src/qml/debugger/qqmlabstractprofileradapter_p.h
+++ b/src/qml/debugger/qqmlabstractprofileradapter_p.h
@@ -59,12 +59,12 @@ class Q_QML_PRIVATE_EXPORT QQmlAbstractProfilerAdapter : public QObject, public
public:
QQmlAbstractProfilerAdapter(QQmlProfilerService *service) :
- service(service), waiting(true), running(false) {}
+ service(service), waiting(true), featuresEnabled(0) {}
virtual ~QQmlAbstractProfilerAdapter() {}
virtual qint64 sendMessages(qint64 until, QList<QByteArray> &messages) = 0;
- void startProfiling();
+ void startProfiling(quint64 features);
void stopProfiling();
@@ -73,13 +73,14 @@ public:
void stopWaiting() { waiting = false; }
void startWaiting() { waiting = true; }
- bool isRunning() const { return running; }
+ bool isRunning() const { return featuresEnabled != 0; }
+ quint64 features() const { return featuresEnabled; }
void synchronize(const QElapsedTimer &t) { emit referenceTimeKnown(t); }
signals:
- void profilingEnabled();
- void profilingEnabledWhileWaiting();
+ void profilingEnabled(quint64 features);
+ void profilingEnabledWhileWaiting(quint64 features);
void profilingDisabled();
void profilingDisabledWhileWaiting();
@@ -92,7 +93,7 @@ protected:
private:
bool waiting;
- bool running;
+ quint64 featuresEnabled;
};
QT_END_NAMESPACE
diff --git a/src/qml/debugger/qqmlenginedebugservice.cpp b/src/qml/debugger/qqmlenginedebugservice.cpp
index 399cc3e07d..cb533a0459 100644
--- a/src/qml/debugger/qqmlenginedebugservice.cpp
+++ b/src/qml/debugger/qqmlenginedebugservice.cpp
@@ -169,9 +169,13 @@ QQmlEngineDebugService::propertyData(QObject *obj, int propIdx)
return rv;
}
-QVariant QQmlEngineDebugService::valueContents(const QVariant &value) const
+QVariant QQmlEngineDebugService::valueContents(QVariant value) const
{
- int userType = value.userType();
+ // We can't send JS objects across the wire, so transform them to variant
+ // maps for serialization.
+ if (value.userType() == qMetaTypeId<QJSValue>())
+ value = value.value<QJSValue>().toVariant();
+ const int userType = value.userType();
//QObject * is not streamable.
//Convert all such instances to a String value
diff --git a/src/qml/debugger/qqmlenginedebugservice_p.h b/src/qml/debugger/qqmlenginedebugservice_p.h
index 1bab51d17b..940ca7d99c 100644
--- a/src/qml/debugger/qqmlenginedebugservice_p.h
+++ b/src/qml/debugger/qqmlenginedebugservice_p.h
@@ -111,7 +111,7 @@ private:
void buildStatesList(bool cleanList, const QList<QPointer<QObject> > &instances);
QQmlObjectData objectData(QObject *);
QQmlObjectProperty propertyData(QObject *, int);
- QVariant valueContents(const QVariant &defaultValue) const;
+ QVariant valueContents(QVariant defaultValue) const;
bool setBinding(int objectId, const QString &propertyName, const QVariant &expression, bool isLiteralValue, QString filename = QString(), int line = -1, int column = 0);
bool resetBinding(int objectId, const QString &propertyName);
bool setMethodBody(int objectId, const QString &method, const QString &body);
diff --git a/src/qml/debugger/qqmlprofiler.cpp b/src/qml/debugger/qqmlprofiler.cpp
index 3a647e704d..b102201ff1 100644
--- a/src/qml/debugger/qqmlprofiler.cpp
+++ b/src/qml/debugger/qqmlprofiler.cpp
@@ -82,9 +82,9 @@ QQmlProfilerAdapter::QQmlProfilerAdapter(QQmlProfilerService *service, QQmlEngin
QQmlAbstractProfilerAdapter(service)
{
engine->enableProfiler();
- connect(this, SIGNAL(profilingEnabled()), engine->profiler, SLOT(startProfiling()));
- connect(this, SIGNAL(profilingEnabledWhileWaiting()),
- engine->profiler, SLOT(startProfiling()), Qt::DirectConnection);
+ connect(this, SIGNAL(profilingEnabled(quint64)), engine->profiler, SLOT(startProfiling(quint64)));
+ connect(this, SIGNAL(profilingEnabledWhileWaiting(quint64)),
+ engine->profiler, SLOT(startProfiling(quint64)), Qt::DirectConnection);
connect(this, SIGNAL(profilingDisabled()), engine->profiler, SLOT(stopProfiling()));
connect(this, SIGNAL(profilingDisabledWhileWaiting()),
engine->profiler, SLOT(stopProfiling()), Qt::DirectConnection);
@@ -111,21 +111,21 @@ void QQmlProfilerAdapter::receiveData(const QList<QQmlProfilerData> &new_data)
}
-QQmlProfiler::QQmlProfiler() : enabled(false)
+QQmlProfiler::QQmlProfiler() : featuresEnabled(0)
{
static int metatype = qRegisterMetaType<QList<QQmlProfilerData> >();
Q_UNUSED(metatype);
m_timer.start();
}
-void QQmlProfiler::startProfiling()
+void QQmlProfiler::startProfiling(quint64 features)
{
- enabled = true;
+ featuresEnabled = features;
}
void QQmlProfiler::stopProfiling()
{
- enabled = false;
+ featuresEnabled = false;
reportData();
m_data.clear();
}
diff --git a/src/qml/debugger/qqmlprofiler_p.h b/src/qml/debugger/qqmlprofiler_p.h
index 02cdbf0a4e..13e6b8ddae 100644
--- a/src/qml/debugger/qqmlprofiler_p.h
+++ b/src/qml/debugger/qqmlprofiler_p.h
@@ -56,14 +56,14 @@
QT_BEGIN_NAMESPACE
-#define Q_QML_PROFILE_IF_ENABLED(profiler, Code)\
- if (profiler && profiler->enabled) {\
+#define Q_QML_PROFILE_IF_ENABLED(feature, profiler, Code)\
+ if (profiler && (profiler->featuresEnabled & (1 << feature))) {\
Code;\
} else\
(void)0
-#define Q_QML_PROFILE(profiler, Method)\
- Q_QML_PROFILE_IF_ENABLED(profiler, profiler->Method)
+#define Q_QML_PROFILE(feature, profiler, Method)\
+ Q_QML_PROFILE_IF_ENABLED(feature, profiler, profiler->Method)
// This struct is somewhat dangerous to use:
// The messageType is a bit field. You can pack multiple messages into
@@ -162,10 +162,10 @@ public:
QQmlProfiler();
- bool enabled;
+ quint64 featuresEnabled;
public slots:
- void startProfiling();
+ void startProfiling(quint64 features);
void stopProfiling();
void reportData();
void setTimer(const QElapsedTimer &timer) { m_timer = timer; }
@@ -204,12 +204,14 @@ struct QQmlBindingProfiler : public QQmlProfilerHelper {
QQmlBindingProfiler(QQmlProfiler *profiler, const QString &url, int line, int column) :
QQmlProfilerHelper(profiler)
{
- Q_QML_PROFILE(profiler, startBinding(url, line, column));
+ Q_QML_PROFILE(QQmlProfilerDefinitions::ProfileBinding, profiler,
+ startBinding(url, line, column));
}
~QQmlBindingProfiler()
{
- Q_QML_PROFILE(profiler, endRange<Binding>());
+ Q_QML_PROFILE(QQmlProfilerDefinitions::ProfileBinding, profiler,
+ endRange<Binding>());
}
};
@@ -217,12 +219,14 @@ struct QQmlHandlingSignalProfiler : public QQmlProfilerHelper {
QQmlHandlingSignalProfiler(QQmlProfiler *profiler, QQmlBoundSignalExpression *expression) :
QQmlProfilerHelper(profiler)
{
- Q_QML_PROFILE(profiler, startHandlingSignal(expression->sourceLocation()));
+ Q_QML_PROFILE(QQmlProfilerDefinitions::ProfileHandlingSignal, profiler,
+ startHandlingSignal(expression->sourceLocation()));
}
~QQmlHandlingSignalProfiler()
{
- Q_QML_PROFILE(profiler, endRange<QQmlProfiler::HandlingSignal>());
+ Q_QML_PROFILE(QQmlProfilerDefinitions::ProfileHandlingSignal, profiler,
+ endRange<QQmlProfiler::HandlingSignal>());
}
};
@@ -230,12 +234,12 @@ struct QQmlCompilingProfiler : public QQmlProfilerHelper {
QQmlCompilingProfiler(QQmlProfiler *profiler, const QString &name) :
QQmlProfilerHelper(profiler)
{
- Q_QML_PROFILE(profiler, startCompiling(name));
+ Q_QML_PROFILE(QQmlProfilerDefinitions::ProfileCompiling, profiler, startCompiling(name));
}
~QQmlCompilingProfiler()
{
- Q_QML_PROFILE(profiler, endRange<Compiling>());
+ Q_QML_PROFILE(QQmlProfilerDefinitions::ProfileCompiling, profiler, endRange<Compiling>());
}
};
@@ -278,20 +282,20 @@ private:
QFiniteStack<Data> ranges;
};
-#define Q_QML_OC_PROFILE(profilerMember, Code)\
- Q_QML_PROFILE_IF_ENABLED(profilerMember.profiler, Code)
+#define Q_QML_OC_PROFILE(member, Code)\
+ Q_QML_PROFILE_IF_ENABLED(QQmlProfilerDefinitions::ProfileCreating, member.profiler, Code)
class QQmlObjectCreationProfiler : public QQmlVmeProfiler::Data {
public:
QQmlObjectCreationProfiler(QQmlProfiler *profiler) : profiler(profiler)
{
- Q_QML_PROFILE(profiler, startCreating());
+ Q_QML_PROFILE(QQmlProfilerDefinitions::ProfileCreating, profiler, startCreating());
}
~QQmlObjectCreationProfiler()
{
- Q_QML_PROFILE(profiler, endRange<QQmlProfilerDefinitions::Creating>());
+ Q_QML_PROFILE(QQmlProfilerDefinitions::ProfileCreating, profiler, endRange<QQmlProfilerDefinitions::Creating>());
}
void update(const QString &typeName, const QUrl &url, int line, int column)
@@ -312,7 +316,7 @@ public:
QQmlObjectCompletionProfiler(QQmlVmeProfiler *parent) :
profiler(parent->profiler)
{
- Q_QML_PROFILE_IF_ENABLED(profiler, {
+ Q_QML_PROFILE_IF_ENABLED(QQmlProfilerDefinitions::ProfileCreating, profiler, {
QQmlVmeProfiler::Data data = parent->pop();
profiler->startCreating(data.m_typeName, data.m_url, data.m_line, data.m_column);
});
@@ -320,7 +324,8 @@ public:
~QQmlObjectCompletionProfiler()
{
- Q_QML_PROFILE(profiler, endRange<QQmlProfilerDefinitions::Creating>());
+ Q_QML_PROFILE(QQmlProfilerDefinitions::ProfileCreating, profiler,
+ endRange<QQmlProfilerDefinitions::Creating>());
}
private:
QQmlProfiler *profiler;
diff --git a/src/qml/debugger/qqmlprofilerdefinitions_p.h b/src/qml/debugger/qqmlprofilerdefinitions_p.h
index 7abff8857e..713134f394 100644
--- a/src/qml/debugger/qqmlprofilerdefinitions_p.h
+++ b/src/qml/debugger/qqmlprofilerdefinitions_p.h
@@ -124,6 +124,22 @@ struct QQmlProfilerDefinitions {
};
typedef QV4::Profiling::MemoryType MemoryType;
+
+ enum ProfileFeature {
+ ProfileJavaScript = QV4::Profiling::FeatureFunctionCall,
+ ProfileMemory = QV4::Profiling::FeatureMemoryAllocation,
+ ProfilePixmapCache,
+ ProfileSceneGraph,
+ ProfileAnimations,
+ ProfilePainting,
+ ProfileCompiling,
+ ProfileCreating,
+ ProfileBinding,
+ ProfileHandlingSignal,
+ ProfileInputEvents,
+
+ MaximumProfileFeature
+ };
};
QT_END_NAMESPACE
diff --git a/src/qml/debugger/qqmlprofilerservice.cpp b/src/qml/debugger/qqmlprofilerservice.cpp
index 6157d2f191..5ec8178f32 100644
--- a/src/qml/debugger/qqmlprofilerservice.cpp
+++ b/src/qml/debugger/qqmlprofilerservice.cpp
@@ -171,12 +171,12 @@ void QQmlProfilerService::addGlobalProfiler(QQmlAbstractProfilerAdapter *profile
// Global profiler, not connected to a specific engine.
// Global profilers are started whenever any engine profiler is started and stopped when
// all engine profilers are stopped.
- foreach (QQmlAbstractProfilerAdapter *engineProfiler, m_engineProfilers) {
- if (engineProfiler->isRunning()) {
- profiler->startProfiling();
- break;
- }
- }
+ quint64 features = 0;
+ foreach (QQmlAbstractProfilerAdapter *engineProfiler, m_engineProfilers)
+ features |= engineProfiler->features();
+
+ if (features != 0)
+ profiler->startProfiling(features);
}
void QQmlProfilerService::removeGlobalProfiler(QQmlAbstractProfilerAdapter *profiler)
@@ -206,7 +206,7 @@ void QQmlProfilerService::removeProfilerFromStartTimes(const QQmlAbstractProfile
*
* If any engine profiler is started like that also start all global profilers.
*/
-void QQmlProfilerService::startProfiling(QQmlEngine *engine)
+void QQmlProfilerService::startProfiling(QQmlEngine *engine, quint64 features)
{
QMutexLocker lock(configMutex());
@@ -218,7 +218,7 @@ void QQmlProfilerService::startProfiling(QQmlEngine *engine)
if (engine != 0) {
foreach (QQmlAbstractProfilerAdapter *profiler, m_engineProfilers.values(engine)) {
if (!profiler->isRunning()) {
- profiler->startProfiling();
+ profiler->startProfiling(features);
startedAny = true;
}
}
@@ -230,7 +230,7 @@ void QQmlProfilerService::startProfiling(QQmlEngine *engine)
i != m_engineProfilers.end(); ++i) {
if (!i.value()->isRunning()) {
engines << i.key();
- i.value()->startProfiling();
+ i.value()->startProfiling(features);
startedAny = true;
}
}
@@ -241,7 +241,7 @@ void QQmlProfilerService::startProfiling(QQmlEngine *engine)
if (startedAny) {
foreach (QQmlAbstractProfilerAdapter *profiler, m_globalProfilers) {
if (!profiler->isRunning())
- profiler->startProfiling();
+ profiler->startProfiling(features);
}
}
@@ -359,14 +359,17 @@ void QQmlProfilerService::messageReceived(const QByteArray &message)
QQmlDebugStream stream(&rwData, QIODevice::ReadOnly);
int engineId = -1;
+ quint64 features = std::numeric_limits<quint64>::max();
bool enabled;
stream >> enabled;
if (!stream.atEnd())
stream >> engineId;
+ if (!stream.atEnd())
+ stream >> features;
// If engineId == -1 objectForId() and then the cast will return 0.
if (enabled)
- startProfiling(qobject_cast<QQmlEngine *>(objectForId(engineId)));
+ startProfiling(qobject_cast<QQmlEngine *>(objectForId(engineId)), features);
else
stopProfiling(qobject_cast<QQmlEngine *>(objectForId(engineId)));
diff --git a/src/qml/debugger/qqmlprofilerservice_p.h b/src/qml/debugger/qqmlprofilerservice_p.h
index 5405905861..c4c40adc4f 100644
--- a/src/qml/debugger/qqmlprofilerservice_p.h
+++ b/src/qml/debugger/qqmlprofilerservice_p.h
@@ -78,8 +78,8 @@ public:
void addGlobalProfiler(QQmlAbstractProfilerAdapter *profiler);
void removeGlobalProfiler(QQmlAbstractProfilerAdapter *profiler);
- void startProfiling(QQmlEngine *engine = 0);
- void stopProfiling(QQmlEngine *engine = 0);
+ void startProfiling(QQmlEngine *engine, quint64 features = std::numeric_limits<quint64>::max());
+ void stopProfiling(QQmlEngine *engine);
QQmlProfilerService();
~QQmlProfilerService();
diff --git a/src/qml/debugger/qv4profileradapter.cpp b/src/qml/debugger/qv4profileradapter.cpp
index 19a6ea3e74..a5492ce805 100644
--- a/src/qml/debugger/qv4profileradapter.cpp
+++ b/src/qml/debugger/qv4profileradapter.cpp
@@ -41,9 +41,10 @@ QV4ProfilerAdapter::QV4ProfilerAdapter(QQmlProfilerService *service, QV4::Execut
QQmlAbstractProfilerAdapter(service)
{
engine->enableProfiler();
- connect(this, SIGNAL(profilingEnabled()), engine->profiler, SLOT(startProfiling()));
- connect(this, SIGNAL(profilingEnabledWhileWaiting()), engine->profiler, SLOT(startProfiling()),
- Qt::DirectConnection);
+ connect(this, SIGNAL(profilingEnabled(quint64)),
+ engine->profiler, SLOT(startProfiling(quint64)));
+ connect(this, SIGNAL(profilingEnabledWhileWaiting(quint64)),
+ engine->profiler, SLOT(startProfiling(quint64)), Qt::DirectConnection);
connect(this, SIGNAL(profilingDisabled()), engine->profiler, SLOT(stopProfiling()));
connect(this, SIGNAL(profilingDisabledWhileWaiting()), engine->profiler, SLOT(stopProfiling()),
Qt::DirectConnection);