Commit ebd6d269 authored by Ulf Hermann's avatar Ulf Hermann

QmlProfiler: Directly pass events from client to model

Running them through the model manager via signals doesn't make much
sense anymore.

Change-Id: I6103d281dd640493f28acd7e787ea49712ebd8df
Reviewed-by: Joerg Bornemann's avatarJoerg Bornemann <joerg.bornemann@qt.io>
parent cf02bf97
......@@ -172,6 +172,7 @@ void QmlProfilerClientManager::createConnection()
delete d->qmlclientplugin.data();
d->profilerState->setRecordedFeatures(0);
d->qmlclientplugin = new QmlProfilerTraceClient(d->connection,
d->modelManager->qmlModel(),
d->profilerState->requestedFeatures());
d->qmlclientplugin->setFlushInterval(d->flushInterval);
connectClientSignals();
......@@ -203,8 +204,6 @@ void QmlProfilerClientManager::connectClientSignals()
d->qmlclientplugin.data(), &QmlProfilerTraceClient::setRequestedFeatures);
connect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::recordedFeaturesChanged,
d->profilerState, &QmlProfilerStateManager::setRecordedFeatures);
connect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::qmlEvent,
d->modelManager, &QmlProfilerModelManager::addQmlEvent);
}
}
......@@ -225,8 +224,6 @@ void QmlProfilerClientManager::disconnectClientSignals()
d->qmlclientplugin.data(), &QmlProfilerTraceClient::setRequestedFeatures);
disconnect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::recordedFeaturesChanged,
d->profilerState, &QmlProfilerStateManager::setRecordedFeatures);
disconnect(d->qmlclientplugin.data(), &QmlProfilerTraceClient::qmlEvent,
d->modelManager, &QmlProfilerModelManager::addQmlEvent);
}
}
......
......@@ -280,12 +280,6 @@ const char *QmlProfilerModelManager::featureName(ProfileFeature feature)
return ProfileFeatureNames[feature];
}
void QmlProfilerModelManager::addQmlEvent(const QmlEvent &event, const QmlEventType &type)
{
QTC_ASSERT(state() == AcquiringData, return);
d->model->addTypedEvent(event, type);
}
void QmlProfilerModelManager::acquiringDone()
{
QTC_ASSERT(state() == AcquiringData, /**/);
......
......@@ -136,7 +136,6 @@ public slots:
bool isRestrictedToRange() const;
void startAcquiring();
void addQmlEvent(const QmlEvent &event, const QmlEventType &type);
void save(const QString &filename);
void load(const QString &filename);
......
......@@ -25,6 +25,7 @@
#include "qmlprofilertraceclient.h"
#include "qmltypedevent.h"
#include "qmlprofilerdatamodel.h"
#include <qmldebug/qmlenginecontrolclient.h>
#include <qmldebug/qdebugmessageclient.h>
......@@ -34,8 +35,10 @@ namespace QmlProfiler {
class QmlProfilerTraceClientPrivate {
public:
QmlProfilerTraceClientPrivate(QmlProfilerTraceClient *_q, QmlDebug::QmlDebugConnection *client)
QmlProfilerTraceClientPrivate(QmlProfilerTraceClient *_q, QmlDebug::QmlDebugConnection *client,
QmlProfilerDataModel *model)
: q(_q)
, model(model)
, engineControl(client)
, maximumTime(0)
, recording(false)
......@@ -49,6 +52,7 @@ public:
bool updateFeatures(ProfileFeature feature);
QmlProfilerTraceClient *q;
QmlProfilerDataModel *model;
QmlDebug::QmlEngineControlClient engineControl;
QScopedPointer<QmlDebug::QDebugMessageClient> messageClient;
qint64 maximumTime;
......@@ -71,9 +75,10 @@ void QmlProfilerTraceClientPrivate::sendRecordingStatus(int engineId)
}
QmlProfilerTraceClient::QmlProfilerTraceClient(QmlDebug::QmlDebugConnection *client,
QmlProfilerDataModel *model,
quint64 features)
: QmlDebugClient(QLatin1String("CanvasFrameRate"), client)
, d(new QmlProfilerTraceClientPrivate(this, client))
, d(new QmlProfilerTraceClientPrivate(this, client, model))
{
setRequestedFeatures(features);
connect(&d->engineControl, &QmlDebug::QmlEngineControlClient::engineAboutToBeAdded,
......@@ -147,7 +152,7 @@ void QmlProfilerTraceClient::setRequestedFeatures(quint64 features)
d->currentEvent.type.message = DebugMessage;
d->currentEvent.type.rangeType = MaximumRangeType;
d->currentEvent.type.detailType = type;
emit qmlEvent(d->currentEvent.event, d->currentEvent.type);
d->model->addTypedEvent(d->currentEvent.event, d->currentEvent.type);
});
} else {
d->messageClient.reset();
......@@ -206,7 +211,7 @@ void QmlProfilerTraceClient::messageReceived(const QByteArray &data)
emit traceFinished(d->currentEvent.event.timestamp(),
d->currentEvent.event.numbers<QList<int>, qint32>());
} else if (d->updateFeatures(d->currentEvent.type.feature())) {
emit qmlEvent(d->currentEvent.event, d->currentEvent.type);
d->model->addTypedEvent(d->currentEvent.event, d->currentEvent.type);
}
}
......
......@@ -37,13 +37,15 @@
namespace QmlProfiler {
class QmlProfilerDataModel;
class QmlProfilerTraceClient : public QmlDebug::QmlDebugClient
{
Q_OBJECT
Q_PROPERTY(bool recording READ isRecording WRITE setRecording NOTIFY recordingChanged)
public:
QmlProfilerTraceClient(QmlDebug::QmlDebugConnection *client, quint64 features);
QmlProfilerTraceClient(QmlDebug::QmlDebugConnection *client, QmlProfilerDataModel *model,
quint64 features);
~QmlProfilerTraceClient();
bool isRecording() const;
......@@ -61,8 +63,6 @@ signals:
void traceFinished(qint64 timestamp, const QList<int> &engineIds);
void traceStarted(qint64 timestamp, const QList<int> &engineIds);
void qmlEvent(const QmlEvent &event, const QmlEventType &type);
void recordingChanged(bool arg);
void recordedFeaturesChanged(quint64 features);
void newEngine(int engineId);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment