QmlDesigner: Adding simple performance logging to property editor

Change-Id: Idc8adce4ce245a9e470b898473ec9b02143827b2
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Thomas Hartmann
2017-01-04 14:26:05 +01:00
parent 3d168b67cb
commit fad8644041

View File

@@ -46,6 +46,9 @@
#include <QDir>
#include <QFileInfo>
#include <QLoggingCategory>
static Q_LOGGING_CATEGORY(propertyEditorBenchmark, "qtc.propertyeditor.load")
static QmlJS::SimpleReaderNode::Ptr s_templateConfiguration = QmlJS::SimpleReaderNode::Ptr();
@@ -269,6 +272,13 @@ void PropertyEditorQmlBackend::setup(const QmlObjectNode &qmlObjectNode, const Q
return;
if (qmlObjectNode.isValid()) {
qCInfo(propertyEditorBenchmark) << Q_FUNC_INFO;
QTime time;
if (propertyEditorBenchmark().isInfoEnabled())
time.start();
foreach (const PropertyName &propertyName, qmlObjectNode.modelNode().metaInfo().propertyNames())
createPropertyEditorValue(qmlObjectNode, propertyName, qmlObjectNode.instanceValue(propertyName), propertyEditor);
@@ -301,12 +311,18 @@ void PropertyEditorQmlBackend::setup(const QmlObjectNode &qmlObjectNode, const Q
context()->setContextProperty(QLatin1String("transaction"), m_propertyEditorTransaction.data());
qCInfo(propertyEditorBenchmark) << "anchors:" << time.elapsed();
// model node
m_backendModelNode.setup(qmlObjectNode.modelNode());
context()->setContextProperty(QLatin1String("modelNodeBackend"), &m_backendModelNode);
qCInfo(propertyEditorBenchmark) << "context:" << time.elapsed();
contextObject()->setSpecificsUrl(qmlSpecificsFile);
qCInfo(propertyEditorBenchmark) << "specifics:" << time.elapsed();
contextObject()->setStateName(stateName);
if (!qmlObjectNode.isValid())
return;
@@ -333,6 +349,8 @@ void PropertyEditorQmlBackend::setup(const QmlObjectNode &qmlObjectNode, const Q
contextObject()->setMajorQtQuickVersion(qmlObjectNode.view()->majorQtQuickVersion());
contextObject()->setMinorQtQuickVersion(qmlObjectNode.view()->minorQtQuickVersion());
qCInfo(propertyEditorBenchmark) << "final:" << time.elapsed();
} else {
qWarning() << "PropertyEditor: invalid node for setup";
}