diff options
author | Markus Goetz <Markus.Goetz@nokia.com> | 2010-03-04 12:52:03 (GMT) |
---|---|---|
committer | Markus Goetz <Markus.Goetz@nokia.com> | 2010-03-04 13:42:14 (GMT) |
commit | ce7f914e8db0cad698d934569f1c323e5b231bc9 (patch) | |
tree | 3ef977530e4dfaa2edbcbd87ce3210527f1eda60 /tests/benchmarks/network | |
parent | d644fcf668203a6d2f4af8fee350c672196ad11b (diff) | |
download | Qt-ce7f914e8db0cad698d934569f1c323e5b231bc9.zip Qt-ce7f914e8db0cad698d934569f1c323e5b231bc9.tar.gz Qt-ce7f914e8db0cad698d934569f1c323e5b231bc9.tar.bz2 |
qhostinfo benchmark: Benchmark the with-cache and without-cache
Reviewed-by: joao
Diffstat (limited to 'tests/benchmarks/network')
-rw-r--r-- | tests/benchmarks/network/kernel/qhostinfo/main.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/benchmarks/network/kernel/qhostinfo/main.cpp b/tests/benchmarks/network/kernel/qhostinfo/main.cpp index 0ae1b7f..ebdea5e 100644 --- a/tests/benchmarks/network/kernel/qhostinfo/main.cpp +++ b/tests/benchmarks/network/kernel/qhostinfo/main.cpp @@ -48,9 +48,14 @@ #include <qtest.h> #include <qtesteventloop.h> +#include "private/qhostinfo_p.h" + class tst_qhostinfo : public QObject { Q_OBJECT +public slots: + void initTestCase(); + void init(); private slots: void lookupSpeed(); }; @@ -70,14 +75,38 @@ public slots: } }; +void tst_qhostinfo::initTestCase() +{ + // run each testcase with and without cache enabled + QTest::addColumn<bool>("cache"); + QTest::newRow("WithCache") << true; + QTest::newRow("WithoutCache") << false; +} + +void tst_qhostinfo::init() +{ + // delete the cache so inidividual testcase results are independant from each other + qt_qhostinfo_clear_cache(); + + QFETCH_GLOBAL(bool, cache); + qt_qhostinfo_enable_cache(cache); +} + + void tst_qhostinfo::lookupSpeed() { + QFETCH_GLOBAL(bool, cache); + qDebug() << "Cache enabled:" << cache; + QStringList hostnameList; hostnameList << "www.ovi.com" << "www.nokia.com" << "qt.nokia.com" << "www.trolltech.com" << "troll.no" << "www.qtcentre.org" << "forum.nokia.com" << "www.forum.nokia.com" << "wiki.forum.nokia.com" << "www.nokia.no" << "nokia.de" << "127.0.0.1" << "----"; // also add some duplicates: hostnameList << "www.nokia.com" << "127.0.0.1" << "www.trolltech.com"; + // and some more + hostnameList << hostnameList; + const int COUNT = hostnameList.size(); SignalReceiver receiver(COUNT); |