summaryrefslogtreecommitdiffstats
path: root/tests/genericresourcebenchmark.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/genericresourcebenchmark.cpp')
-rw-r--r--tests/genericresourcebenchmark.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/tests/genericresourcebenchmark.cpp b/tests/genericresourcebenchmark.cpp
index b3af6a6..a0a368c 100644
--- a/tests/genericresourcebenchmark.cpp
+++ b/tests/genericresourcebenchmark.cpp
@@ -60,7 +60,8 @@ static QByteArray createEntityBuffer()
60 return QByteArray(reinterpret_cast<const char *>(fbb.GetBufferPointer()), fbb.GetSize()); 60 return QByteArray(reinterpret_cast<const char *>(fbb.GetBufferPointer()), fbb.GetSize());
61} 61}
62 62
63class IndexUpdater : public Sink::Preprocessor { 63class IndexUpdater : public Sink::Preprocessor
64{
64public: 65public:
65 void newEntity(const QByteArray &uid, qint64 revision, const Sink::ApplicationDomain::BufferAdaptor &newEntity, Sink::Storage::Transaction &transaction) Q_DECL_OVERRIDE 66 void newEntity(const QByteArray &uid, qint64 revision, const Sink::ApplicationDomain::BufferAdaptor &newEntity, Sink::Storage::Transaction &transaction) Q_DECL_OVERRIDE
66 { 67 {
@@ -70,7 +71,8 @@ public:
70 } 71 }
71 } 72 }
72 73
73 void modifiedEntity(const QByteArray &key, qint64 revision, const Sink::ApplicationDomain::BufferAdaptor &oldEntity, const Sink::ApplicationDomain::BufferAdaptor &newEntity, Sink::Storage::Transaction &transaction) Q_DECL_OVERRIDE 74 void modifiedEntity(const QByteArray &key, qint64 revision, const Sink::ApplicationDomain::BufferAdaptor &oldEntity, const Sink::ApplicationDomain::BufferAdaptor &newEntity,
75 Sink::Storage::Transaction &transaction) Q_DECL_OVERRIDE
74 { 76 {
75 } 77 }
76 78
@@ -117,7 +119,7 @@ private slots:
117 } 119 }
118 auto appendTime = time.elapsed(); 120 auto appendTime = time.elapsed();
119 121
120 //Wait until all messages have been processed 122 // Wait until all messages have been processed
121 resource.processAllMessages().exec().waitForFinished(); 123 resource.processAllMessages().exec().waitForFinished();
122 124
123 auto allProcessedTime = time.elapsed(); 125 auto allProcessedTime = time.elapsed();
@@ -129,8 +131,8 @@ private slots:
129 HAWD::Dataset::Row row = dataset.row(); 131 HAWD::Dataset::Row row = dataset.row();
130 132
131 row.setValue("rows", num); 133 row.setValue("rows", num);
132 row.setValue("append", (qreal)num/appendTime); 134 row.setValue("append", (qreal)num / appendTime);
133 row.setValue("total", (qreal)num/allProcessedTime); 135 row.setValue("total", (qreal)num / allProcessedTime);
134 dataset.insertRow(row); 136 dataset.insertRow(row);
135 HAWD::Formatter::print(dataset); 137 HAWD::Formatter::print(dataset);
136 } 138 }
@@ -145,7 +147,7 @@ private slots:
145 const QByteArray resourceIdentifier = "org.kde.test.instance1"; 147 const QByteArray resourceIdentifier = "org.kde.test.instance1";
146 auto indexer = QSharedPointer<IndexUpdater>::create(); 148 auto indexer = QSharedPointer<IndexUpdater>::create();
147 149
148 pipeline->setPreprocessors("event", QVector<Sink::Preprocessor*>() << indexer.data()); 150 pipeline->setPreprocessors("event", QVector<Sink::Preprocessor *>() << indexer.data());
149 pipeline->setAdaptorFactory("event", eventFactory); 151 pipeline->setAdaptorFactory("event", eventFactory);
150 152
151 TestResource resource("org.kde.test.instance1", pipeline); 153 TestResource resource("org.kde.test.instance1", pipeline);
@@ -160,7 +162,7 @@ private slots:
160 } 162 }
161 auto appendTime = time.elapsed(); 163 auto appendTime = time.elapsed();
162 164
163 //Wait until all messages have been processed 165 // Wait until all messages have been processed
164 resource.processAllMessages().exec().waitForFinished(); 166 resource.processAllMessages().exec().waitForFinished();
165 167
166 auto allProcessedTime = time.elapsed(); 168 auto allProcessedTime = time.elapsed();
@@ -172,8 +174,8 @@ private slots:
172 HAWD::Dataset::Row row = dataset.row(); 174 HAWD::Dataset::Row row = dataset.row();
173 175
174 row.setValue("rows", num); 176 row.setValue("rows", num);
175 row.setValue("append", (qreal)num/appendTime); 177 row.setValue("append", (qreal)num / appendTime);
176 row.setValue("total", (qreal)num/allProcessedTime); 178 row.setValue("total", (qreal)num / allProcessedTime);
177 dataset.insertRow(row); 179 dataset.insertRow(row);
178 HAWD::Formatter::print(dataset); 180 HAWD::Formatter::print(dataset);
179 } 181 }
@@ -190,7 +192,7 @@ private slots:
190 192
191 static flatbuffers::FlatBufferBuilder fbb; 193 static flatbuffers::FlatBufferBuilder fbb;
192 fbb.Clear(); 194 fbb.Clear();
193 //This is the resource buffer type and not the domain type 195 // This is the resource buffer type and not the domain type
194 auto type = fbb.CreateString("event"); 196 auto type = fbb.CreateString("event");
195 // auto delta = fbb.CreateVector<uint8_t>(entityFbb.GetBufferPointer(), entityFbb.GetSize()); 197 // auto delta = fbb.CreateVector<uint8_t>(entityFbb.GetBufferPointer(), entityFbb.GetSize());
196 auto delta = Sink::EntityBuffer::appendAsVector(fbb, entityFbb.GetBufferPointer(), entityFbb.GetSize()); 198 auto delta = Sink::EntityBuffer::appendAsVector(fbb, entityFbb.GetBufferPointer(), entityFbb.GetSize());