diff options
Diffstat (limited to 'store/test/storagebenchmark.cpp')
-rw-r--r-- | store/test/storagebenchmark.cpp | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/store/test/storagebenchmark.cpp b/store/test/storagebenchmark.cpp index 3be90e9..d42dea8 100644 --- a/store/test/storagebenchmark.cpp +++ b/store/test/storagebenchmark.cpp | |||
@@ -46,21 +46,16 @@ class StorageBenchmark : public QObject | |||
46 | private: | 46 | private: |
47 | //This should point to a directory on disk and not a ramdisk (since we're measuring performance) | 47 | //This should point to a directory on disk and not a ramdisk (since we're measuring performance) |
48 | QString testDataPath; | 48 | QString testDataPath; |
49 | QString dbPath; | 49 | QString dbName; |
50 | QString filePath; | 50 | QString filePath; |
51 | const int count = 50000; | 51 | const int count = 50000; |
52 | 52 | ||
53 | private Q_SLOTS: | 53 | private Q_SLOTS: |
54 | void initTestCase() | 54 | void initTestCase() |
55 | { | 55 | { |
56 | testDataPath = "./"; | 56 | testDataPath = "./testdb"; |
57 | dbPath = testDataPath + "testdb"; | 57 | dbName = "test"; |
58 | filePath = testDataPath + "buffer.fb"; | 58 | filePath = testDataPath + "buffer.fb"; |
59 | |||
60 | QDir dir(testDataPath); | ||
61 | dir.remove("testdb/data.mdb"); | ||
62 | dir.remove("testdb/lock.mdb"); | ||
63 | dir.remove(filePath); | ||
64 | } | 59 | } |
65 | 60 | ||
66 | void testWriteRead_data() | 61 | void testWriteRead_data() |
@@ -79,7 +74,7 @@ private Q_SLOTS: | |||
79 | 74 | ||
80 | Database *db = 0; | 75 | Database *db = 0; |
81 | if (useDb) { | 76 | if (useDb) { |
82 | db = new Database(dbPath); | 77 | db = new Database(testDataPath, dbName); |
83 | } | 78 | } |
84 | 79 | ||
85 | std::ofstream myfile; | 80 | std::ofstream myfile; |
@@ -118,7 +113,7 @@ private Q_SLOTS: | |||
118 | { | 113 | { |
119 | for (int i = 0; i < count; i++) { | 114 | for (int i = 0; i < count; i++) { |
120 | if (db) { | 115 | if (db) { |
121 | db->read(keyPrefix + std::to_string(i), [](void *ptr, int size){}); | 116 | db->read(keyPrefix + std::to_string(i), [](std::string value){}); |
122 | } | 117 | } |
123 | } | 118 | } |
124 | } | 119 | } |
@@ -149,9 +144,11 @@ private Q_SLOTS: | |||
149 | 144 | ||
150 | void testSizes() | 145 | void testSizes() |
151 | { | 146 | { |
152 | QFileInfo dbInfo(dbPath, "data.mdb"); | 147 | Database db(testDataPath, dbName); |
148 | qDebug() << "Database size [kb]: " << db.diskUsage()/1024; | ||
149 | db.removeFromDisk(); | ||
150 | |||
153 | QFileInfo fileInfo(filePath); | 151 | QFileInfo fileInfo(filePath); |
154 | qDebug() << "Database size [kb]: " << dbInfo.size()/1024; | ||
155 | qDebug() << "File size [kb]: " << fileInfo.size()/1024; | 152 | qDebug() << "File size [kb]: " << fileInfo.size()/1024; |
156 | } | 153 | } |
157 | }; | 154 | }; |