diff options
author | J-P Nurmi <jpnurmi@theqtcompany.com> | 2015-06-06 15:25:26 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@theqtcompany.com> | 2015-06-06 13:27:38 +0000 |
commit | b141f798d57310c60c59597aa9232f6884309d0a (patch) | |
tree | fc765f76c84481b57c2de3abc6b7598c4ef23036 /tests/benchmarks | |
parent | 2cf45bda2fa5bbf0348ff3d38664a726d54f4fe0 (diff) |
Improve tst_objectcount
Add support for VERBOSE=1 to get detailed object list, and improve the
warmup by importing both controls and loading an image to avoid plugin
loaders and image format plugins showing up in the numbers.
Change-Id: I26cfdc6d71fe36b45b706164f696bbb7f055f078
Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'tests/benchmarks')
-rw-r--r-- | tests/benchmarks/objectcount/objectcount.pro | 3 | ||||
-rw-r--r-- | tests/benchmarks/objectcount/objectcount.qrc | 5 | ||||
-rw-r--r-- | tests/benchmarks/objectcount/qt-logo.png | bin | 0 -> 21710 bytes | |||
-rw-r--r-- | tests/benchmarks/objectcount/tst_objectcount.cpp | 19 |
4 files changed, 22 insertions, 5 deletions
diff --git a/tests/benchmarks/objectcount/objectcount.pro b/tests/benchmarks/objectcount/objectcount.pro index f54d72d6..801fff58 100644 --- a/tests/benchmarks/objectcount/objectcount.pro +++ b/tests/benchmarks/objectcount/objectcount.pro @@ -7,3 +7,6 @@ osx:CONFIG -= app_bundle SOURCES += \ tst_objectcount.cpp + +RESOURCES += \ + objectcount.qrc diff --git a/tests/benchmarks/objectcount/objectcount.qrc b/tests/benchmarks/objectcount/objectcount.qrc new file mode 100644 index 00000000..3c2c8a64 --- /dev/null +++ b/tests/benchmarks/objectcount/objectcount.qrc @@ -0,0 +1,5 @@ +<!DOCTYPE RCC><RCC version="1.0"> +<qresource> + <file>qt-logo.png</file> +</qresource> +</RCC> diff --git a/tests/benchmarks/objectcount/qt-logo.png b/tests/benchmarks/objectcount/qt-logo.png Binary files differnew file mode 100644 index 00000000..cf350dad --- /dev/null +++ b/tests/benchmarks/objectcount/qt-logo.png diff --git a/tests/benchmarks/objectcount/tst_objectcount.cpp b/tests/benchmarks/objectcount/tst_objectcount.cpp index d8493730..8caea23d 100644 --- a/tests/benchmarks/objectcount/tst_objectcount.cpp +++ b/tests/benchmarks/objectcount/tst_objectcount.cpp @@ -38,6 +38,8 @@ #include <QtQuick> #include <QtCore/private/qhooks_p.h> +static int qt_verbose = qgetenv("VERBOSE").toInt() != 0; + Q_GLOBAL_STATIC(QObjectList, qt_qobjects) extern "C" Q_DECL_EXPORT void qt_addQObject(QObject *object) @@ -72,7 +74,7 @@ void tst_ObjectCount::init() // warmup QQmlComponent component(&engine); - component.setData("import QtQuick 2.0; Item { Accessible.role: Accessible.Button }", QUrl()); + component.setData("import QtQuick 2.0; import QtQuick.Controls 1.3; import QtQuick.Controls 2.0; Image { Accessible.role: Accessible.Button; source: 'qrc:/qt-logo.png' }", QUrl()); delete component.create(); } @@ -82,6 +84,15 @@ void tst_ObjectCount::cleanup() qtHookData[QHooks::RemoveQObject] = 0; } +static void printItems(const QString &prefix, const QList<QQuickItem *> &items) +{ + qInfo() << prefix << "QQuickItems:" << items.count() << "(total of QObjects:" << qt_qobjects->count() << ")"; + if (qt_verbose) { + foreach (QObject *object, *qt_qobjects) + qInfo() << "\t" << object; + } +} + void tst_ObjectCount::testCount() { QFETCH(QByteArray, v1); @@ -101,8 +112,7 @@ void tst_ObjectCount::testCount() if (item) items += item; } - - qInfo() << "V1: QQuickItems:" << items.count() << "(total of QObjects:" << qt_qobjects->count() << ")"; + printItems("V1", items); } qt_qobjects->clear(); @@ -119,8 +129,7 @@ void tst_ObjectCount::testCount() if (item) items += item; } - - qInfo() << "V2: QQuickItems:" << items.count() << "(total of QObjects:" << qt_qobjects->count() << ")"; + printItems("V2", items); } } |