diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-01-31 17:34:11 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-01-31 17:34:11 +0100 |
commit | accee605bdf79f71b568d8baeb3cdea98e7fa58e (patch) | |
tree | 90bb18bd21c968d1606519e6ad8eefe98c9471ec /examples | |
parent | 13e81a74e8c9da465a7ebc1027e0c13c01856045 (diff) | |
download | sink-accee605bdf79f71b568d8baeb3cdea98e7fa58e.tar.gz sink-accee605bdf79f71b568d8baeb3cdea98e7fa58e.zip |
HAWD definitions for imapmailsyncbenchmark
Diffstat (limited to 'examples')
-rw-r--r-- | examples/imapresource/tests/CMakeLists.txt | 2 | ||||
-rw-r--r-- | examples/imapresource/tests/imapmailsyncbenchmark.cpp | 28 |
2 files changed, 24 insertions, 6 deletions
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 @@ | |||
1 | set(CMAKE_AUTOMOC ON) | 1 | set(CMAKE_AUTOMOC ON) |
2 | include_directories( | 2 | include_directories( |
3 | ${CMAKE_CURRENT_BINARY_DIR} | 3 | ${CMAKE_CURRENT_BINARY_DIR} |
4 | ${CMAKE_CURRENT_SOURCE_DIR}/../../../tests/hawd | ||
5 | ${CMAKE_CURRENT_BINARY_DIR}/../../../tests/hawd | ||
4 | ) | 6 | ) |
5 | 7 | ||
6 | include(SinkTest) | 8 | 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 @@ | |||
19 | #include <QtTest> | 19 | #include <QtTest> |
20 | #include <QTcpSocket> | 20 | #include <QTcpSocket> |
21 | 21 | ||
22 | #include <tests/mailsynctest.h> | ||
23 | #include "../imapresource.h" | 22 | #include "../imapresource.h" |
24 | #include "../imapserverproxy.h" | 23 | #include "../imapserverproxy.h" |
24 | #include "tests/testutils.h" | ||
25 | 25 | ||
26 | #include "common/test.h" | 26 | #include "common/test.h" |
27 | #include "common/domain/applicationdomaintype.h" | 27 | #include "common/domain/applicationdomaintype.h" |
@@ -29,6 +29,9 @@ | |||
29 | #include "common/resourcecontrol.h" | 29 | #include "common/resourcecontrol.h" |
30 | #include "common/secretstore.h" | 30 | #include "common/secretstore.h" |
31 | 31 | ||
32 | #include <tests/hawd/dataset.h> | ||
33 | #include <tests/hawd/formatter.h> | ||
34 | |||
32 | using namespace Sink; | 35 | using namespace Sink; |
33 | using namespace Sink::ApplicationDomain; | 36 | using namespace Sink::ApplicationDomain; |
34 | 37 | ||
@@ -70,6 +73,7 @@ class ImapMailSyncBenchmark : public QObject | |||
70 | 73 | ||
71 | QByteArray mResourceInstanceIdentifier; | 74 | QByteArray mResourceInstanceIdentifier; |
72 | QByteArrayList mCapabilities; | 75 | QByteArrayList mCapabilities; |
76 | HAWD::State mHawdState; | ||
73 | 77 | ||
74 | private slots: | 78 | private slots: |
75 | 79 | ||
@@ -102,25 +106,37 @@ private slots: | |||
102 | { | 106 | { |
103 | Sink::Query query; | 107 | Sink::Query query; |
104 | query.resourceFilter(mResourceInstanceIdentifier); | 108 | query.resourceFilter(mResourceInstanceIdentifier); |
105 | query.request<Folder::Name>().request<Folder::SpecialPurpose>(); | ||
106 | 109 | ||
107 | QTime time; | 110 | QTime time; |
108 | time.start(); | 111 | time.start(); |
109 | 112 | ||
110 | // Ensure all local data is processed | 113 | // Ensure all local data is processed |
111 | VERIFYEXEC(Store::synchronize(query)); | 114 | VERIFYEXEC(Store::synchronize(query)); |
112 | SinkLog() << "Sync took: " << Sink::Log::TraceTime(time.elapsed()); | 115 | auto sync = time.elapsed(); |
116 | SinkLog() << "Sync took: " << Sink::Log::TraceTime(sync); | ||
113 | 117 | ||
114 | VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); | 118 | VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); |
115 | SinkLog() << "Total took: " << Sink::Log::TraceTime(time.elapsed()); | 119 | auto total = time.elapsed(); |
120 | SinkLog() << "Total took: " << Sink::Log::TraceTime(total); | ||
116 | 121 | ||
117 | time.start(); | 122 | time.start(); |
118 | 123 | ||
119 | VERIFYEXEC(Store::synchronize(query)); | 124 | VERIFYEXEC(Store::synchronize(query)); |
120 | SinkLog() << "ReSync took: " << Sink::Log::TraceTime(time.elapsed()); | 125 | auto resync = time.elapsed(); |
126 | SinkLog() << "ReSync took: " << Sink::Log::TraceTime(resync); | ||
121 | 127 | ||
122 | VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); | 128 | VERIFYEXEC(ResourceControl::flushMessageQueue(QByteArrayList() << mResourceInstanceIdentifier)); |
123 | SinkLog() << "Total resync took: " << Sink::Log::TraceTime(time.elapsed()); | 129 | auto resynctotal = time.elapsed(); |
130 | SinkLog() << "Total resync took: " << Sink::Log::TraceTime(resynctotal); | ||
131 | |||
132 | HAWD::Dataset dataset("imap_mail_sync", mHawdState); | ||
133 | HAWD::Dataset::Row row = dataset.row(); | ||
134 | row.setValue("sync", sync); | ||
135 | row.setValue("total", total); | ||
136 | row.setValue("resync", resync); | ||
137 | row.setValue("resynctotal", resynctotal); | ||
138 | dataset.insertRow(row); | ||
139 | HAWD::Formatter::print(dataset); | ||
124 | } | 140 | } |
125 | }; | 141 | }; |
126 | 142 | ||