forked from qt-creator/qt-creator
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user