summaryrefslogtreecommitdiffstats
path: root/tests/dummyresourcewritebenchmark.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/dummyresourcewritebenchmark.cpp')
-rw-r--r--tests/dummyresourcewritebenchmark.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/tests/dummyresourcewritebenchmark.cpp b/tests/dummyresourcewritebenchmark.cpp
index 539d189..b4ab438 100644
--- a/tests/dummyresourcewritebenchmark.cpp
+++ b/tests/dummyresourcewritebenchmark.cpp
@@ -123,39 +123,39 @@ class DummyResourceWriteBenchmark : public QObject
123 Q_UNUSED(appendTime); 123 Q_UNUSED(appendTime);
124 auto bufferSizeTotal = bufferSize * num; 124 auto bufferSizeTotal = bufferSize * num;
125 125
126 //Wait until all messages have been processed 126 // Wait until all messages have been processed
127 resource.processAllMessages().exec().waitForFinished(); 127 resource.processAllMessages().exec().waitForFinished();
128 128
129 auto allProcessedTime = time.elapsed(); 129 auto allProcessedTime = time.elapsed();
130 130
131 const auto finalRss = getCurrentRSS(); 131 const auto finalRss = getCurrentRSS();
132 const auto rssGrowth = finalRss - startingRss; 132 const auto rssGrowth = finalRss - startingRss;
133 //Since the database is memory mapped it is attributted to the resident set size. 133 // Since the database is memory mapped it is attributted to the resident set size.
134 const auto rssWithoutDb = finalRss - DummyResource::diskUsage("org.kde.dummy.instance1"); 134 const auto rssWithoutDb = finalRss - DummyResource::diskUsage("org.kde.dummy.instance1");
135 const auto peakRss = getPeakRSS(); 135 const auto peakRss = getPeakRSS();
136 //How much peak deviates from final rss in percent 136 // How much peak deviates from final rss in percent
137 const auto percentageRssError = static_cast<double>(peakRss - finalRss)*100.0/static_cast<double>(finalRss); 137 const auto percentageRssError = static_cast<double>(peakRss - finalRss) * 100.0 / static_cast<double>(finalRss);
138 auto rssGrowthPerEntity = rssGrowth/num; 138 auto rssGrowthPerEntity = rssGrowth / num;
139 std::cout << "Current Rss usage [kb]: " << finalRss/1024 << std::endl; 139 std::cout << "Current Rss usage [kb]: " << finalRss / 1024 << std::endl;
140 std::cout << "Peak Rss usage [kb]: " << peakRss/1024 << std::endl; 140 std::cout << "Peak Rss usage [kb]: " << peakRss / 1024 << std::endl;
141 std::cout << "Rss growth [kb]: " << rssGrowth/1024 << std::endl; 141 std::cout << "Rss growth [kb]: " << rssGrowth / 1024 << std::endl;
142 std::cout << "Rss growth per entity [byte]: " << rssGrowthPerEntity << std::endl; 142 std::cout << "Rss growth per entity [byte]: " << rssGrowthPerEntity << std::endl;
143 std::cout << "Rss without db [kb]: " << rssWithoutDb/1024 << std::endl; 143 std::cout << "Rss without db [kb]: " << rssWithoutDb / 1024 << std::endl;
144 std::cout << "Percentage peak rss error: " << percentageRssError << std::endl; 144 std::cout << "Percentage peak rss error: " << percentageRssError << std::endl;
145 145
146 auto onDisk = DummyResource::diskUsage("org.kde.dummy.instance1"); 146 auto onDisk = DummyResource::diskUsage("org.kde.dummy.instance1");
147 auto writeAmplification = static_cast<double>(onDisk) / static_cast<double>(bufferSizeTotal); 147 auto writeAmplification = static_cast<double>(onDisk) / static_cast<double>(bufferSizeTotal);
148 std::cout << "On disk [kb]: " << onDisk/1024 << std::endl; 148 std::cout << "On disk [kb]: " << onDisk / 1024 << std::endl;
149 std::cout << "Buffer size total [kb]: " << bufferSizeTotal/1024 << std::endl; 149 std::cout << "Buffer size total [kb]: " << bufferSizeTotal / 1024 << std::endl;
150 std::cout << "Write amplification: " << writeAmplification << std::endl; 150 std::cout << "Write amplification: " << writeAmplification << std::endl;
151 151
152 152
153 mTimePerEntity << static_cast<double>(allProcessedTime)/static_cast<double>(num); 153 mTimePerEntity << static_cast<double>(allProcessedTime) / static_cast<double>(num);
154 mRssGrowthPerEntity << rssGrowthPerEntity; 154 mRssGrowthPerEntity << rssGrowthPerEntity;
155 155
156 QVERIFY(percentageRssError < 10); 156 QVERIFY(percentageRssError < 10);
157 //TODO This is much more than it should it seems, although adding the attachment results in pretty exactly a 1k increase, 157 // TODO This is much more than it should it seems, although adding the attachment results in pretty exactly a 1k increase,
158 //so it doesn't look like that memory is being duplicated. 158 // so it doesn't look like that memory is being duplicated.
159 QVERIFY(rssGrowthPerEntity < 2500); 159 QVERIFY(rssGrowthPerEntity < 2500);
160 160
161 // HAWD::Dataset dataset("dummy_write_in_process", m_hawdState); 161 // HAWD::Dataset dataset("dummy_write_in_process", m_hawdState);
@@ -219,7 +219,7 @@ private slots:
219 std::system(QString("mdb_stat %1/%2 -ff").arg(Sink::storageLocation()).arg("org.kde.dummy.instance1").toLatin1().constData()); 219 std::system(QString("mdb_stat %1/%2 -ff").arg(Sink::storageLocation()).arg("org.kde.dummy.instance1").toLatin1().constData());
220 } 220 }
221 221
222 //This allows to run individual parts without doing a cleanup, but still cleaning up normally 222 // This allows to run individual parts without doing a cleanup, but still cleaning up normally
223 void testCleanupForCompleteTest() 223 void testCleanupForCompleteTest()
224 { 224 {
225 DummyResource::removeFromDisk("org.kde.dummy.instance1"); 225 DummyResource::removeFromDisk("org.kde.dummy.instance1");