From accee605bdf79f71b568d8baeb3cdea98e7fa58e Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 31 Jan 2018 17:34:11 +0100 Subject: HAWD definitions for imapmailsyncbenchmark --- examples/imapresource/tests/CMakeLists.txt | 2 ++ .../imapresource/tests/imapmailsyncbenchmark.cpp | 28 +++++++++++++++++----- 2 files changed, 24 insertions(+), 6 deletions(-) (limited to 'examples') diff --git a/examples/imapresource/tests/CMakeLists.txt b/examples/imapresource/tests/CMakeLists.txt index c252a4f..4d26a9f 100644 --- a/examples/imapresource/tests/CMakeLists.txt +++ b/examples/imapresource/tests/CMakeLists.txt @@ -1,6 +1,8 @@ set(CMAKE_AUTOMOC ON) include_directories( ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/../../../tests/hawd + ${CMAKE_CURRENT_BINARY_DIR}/../../../tests/hawd ) include(SinkTest) diff --git a/examples/imapresource/tests/imapmailsyncbenchmark.cpp b/examples/imapresource/tests/imapmailsyncbenchmark.cpp index b5c3645..5f16518 100644 --- a/examples/imapresource/tests/imapmailsyncbenchmark.cpp +++ b/examples/imapresource/tests/imapmailsyncbenchmark.cpp @@ -19,9 +19,9 @@ #include #include -#include #include "../imapresource.h" #include "../imapserverproxy.h" +#include "tests/testutils.h" #include "common/test.h" #include "common/domain/applicationdomaintype.h" @@ -29,6 +29,9 @@ #include "common/resourcecontrol.h" #include "common/secretstore.h" +#include +#include + using namespace Sink; using namespace Sink::ApplicationDomain; @@ -70,6 +73,7 @@ class ImapMailSyncBenchmark : public QObject QByteArray mResourceInstanceIdentifier; QByteArrayList mCapabilities; + HAWD::State mHawdState; private slots: @@ -102,25 +106,37 @@ private slots: { Sink::Query query; query.resourceFilter(mResourceInstanceIdentifier); - query.request().request(); QTime time; time.start(); // Ensure all local data is processed VERIFYEXEC(Store::synchronize(query)); - SinkLog() << "Sync took: " << Sink::Log::TraceTime(time.elapsed()); + auto sync = time.elapsed(); + SinkLog() << "Sync took: " << Sink::Log::TraceTime(sync); VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); - SinkLog() << "Total took: " << Sink::Log::TraceTime(time.elapsed()); + auto total = time.elapsed(); + SinkLog() << "Total took: " << Sink::Log::TraceTime(total); time.start(); VERIFYEXEC(Store::synchronize(query)); - SinkLog() << "ReSync took: " << Sink::Log::TraceTime(time.elapsed()); + auto resync = time.elapsed(); + SinkLog() << "ReSync took: " << Sink::Log::TraceTime(resync); VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); - SinkLog() << "Total resync took: " << Sink::Log::TraceTime(time.elapsed()); + auto resynctotal = time.elapsed(); + SinkLog() << "Total resync took: " << Sink::Log::TraceTime(resynctotal); + + HAWD::Dataset dataset("imap_mail_sync", mHawdState); + HAWD::Dataset::Row row = dataset.row(); + row.setValue("sync", sync); + row.setValue("total", total); + row.setValue("resync", resync); + row.setValue("resynctotal", resynctotal); + dataset.insertRow(row); + HAWD::Formatter::print(dataset); } }; -- cgit v1.2.3