diff options
Diffstat (limited to 'src')
5 files changed, 22 insertions, 4 deletions
diff --git a/src/plugins/qmltooling/qmldbg_debugger/qdebugmessageservice.cpp b/src/plugins/qmltooling/qmldbg_debugger/qdebugmessageservice.cpp index 6300b2b9c6..6880417f1d 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qdebugmessageservice.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qdebugmessageservice.cpp @@ -49,6 +49,7 @@ QDebugMessageServiceImpl::QDebugMessageServiceImpl(QObject *parent) : { // don't execute stateChanged() in parallel QMutexLocker lock(&initMutex); + timer.start(); if (state() == Enabled) { oldMsgHandler = qInstallMessageHandler(DebugMessageHandler); prevState = Enabled; @@ -64,8 +65,8 @@ void QDebugMessageServiceImpl::sendDebugMessage(QtMsgType type, //only if a client is connected to it. QQmlDebugPacket ws; ws << QByteArray("MESSAGE") << type << buf.toUtf8(); - ws << QString::fromLatin1(ctxt.file).toUtf8(); - ws << ctxt.line << QString::fromLatin1(ctxt.function).toUtf8(); + ws << QByteArray(ctxt.file) << ctxt.line << QByteArray(ctxt.function); + ws << QByteArray(ctxt.category) << timer.nsecsElapsed(); emit messageToClient(name(), ws.data()); if (oldMsgHandler) @@ -89,4 +90,10 @@ void QDebugMessageServiceImpl::stateChanged(State state) prevState = state; } +void QDebugMessageServiceImpl::synchronizeTime(const QElapsedTimer &otherTimer) +{ + QMutexLocker lock(&initMutex); + timer = otherTimer; +} + QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/qmldbg_debugger/qdebugmessageservice.h b/src/plugins/qmltooling/qmldbg_debugger/qdebugmessageservice.h index 04f5966dd7..a5ff1fc3d7 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qdebugmessageservice.h +++ b/src/plugins/qmltooling/qmldbg_debugger/qdebugmessageservice.h @@ -49,6 +49,7 @@ #include <QtCore/qlogging.h> #include <QtCore/qmutex.h> +#include <QtCore/qelapsedtimer.h> QT_BEGIN_NAMESPACE @@ -60,8 +61,8 @@ class QDebugMessageServiceImpl : public QDebugMessageService public: QDebugMessageServiceImpl(QObject *parent = 0); - void sendDebugMessage(QtMsgType type, const QMessageLogContext &ctxt, - const QString &buf); + void sendDebugMessage(QtMsgType type, const QMessageLogContext &ctxt, const QString &buf); + void synchronizeTime(const QElapsedTimer &otherTimer); protected: void stateChanged(State); @@ -72,6 +73,7 @@ private: QtMessageHandler oldMsgHandler; QQmlDebugService::State prevState; QMutex initMutex; + QElapsedTimer timer; }; QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp index e05717f8eb..462bd5e394 100644 --- a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp +++ b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp @@ -215,6 +215,12 @@ void QQmlProfilerServiceImpl::startProfiling(QJSEngine *engine, quint64 features { QMutexLocker lock(&m_configMutex); + if (features & static_cast<quint64>(1) << ProfileDebugMessages) { + if (QDebugMessageService *messageService = + QQmlDebugConnector::instance()->service<QDebugMessageService>()) + messageService->synchronizeTime(m_timer); + } + QQmlDebugPacket d; d << m_timer.nsecsElapsed() << (int)Event << (int)StartTrace; diff --git a/src/qml/debugger/qqmldebugserviceinterfaces_p.h b/src/qml/debugger/qqmldebugserviceinterfaces_p.h index 59712ee8ea..1b45392680 100644 --- a/src/qml/debugger/qqmldebugserviceinterfaces_p.h +++ b/src/qml/debugger/qqmldebugserviceinterfaces_p.h @@ -133,6 +133,8 @@ class Q_QML_PRIVATE_EXPORT QDebugMessageService : protected QQmlDebugService public: static const QString s_key; + virtual void synchronizeTime(const QElapsedTimer &otherTimer) = 0; + protected: friend class QQmlDebugConnector; diff --git a/src/qml/debugger/qqmlprofilerdefinitions_p.h b/src/qml/debugger/qqmlprofilerdefinitions_p.h index f87df8cfe5..ce708132f8 100644 --- a/src/qml/debugger/qqmlprofilerdefinitions_p.h +++ b/src/qml/debugger/qqmlprofilerdefinitions_p.h @@ -134,6 +134,7 @@ struct QQmlProfilerDefinitions { ProfileBinding, ProfileHandlingSignal, ProfileInputEvents, + ProfileDebugMessages, MaximumProfileFeature }; |