summaryrefslogtreecommitdiffstats
path: root/tests/dummyresourcebenchmark.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/dummyresourcebenchmark.cpp')
-rw-r--r--tests/dummyresourcebenchmark.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/tests/dummyresourcebenchmark.cpp b/tests/dummyresourcebenchmark.cpp
index 7375ff8..308a4e8 100644
--- a/tests/dummyresourcebenchmark.cpp
+++ b/tests/dummyresourcebenchmark.cpp
@@ -3,6 +3,7 @@
3#include <QString> 3#include <QString>
4 4
5#include "dummyresource/resourcefactory.h" 5#include "dummyresource/resourcefactory.h"
6#include "dummyresource/domainadaptor.h"
6#include "clientapi.h" 7#include "clientapi.h"
7#include "commands.h" 8#include "commands.h"
8#include "entitybuffer.h" 9#include "entitybuffer.h"
@@ -11,7 +12,6 @@
11#include "entity_generated.h" 12#include "entity_generated.h"
12#include "metadata_generated.h" 13#include "metadata_generated.h"
13#include "createentity_generated.h" 14#include "createentity_generated.h"
14#include "dummyresource/resourcefactory.h"
15 15
16static void removeFromDisk(const QString &name) 16static void removeFromDisk(const QString &name)
17{ 17{
@@ -144,6 +144,26 @@ private Q_SLOTS:
144 qDebug() << "Append to messagequeue " << appendTime; 144 qDebug() << "Append to messagequeue " << appendTime;
145 qDebug() << "All processed: " << allProcessedTime << "/sec " << num*1000/allProcessedTime; 145 qDebug() << "All processed: " << allProcessedTime << "/sec " << num*1000/allProcessedTime;
146 } 146 }
147 void testCreateCommand()
148 {
149 Akonadi2::Domain::Event event;
150
151 QBENCHMARK {
152 auto mFactory = new DummyEventAdaptorFactory;
153 static flatbuffers::FlatBufferBuilder entityFbb;
154 entityFbb.Clear();
155 mFactory->createBuffer(event, entityFbb);
156
157 static flatbuffers::FlatBufferBuilder fbb;
158 fbb.Clear();
159 //This is the resource buffer type and not the domain type
160 auto type = fbb.CreateString("event");
161 // auto delta = fbb.CreateVector<uint8_t>(entityFbb.GetBufferPointer(), entityFbb.GetSize());
162 auto delta = Akonadi2::EntityBuffer::appendAsVector(fbb, entityFbb.GetBufferPointer(), entityFbb.GetSize());
163 auto location = Akonadi2::Commands::CreateCreateEntity(fbb, type, delta);
164 Akonadi2::Commands::FinishCreateEntityBuffer(fbb, location);
165 }
166 }
147}; 167};
148 168
149QTEST_MAIN(DummyResourceBenchmark) 169QTEST_MAIN(DummyResourceBenchmark)