aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlvme.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@digia.com>2013-11-27 17:21:27 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-29 11:35:20 +0100
commit927c39c8db6b5feeea5a60b1eab2bbb07eb4bbe7 (patch)
tree83f9560d45cc7facb3b453cc8888acbad80182a0 /src/qml/qml/qqmlvme.cpp
parent17c8fa04ce00a332310793b0e21991ab19c74e0d (diff)
Use the new object creation profiler in qqmlvme
There are 3 ways to create objects: "Simple", "Cpp" and "Qml". This patch starts a new profiler whenever a new object is created. It's assumed that everything the interpreter main loop does between two creation instructions is related to the object just created. The componentComplete calls are profiled by restoring saved states of the profilers used during the creation of the respective objects. Task-number: QTCREATORBUG-10631 Change-Id: I2645eab7ba32dfb8749cb51ec888d0f0e8fef188 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/qml/qqmlvme.cpp')
-rw-r--r--src/qml/qml/qqmlvme.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/qml/qml/qqmlvme.cpp b/src/qml/qml/qqmlvme.cpp
index 983136a846..ad1e9d862e 100644
--- a/src/qml/qml/qqmlvme.cpp
+++ b/src/qml/qml/qqmlvme.cpp
@@ -503,6 +503,12 @@ QObject *QQmlVME::run(QList<QQmlError> *errors,
const QQmlCompiledData::TypeReference &type = TYPES.at(instr.type);
Q_ASSERT(type.component);
+ if (profiler.enabled) {
+ profiler.start();
+ profiler.updateTypeName(type.component->name);
+ profiler.background();
+ }
+
states.push(State());
State *cState = &states[states.count() - 2];
@@ -524,6 +530,11 @@ QObject *QQmlVME::run(QList<QQmlError> *errors,
QML_END_INSTR(CreateQMLObject)
QML_BEGIN_INSTR(CompleteQMLObject)
+ if (profiler.enabled) {
+ profiler.foreground();
+ profiler.updateLocation(CTXT->url, instr.line, instr.column);
+ }
+
QObject *o = objects.top();
Q_ASSERT(o);
@@ -566,6 +577,8 @@ QObject *QQmlVME::run(QList<QQmlError> *errors,
QML_BEGIN_INSTR(CreateCppObject)
const QQmlCompiledData::TypeReference &type = TYPES.at(instr.type);
Q_ASSERT(type.type);
+ if (profiler.enabled)
+ profiler.start(CTXT->url, instr.line, instr.column, type.type->qmlTypeName());
QObject *o = 0;
void *memory = 0;
@@ -637,12 +650,14 @@ QObject *QQmlVME::run(QList<QQmlError> *errors,
QML_END_INSTR(CreateCppObject)
QML_BEGIN_INSTR(CreateSimpleObject)
+ const QQmlCompiledData::TypeReference &ref = TYPES.at(instr.type);
+ if (profiler.enabled)
+ profiler.start(CTXT->url, instr.line, instr.column, ref.type->qmlTypeName());
QObject *o = (QObject *)operator new(instr.typeSize + sizeof(QQmlData));
::memset(static_cast<void *>(o), 0, instr.typeSize + sizeof(QQmlData));
instr.create(o);
QQmlData *ddata = (QQmlData *)(((const char *)o) + instr.typeSize);
- const QQmlCompiledData::TypeReference &ref = TYPES.at(instr.type);
if (!ddata->propertyCache && ref.typePropertyCache) {
ddata->propertyCache = ref.typePropertyCache;
ddata->propertyCache->addref();
@@ -817,6 +832,8 @@ QObject *QQmlVME::run(QList<QQmlError> *errors,
QML_END_INSTR(StoreScriptString)
QML_BEGIN_INSTR(BeginObject)
+ if (profiler.enabled)
+ profiler.push();
QObject *target = objects.top();
QQmlParserStatus *status = reinterpret_cast<QQmlParserStatus *>(reinterpret_cast<char *>(target) + instr.castValue);
parserStatus.push(status);
@@ -1074,6 +1091,8 @@ normalExit:
objects.deallocate();
lists.deallocate();
states.clear();
+ if (profiler.enabled)
+ profiler.stop();
return rv;
}
@@ -1111,6 +1130,8 @@ void QQmlVME::reset()
states.clear();
rootContext = 0;
creationContext = 0;
+ if (profiler.enabled)
+ profiler.clear();
}
#ifdef QML_THREADED_VME_INTERPRETER
@@ -1170,6 +1191,8 @@ QQmlContextData *QQmlVME::complete(const Interrupt &interrupt)
if (componentCompleteEnabled()) { // the qml designer does the component complete later
QQmlTrace trace("VME Component Complete");
while (!parserStatus.isEmpty()) {
+ if (profiler.enabled)
+ profiler.pop();
QQmlParserStatus *status = parserStatus.pop();
#ifdef QML_ENABLE_TRACE
QQmlData *data = parserStatusData.pop();
@@ -1189,6 +1212,8 @@ QQmlContextData *QQmlVME::complete(const Interrupt &interrupt)
return 0;
}
parserStatus.deallocate();
+ if (profiler.enabled)
+ profiler.clear();
}
{