summaryrefslogtreecommitdiffstats
path: root/tests/pipelinebenchmark.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-03-03 09:01:05 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-03-03 09:01:05 +0100
commit4d9746c828558c9f872e0aed52442863affb25d5 (patch)
tree507d7c2ba67f47d3cbbcf01a722236ff1b48426b /tests/pipelinebenchmark.cpp
parent9cea920b7dd51867a0be0fed2f461b6be73c103e (diff)
downloadsink-4d9746c828558c9f872e0aed52442863affb25d5.tar.gz
sink-4d9746c828558c9f872e0aed52442863affb25d5.zip
Fromatted the whole codebase with clang-format.
clang-format -i */**{.cpp,.h}
Diffstat (limited to 'tests/pipelinebenchmark.cpp')
-rw-r--r--tests/pipelinebenchmark.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/tests/pipelinebenchmark.cpp b/tests/pipelinebenchmark.cpp
index 5743830..0133a6c 100644
--- a/tests/pipelinebenchmark.cpp
+++ b/tests/pipelinebenchmark.cpp
@@ -54,7 +54,8 @@
54// } 54// }
55// } 55// }
56// 56//
57// void modifiedEntity(const QByteArray &key, qint64 revision, const Sink::ApplicationDomain::BufferAdaptor &oldEntity, const Sink::ApplicationDomain::BufferAdaptor &newEntity, Sink::Storage::Transaction &transaction) Q_DECL_OVERRIDE 57// void modifiedEntity(const QByteArray &key, qint64 revision, const Sink::ApplicationDomain::BufferAdaptor &oldEntity, const Sink::ApplicationDomain::BufferAdaptor &newEntity,
58// Sink::Storage::Transaction &transaction) Q_DECL_OVERRIDE
58// { 59// {
59// } 60// }
60// 61//
@@ -66,7 +67,7 @@
66 67
67/** 68/**
68 * Benchmark pipeline processing speed. 69 * Benchmark pipeline processing speed.
69 * 70 *
70 * This benchmark especially highlights: 71 * This benchmark especially highlights:
71 * * Cost of an index in speed and size 72 * * Cost of an index in speed and size
72 */ 73 */
@@ -77,7 +78,7 @@ class PipelineBenchmark : public QObject
77 QByteArray resourceIdentifier; 78 QByteArray resourceIdentifier;
78 HAWD::State mHawdState; 79 HAWD::State mHawdState;
79 80
80 void populateDatabase(int count, const QVector<Sink::Preprocessor*> &preprocessors) 81 void populateDatabase(int count, const QVector<Sink::Preprocessor *> &preprocessors)
81 { 82 {
82 TestResource::removeFromDisk(resourceIdentifier); 83 TestResource::removeFromDisk(resourceIdentifier);
83 84
@@ -112,18 +113,17 @@ class PipelineBenchmark : public QObject
112 // Print memory layout, RSS is what is in memory 113 // Print memory layout, RSS is what is in memory
113 // std::system("exec pmap -x \"$PPID\""); 114 // std::system("exec pmap -x \"$PPID\"");
114 // 115 //
115 std::cout << "Size: " << Sink::Storage(Sink::storageLocation(), resourceIdentifier, Sink::Storage::ReadOnly).diskUsage()/1024 << " [kb]" << std::endl; 116 std::cout << "Size: " << Sink::Storage(Sink::storageLocation(), resourceIdentifier, Sink::Storage::ReadOnly).diskUsage() / 1024 << " [kb]" << std::endl;
116 std::cout << "Time: " << allProcessedTime << " [ms]" << std::endl; 117 std::cout << "Time: " << allProcessedTime << " [ms]" << std::endl;
117 118
118 HAWD::Dataset dataset("pipeline", mHawdState); 119 HAWD::Dataset dataset("pipeline", mHawdState);
119 HAWD::Dataset::Row row = dataset.row(); 120 HAWD::Dataset::Row row = dataset.row();
120 121
121 row.setValue("rows", count); 122 row.setValue("rows", count);
122 row.setValue("append", (qreal)count/appendTime); 123 row.setValue("append", (qreal)count / appendTime);
123 row.setValue("total", (qreal)count/allProcessedTime); 124 row.setValue("total", (qreal)count / allProcessedTime);
124 dataset.insertRow(row); 125 dataset.insertRow(row);
125 HAWD::Formatter::print(dataset); 126 HAWD::Formatter::print(dataset);
126
127 } 127 }
128 128
129private slots: 129private slots:
@@ -136,15 +136,14 @@ private slots:
136 136
137 void testWithoutIndex() 137 void testWithoutIndex()
138 { 138 {
139 populateDatabase(10000, QVector<Sink::Preprocessor*>()); 139 populateDatabase(10000, QVector<Sink::Preprocessor *>());
140 } 140 }
141 141
142 void testWithIndex() 142 void testWithIndex()
143 { 143 {
144 auto indexer = QSharedPointer<DefaultIndexUpdater<Sink::ApplicationDomain::Mail> >::create(); 144 auto indexer = QSharedPointer<DefaultIndexUpdater<Sink::ApplicationDomain::Mail>>::create();
145 populateDatabase(10000, QVector<Sink::Preprocessor*>() << indexer.data()); 145 populateDatabase(10000, QVector<Sink::Preprocessor *>() << indexer.data());
146 } 146 }
147
148}; 147};
149 148
150QTEST_MAIN(PipelineBenchmark) 149QTEST_MAIN(PipelineBenchmark)