diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-03-29 07:13:37 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-03-29 07:14:16 (GMT) |
commit | ca3f5521e1d3ada541739d6013d8c6fb795244a9 (patch) | |
tree | 9a59d006910eb3be768f0d4158d3b9c7f7e8a587 /src/declarative/qml | |
parent | c253bd186f95573650cc1c25983cdab24a5c35c2 (diff) | |
download | Qt-ca3f5521e1d3ada541739d6013d8c6fb795244a9.zip Qt-ca3f5521e1d3ada541739d6013d8c6fb795244a9.tar.gz Qt-ca3f5521e1d3ada541739d6013d8c6fb795244a9.tar.bz2 |
Improve QML compiler statistics
Diffstat (limited to 'src/declarative/qml')
-rw-r--r-- | src/declarative/qml/qdeclarativecompiler.cpp | 47 | ||||
-rw-r--r-- | src/declarative/qml/qdeclarativecompiler_p.h | 7 |
2 files changed, 45 insertions, 9 deletions
diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index f1a673f..56af5f5 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -80,7 +80,7 @@ QT_BEGIN_NAMESPACE DEFINE_BOOL_CONFIG_OPTION(compilerDump, QML_COMPILER_DUMP); -DEFINE_BOOL_CONFIG_OPTION(compilerStatDump, QML_COMPILER_STATISTICS_DUMP); +DEFINE_BOOL_CONFIG_OPTION(compilerStatDump, QML_COMPILER_STATS); DEFINE_BOOL_CONFIG_OPTION(bindingsDump, QML_BINDINGS_DUMP); using namespace QDeclarativeParser; @@ -617,6 +617,7 @@ bool QDeclarativeCompiler::compile(QDeclarativeEngine *engine, void QDeclarativeCompiler::compileTree(Object *tree) { compileState.root = tree; + componentStat.lineNumber = tree->location.start.line; if (!buildObject(tree, BindingContext()) || !completeComponentBuild()) return; @@ -2784,7 +2785,7 @@ bool QDeclarativeCompiler::completeComponentBuild() if (index != -1) { binding.dataType = BindingReference::Experimental; binding.compiledIndex = index; - componentStat.optimizedBindings++; + componentStat.optimizedBindings.append(iter.key()->location); continue; } @@ -2818,7 +2819,7 @@ bool QDeclarativeCompiler::completeComponentBuild() QByteArray((const char *)expression.constData(), expression.length() * sizeof(QChar)); - componentStat.scriptBindings++; + componentStat.scriptBindings.append(iter.key()->location); } if (bindingCompiler.isValid()) { @@ -2840,8 +2841,44 @@ void QDeclarativeCompiler::dumpStats() qWarning().nospace() << " Component Line " << stat.lineNumber; qWarning().nospace() << " Total Objects: " << stat.objects; qWarning().nospace() << " IDs Used: " << stat.ids; - qWarning().nospace() << " Optimized Bindings: " << stat.optimizedBindings; - qWarning().nospace() << " QScript Bindings: " << stat.scriptBindings; + qWarning().nospace() << " Optimized Bindings: " << stat.optimizedBindings.count(); + + { + QByteArray output; + for (int ii = 0; ii < stat.optimizedBindings.count(); ++ii) { + if (0 == (ii % 10)) { + if (ii) output.append("\n"); + output.append(" "); + } + + output.append("("); + output.append(QByteArray::number(stat.optimizedBindings.at(ii).start.line)); + output.append(":"); + output.append(QByteArray::number(stat.optimizedBindings.at(ii).start.column)); + output.append(") "); + } + if (!output.isEmpty()) + qWarning().nospace() << output.constData(); + } + + qWarning().nospace() << " QScript Bindings: " << stat.scriptBindings.count(); + { + QByteArray output; + for (int ii = 0; ii < stat.scriptBindings.count(); ++ii) { + if (0 == (ii % 10)) { + if (ii) output.append("\n"); + output.append(" "); + } + + output.append("("); + output.append(QByteArray::number(stat.scriptBindings.at(ii).start.line)); + output.append(":"); + output.append(QByteArray::number(stat.scriptBindings.at(ii).start.column)); + output.append(") "); + } + if (!output.isEmpty()) + qWarning().nospace() << output.constData(); + } } } diff --git a/src/declarative/qml/qdeclarativecompiler_p.h b/src/declarative/qml/qdeclarativecompiler_p.h index a81259b..e5836d1 100644 --- a/src/declarative/qml/qdeclarativecompiler_p.h +++ b/src/declarative/qml/qdeclarativecompiler_p.h @@ -318,14 +318,13 @@ private: struct ComponentStat { - ComponentStat() - : ids(0), scriptBindings(0), optimizedBindings(0), objects(0) {} + ComponentStat() : ids(0), objects(0) {} int lineNumber; int ids; - int scriptBindings; - int optimizedBindings; + QList<QDeclarativeParser::LocationSpan> scriptBindings; + QList<QDeclarativeParser::LocationSpan> optimizedBindings; int objects; }; ComponentStat componentStat; |