diff options
Diffstat (limited to 'tests/dummyresourcebenchmark.cpp')
-rw-r--r-- | tests/dummyresourcebenchmark.cpp | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/tests/dummyresourcebenchmark.cpp b/tests/dummyresourcebenchmark.cpp index c52eee3..e511613 100644 --- a/tests/dummyresourcebenchmark.cpp +++ b/tests/dummyresourcebenchmark.cpp | |||
@@ -30,8 +30,8 @@ private: | |||
30 | private Q_SLOTS: | 30 | private Q_SLOTS: |
31 | void initTestCase() | 31 | void initTestCase() |
32 | { | 32 | { |
33 | Akonadi2::Log::setDebugOutputLevel(Akonadi2::Log::Warning); | 33 | Sink::Log::setDebugOutputLevel(Sink::Log::Warning); |
34 | auto factory = Akonadi2::ResourceFactory::load("org.kde.dummy"); | 34 | auto factory = Sink::ResourceFactory::load("org.kde.dummy"); |
35 | QVERIFY(factory); | 35 | QVERIFY(factory); |
36 | ResourceConfig::addResource("org.kde.dummy.instance1", "org.kde.dummy"); | 36 | ResourceConfig::addResource("org.kde.dummy.instance1", "org.kde.dummy"); |
37 | num = 5000; | 37 | num = 5000; |
@@ -79,20 +79,20 @@ private Q_SLOTS: | |||
79 | time.start(); | 79 | time.start(); |
80 | QList<KAsync::Future<void> > waitCondition; | 80 | QList<KAsync::Future<void> > waitCondition; |
81 | for (int i = 0; i < num; i++) { | 81 | for (int i = 0; i < num; i++) { |
82 | Akonadi2::ApplicationDomain::Event event("org.kde.dummy.instance1"); | 82 | Sink::ApplicationDomain::Event event("org.kde.dummy.instance1"); |
83 | event.setProperty("uid", "testuid"); | 83 | event.setProperty("uid", "testuid"); |
84 | QCOMPARE(event.getProperty("uid").toByteArray(), QByteArray("testuid")); | 84 | QCOMPARE(event.getProperty("uid").toByteArray(), QByteArray("testuid")); |
85 | event.setProperty("summary", "summaryValue"); | 85 | event.setProperty("summary", "summaryValue"); |
86 | waitCondition << Akonadi2::Store::create<Akonadi2::ApplicationDomain::Event>(event).exec(); | 86 | waitCondition << Sink::Store::create<Sink::ApplicationDomain::Event>(event).exec(); |
87 | } | 87 | } |
88 | waitForCompletion(waitCondition).exec().waitForFinished(); | 88 | waitForCompletion(waitCondition).exec().waitForFinished(); |
89 | auto appendTime = time.elapsed(); | 89 | auto appendTime = time.elapsed(); |
90 | 90 | ||
91 | //Ensure everything is processed | 91 | //Ensure everything is processed |
92 | { | 92 | { |
93 | Akonadi2::Query query; | 93 | Sink::Query query; |
94 | query.resources << "org.kde.dummy.instance1"; | 94 | query.resources << "org.kde.dummy.instance1"; |
95 | Akonadi2::Store::flushMessageQueue(query.resources).exec().waitForFinished(); | 95 | Sink::Store::flushMessageQueue(query.resources).exec().waitForFinished(); |
96 | } | 96 | } |
97 | auto allProcessedTime = time.elapsed(); | 97 | auto allProcessedTime = time.elapsed(); |
98 | 98 | ||
@@ -119,11 +119,11 @@ private Q_SLOTS: | |||
119 | //Measure query | 119 | //Measure query |
120 | { | 120 | { |
121 | time.start(); | 121 | time.start(); |
122 | Akonadi2::Query query; | 122 | Sink::Query query; |
123 | query.resources << "org.kde.dummy.instance1"; | 123 | query.resources << "org.kde.dummy.instance1"; |
124 | 124 | ||
125 | query.propertyFilter.insert("uid", "testuid"); | 125 | query.propertyFilter.insert("uid", "testuid"); |
126 | auto model = Akonadi2::Store::loadModel<Akonadi2::ApplicationDomain::Event>(query); | 126 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Event>(query); |
127 | QTRY_COMPARE(model->rowCount(QModelIndex()), num); | 127 | QTRY_COMPARE(model->rowCount(QModelIndex()), num); |
128 | } | 128 | } |
129 | auto queryTime = time.elapsed(); | 129 | auto queryTime = time.elapsed(); |
@@ -142,44 +142,44 @@ private Q_SLOTS: | |||
142 | QTime time; | 142 | QTime time; |
143 | time.start(); | 143 | time.start(); |
144 | 144 | ||
145 | auto pipeline = QSharedPointer<Akonadi2::Pipeline>::create("org.kde.dummy.instance1"); | 145 | auto pipeline = QSharedPointer<Sink::Pipeline>::create("org.kde.dummy.instance1"); |
146 | DummyResource resource("org.kde.dummy.instance1", pipeline); | 146 | DummyResource resource("org.kde.dummy.instance1", pipeline); |
147 | 147 | ||
148 | flatbuffers::FlatBufferBuilder eventFbb; | 148 | flatbuffers::FlatBufferBuilder eventFbb; |
149 | eventFbb.Clear(); | 149 | eventFbb.Clear(); |
150 | { | 150 | { |
151 | auto summary = eventFbb.CreateString("summary"); | 151 | auto summary = eventFbb.CreateString("summary"); |
152 | Akonadi2::ApplicationDomain::Buffer::EventBuilder eventBuilder(eventFbb); | 152 | Sink::ApplicationDomain::Buffer::EventBuilder eventBuilder(eventFbb); |
153 | eventBuilder.add_summary(summary); | 153 | eventBuilder.add_summary(summary); |
154 | auto eventLocation = eventBuilder.Finish(); | 154 | auto eventLocation = eventBuilder.Finish(); |
155 | Akonadi2::ApplicationDomain::Buffer::FinishEventBuffer(eventFbb, eventLocation); | 155 | Sink::ApplicationDomain::Buffer::FinishEventBuffer(eventFbb, eventLocation); |
156 | } | 156 | } |
157 | 157 | ||
158 | flatbuffers::FlatBufferBuilder localFbb; | 158 | flatbuffers::FlatBufferBuilder localFbb; |
159 | { | 159 | { |
160 | auto uid = localFbb.CreateString("testuid"); | 160 | auto uid = localFbb.CreateString("testuid"); |
161 | auto localBuilder = Akonadi2::ApplicationDomain::Buffer::EventBuilder(localFbb); | 161 | auto localBuilder = Sink::ApplicationDomain::Buffer::EventBuilder(localFbb); |
162 | localBuilder.add_uid(uid); | 162 | localBuilder.add_uid(uid); |
163 | auto location = localBuilder.Finish(); | 163 | auto location = localBuilder.Finish(); |
164 | Akonadi2::ApplicationDomain::Buffer::FinishEventBuffer(localFbb, location); | 164 | Sink::ApplicationDomain::Buffer::FinishEventBuffer(localFbb, location); |
165 | } | 165 | } |
166 | 166 | ||
167 | flatbuffers::FlatBufferBuilder entityFbb; | 167 | flatbuffers::FlatBufferBuilder entityFbb; |
168 | Akonadi2::EntityBuffer::assembleEntityBuffer(entityFbb, 0, 0, eventFbb.GetBufferPointer(), eventFbb.GetSize(), localFbb.GetBufferPointer(), localFbb.GetSize()); | 168 | Sink::EntityBuffer::assembleEntityBuffer(entityFbb, 0, 0, eventFbb.GetBufferPointer(), eventFbb.GetSize(), localFbb.GetBufferPointer(), localFbb.GetSize()); |
169 | 169 | ||
170 | flatbuffers::FlatBufferBuilder fbb; | 170 | flatbuffers::FlatBufferBuilder fbb; |
171 | auto type = fbb.CreateString(Akonadi2::ApplicationDomain::getTypeName<Akonadi2::ApplicationDomain::Event>().toStdString().data()); | 171 | auto type = fbb.CreateString(Sink::ApplicationDomain::getTypeName<Sink::ApplicationDomain::Event>().toStdString().data()); |
172 | auto delta = fbb.CreateVector<uint8_t>(entityFbb.GetBufferPointer(), entityFbb.GetSize()); | 172 | auto delta = fbb.CreateVector<uint8_t>(entityFbb.GetBufferPointer(), entityFbb.GetSize()); |
173 | Akonadi2::Commands::CreateEntityBuilder builder(fbb); | 173 | Sink::Commands::CreateEntityBuilder builder(fbb); |
174 | builder.add_domainType(type); | 174 | builder.add_domainType(type); |
175 | builder.add_delta(delta); | 175 | builder.add_delta(delta); |
176 | auto location = builder.Finish(); | 176 | auto location = builder.Finish(); |
177 | Akonadi2::Commands::FinishCreateEntityBuffer(fbb, location); | 177 | Sink::Commands::FinishCreateEntityBuffer(fbb, location); |
178 | 178 | ||
179 | const QByteArray command(reinterpret_cast<const char *>(fbb.GetBufferPointer()), fbb.GetSize()); | 179 | const QByteArray command(reinterpret_cast<const char *>(fbb.GetBufferPointer()), fbb.GetSize()); |
180 | 180 | ||
181 | for (int i = 0; i < num; i++) { | 181 | for (int i = 0; i < num; i++) { |
182 | resource.processCommand(Akonadi2::Commands::CreateEntityCommand, command); | 182 | resource.processCommand(Sink::Commands::CreateEntityCommand, command); |
183 | } | 183 | } |
184 | auto appendTime = time.elapsed(); | 184 | auto appendTime = time.elapsed(); |
185 | 185 | ||
@@ -203,7 +203,7 @@ private Q_SLOTS: | |||
203 | 203 | ||
204 | void testCreateCommand() | 204 | void testCreateCommand() |
205 | { | 205 | { |
206 | Akonadi2::ApplicationDomain::Event event; | 206 | Sink::ApplicationDomain::Event event; |
207 | 207 | ||
208 | QBENCHMARK { | 208 | QBENCHMARK { |
209 | auto mFactory = new DummyEventAdaptorFactory; | 209 | auto mFactory = new DummyEventAdaptorFactory; |
@@ -217,9 +217,9 @@ private Q_SLOTS: | |||
217 | auto entityId = fbb.CreateString(""); | 217 | auto entityId = fbb.CreateString(""); |
218 | auto type = fbb.CreateString("event"); | 218 | auto type = fbb.CreateString("event"); |
219 | // auto delta = fbb.CreateVector<uint8_t>(entityFbb.GetBufferPointer(), entityFbb.GetSize()); | 219 | // auto delta = fbb.CreateVector<uint8_t>(entityFbb.GetBufferPointer(), entityFbb.GetSize()); |
220 | auto delta = Akonadi2::EntityBuffer::appendAsVector(fbb, entityFbb.GetBufferPointer(), entityFbb.GetSize()); | 220 | auto delta = Sink::EntityBuffer::appendAsVector(fbb, entityFbb.GetBufferPointer(), entityFbb.GetSize()); |
221 | auto location = Akonadi2::Commands::CreateCreateEntity(fbb, entityId, type, delta); | 221 | auto location = Sink::Commands::CreateCreateEntity(fbb, entityId, type, delta); |
222 | Akonadi2::Commands::FinishCreateEntityBuffer(fbb, location); | 222 | Sink::Commands::FinishCreateEntityBuffer(fbb, location); |
223 | } | 223 | } |
224 | } | 224 | } |
225 | 225 | ||