diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-01-20 19:07:07 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-01-20 19:07:07 +0100 |
commit | bdb01c2c068df326f5a8328ed1492ab1bea388c5 (patch) | |
tree | 25c2ee1b29bc481b6914c244ed9ca194b1415d16 /tests/storagebenchmark.cpp | |
parent | 17e7ee40c9185c0505883853345fd6024c675b1a (diff) | |
download | sink-bdb01c2c068df326f5a8328ed1492ab1bea388c5.tar.gz sink-bdb01c2c068df326f5a8328ed1492ab1bea388c5.zip |
Renamed Akonadi2 to Sink
(except for documentation).
Diffstat (limited to 'tests/storagebenchmark.cpp')
-rw-r--r-- | tests/storagebenchmark.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/tests/storagebenchmark.cpp b/tests/storagebenchmark.cpp index 3e7b609..eada4ee 100644 --- a/tests/storagebenchmark.cpp +++ b/tests/storagebenchmark.cpp | |||
@@ -54,7 +54,7 @@ private: | |||
54 | private Q_SLOTS: | 54 | private Q_SLOTS: |
55 | void initTestCase() | 55 | void initTestCase() |
56 | { | 56 | { |
57 | Akonadi2::Log::setDebugOutputLevel(Akonadi2::Log::Warning); | 57 | Sink::Log::setDebugOutputLevel(Sink::Log::Warning); |
58 | testDataPath = "./testdb"; | 58 | testDataPath = "./testdb"; |
59 | dbName = "test"; | 59 | dbName = "test"; |
60 | filePath = testDataPath + "buffer.fb"; | 60 | filePath = testDataPath + "buffer.fb"; |
@@ -62,7 +62,7 @@ private Q_SLOTS: | |||
62 | 62 | ||
63 | void cleanupTestCase() | 63 | void cleanupTestCase() |
64 | { | 64 | { |
65 | Akonadi2::Storage store(testDataPath, dbName); | 65 | Sink::Storage store(testDataPath, dbName); |
66 | store.removeFromDisk(); | 66 | store.removeFromDisk(); |
67 | } | 67 | } |
68 | 68 | ||
@@ -70,7 +70,7 @@ private Q_SLOTS: | |||
70 | { | 70 | { |
71 | auto event = createEvent(); | 71 | auto event = createEvent(); |
72 | 72 | ||
73 | QScopedPointer<Akonadi2::Storage> store(new Akonadi2::Storage(testDataPath, dbName, Akonadi2::Storage::ReadWrite)); | 73 | QScopedPointer<Sink::Storage> store(new Sink::Storage(testDataPath, dbName, Sink::Storage::ReadWrite)); |
74 | 74 | ||
75 | const char *keyPrefix = "key"; | 75 | const char *keyPrefix = "key"; |
76 | 76 | ||
@@ -78,12 +78,12 @@ private Q_SLOTS: | |||
78 | time.start(); | 78 | time.start(); |
79 | //Test db write time | 79 | //Test db write time |
80 | { | 80 | { |
81 | auto transaction = store->createTransaction(Akonadi2::Storage::ReadWrite); | 81 | auto transaction = store->createTransaction(Sink::Storage::ReadWrite); |
82 | for (int i = 0; i < count; i++) { | 82 | for (int i = 0; i < count; i++) { |
83 | transaction.openDatabase().write(keyPrefix + QByteArray::number(i), event); | 83 | transaction.openDatabase().write(keyPrefix + QByteArray::number(i), event); |
84 | if ((i % 10000) == 0) { | 84 | if ((i % 10000) == 0) { |
85 | transaction.commit(); | 85 | transaction.commit(); |
86 | transaction = store->createTransaction(Akonadi2::Storage::ReadWrite); | 86 | transaction = store->createTransaction(Sink::Storage::ReadWrite); |
87 | } | 87 | } |
88 | } | 88 | } |
89 | transaction.commit(); | 89 | transaction.commit(); |
@@ -105,7 +105,7 @@ private Q_SLOTS: | |||
105 | 105 | ||
106 | //Db read time | 106 | //Db read time |
107 | { | 107 | { |
108 | auto transaction = store->createTransaction(Akonadi2::Storage::ReadOnly); | 108 | auto transaction = store->createTransaction(Sink::Storage::ReadOnly); |
109 | auto db = transaction.openDatabase(); | 109 | auto db = transaction.openDatabase(); |
110 | for (int i = 0; i < count; i++) { | 110 | for (int i = 0; i < count; i++) { |
111 | db.scan(keyPrefix + QByteArray::number(i), [](const QByteArray &key, const QByteArray &value) -> bool { return true; }); | 111 | db.scan(keyPrefix + QByteArray::number(i), [](const QByteArray &key, const QByteArray &value) -> bool { return true; }); |
@@ -126,7 +126,7 @@ private Q_SLOTS: | |||
126 | 126 | ||
127 | void testSizes() | 127 | void testSizes() |
128 | { | 128 | { |
129 | Akonadi2::Storage store(testDataPath, dbName); | 129 | Sink::Storage store(testDataPath, dbName); |
130 | qDebug() << "Database size [kb]: " << store.diskUsage()/1024; | 130 | qDebug() << "Database size [kb]: " << store.diskUsage()/1024; |
131 | 131 | ||
132 | QFileInfo fileInfo(filePath); | 132 | QFileInfo fileInfo(filePath); |
@@ -135,11 +135,11 @@ private Q_SLOTS: | |||
135 | 135 | ||
136 | void testScan() | 136 | void testScan() |
137 | { | 137 | { |
138 | QScopedPointer<Akonadi2::Storage> store(new Akonadi2::Storage(testDataPath, dbName, Akonadi2::Storage::ReadOnly)); | 138 | QScopedPointer<Sink::Storage> store(new Sink::Storage(testDataPath, dbName, Sink::Storage::ReadOnly)); |
139 | 139 | ||
140 | QBENCHMARK { | 140 | QBENCHMARK { |
141 | int hit = 0; | 141 | int hit = 0; |
142 | store->createTransaction(Akonadi2::Storage::ReadOnly).openDatabase().scan("", [&](const QByteArray &key, const QByteArray &value) -> bool { | 142 | store->createTransaction(Sink::Storage::ReadOnly).openDatabase().scan("", [&](const QByteArray &key, const QByteArray &value) -> bool { |
143 | if (key == "key10000") { | 143 | if (key == "key10000") { |
144 | //qDebug() << "hit"; | 144 | //qDebug() << "hit"; |
145 | hit++; | 145 | hit++; |
@@ -152,11 +152,11 @@ private Q_SLOTS: | |||
152 | 152 | ||
153 | void testKeyLookup() | 153 | void testKeyLookup() |
154 | { | 154 | { |
155 | QScopedPointer<Akonadi2::Storage> store(new Akonadi2::Storage(testDataPath, dbName, Akonadi2::Storage::ReadOnly)); | 155 | QScopedPointer<Sink::Storage> store(new Sink::Storage(testDataPath, dbName, Sink::Storage::ReadOnly)); |
156 | 156 | ||
157 | QBENCHMARK { | 157 | QBENCHMARK { |
158 | int hit = 0; | 158 | int hit = 0; |
159 | store->createTransaction(Akonadi2::Storage::ReadOnly).openDatabase().scan("key40000", [&](const QByteArray &key, const QByteArray &value) -> bool { | 159 | store->createTransaction(Sink::Storage::ReadOnly).openDatabase().scan("key40000", [&](const QByteArray &key, const QByteArray &value) -> bool { |
160 | hit++; | 160 | hit++; |
161 | return true; | 161 | return true; |
162 | }); | 162 | }); |