QmlProfiler: Include debug messages in trace

A separate model will show them in the timeline for better orientation.

Change-Id: I537bac82ddef6a8bcc64ae403731512f8edcc9db
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
This commit is contained in:
Ulf Hermann
2015-11-13 17:55:58 +01:00
parent 35cedb2aee
commit b89d12c450
6 changed files with 42 additions and 10 deletions

View File

@@ -30,6 +30,7 @@
#include "qmlprofilertraceclient.h"
#include "qmlenginecontrolclient.h"
#include "qdebugmessageclient.h"
namespace QmlDebug {
@@ -53,6 +54,7 @@ public:
QmlProfilerTraceClient *q;
QmlEngineControlClient engineControl;
QScopedPointer<QDebugMessageClient> messageClient;
qint64 inProgressRanges;
QStack<qint64> rangeStartTimes[MaximumRangeType];
QStack<QString> rangeDatas[MaximumRangeType];
@@ -86,7 +88,7 @@ QmlProfilerTraceClient::QmlProfilerTraceClient(QmlDebugConnection *client, quint
: QmlDebugClient(QLatin1String("CanvasFrameRate"), client)
, d(new QmlProfilerTraceClientPrivate(this, client))
{
d->requestedFeatures = features;
setRequestedFeatures(features);
connect(&d->engineControl, &QmlEngineControlClient::engineAboutToBeAdded,
this, &QmlProfilerTraceClient::sendRecordingStatus);
}
@@ -152,6 +154,19 @@ quint64 QmlProfilerTraceClient::recordedFeatures() const
void QmlProfilerTraceClient::setRequestedFeatures(quint64 features)
{
d->requestedFeatures = features;
if (features & static_cast<quint64>(1) << ProfileDebugMessages) {
d->messageClient.reset(new QDebugMessageClient(connection()));
connect(d->messageClient.data(), &QDebugMessageClient::message, this, [this](QtMsgType type,
const QString &text, const QmlDebug::QDebugContextInfo &context)
{
emit this->rangedEvent(QmlDebug::DebugMessage, QmlDebug::MaximumRangeType,
type, context.timestamp, 0, text,
QmlDebug::QmlEventLocation(context.file, context.line, 1), 0, 0,
0, 0, 0);
});
} else {
d->messageClient.reset();
}
}
void QmlProfilerTraceClient::setFlushInterval(quint32 flushInterval)