aboutsummaryrefslogtreecommitdiffstats
path: root/tests/benchmarks/objectcount/tst_objectcount.cpp
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2015-06-06 15:25:26 +0200
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2015-06-06 13:27:38 +0000
commitb141f798d57310c60c59597aa9232f6884309d0a (patch)
treefc765f76c84481b57c2de3abc6b7598c4ef23036 /tests/benchmarks/objectcount/tst_objectcount.cpp
parent2cf45bda2fa5bbf0348ff3d38664a726d54f4fe0 (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/objectcount/tst_objectcount.cpp')
-rw-r--r--tests/benchmarks/objectcount/tst_objectcount.cpp19
1 files changed, 14 insertions, 5 deletions
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);
}
}