diff options
Diffstat (limited to 'tests/databasepopulationandfacadequerybenchmark.cpp')
-rw-r--r-- | tests/databasepopulationandfacadequerybenchmark.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/tests/databasepopulationandfacadequerybenchmark.cpp b/tests/databasepopulationandfacadequerybenchmark.cpp index 5a96bdd..8581c49 100644 --- a/tests/databasepopulationandfacadequerybenchmark.cpp +++ b/tests/databasepopulationandfacadequerybenchmark.cpp | |||
@@ -34,12 +34,12 @@ class DatabasePopulationAndFacadeQueryBenchmark : public QObject | |||
34 | 34 | ||
35 | void populateDatabase(int count) | 35 | void populateDatabase(int count) |
36 | { | 36 | { |
37 | Akonadi2::Storage(Akonadi2::storageLocation(), "identifier", Akonadi2::Storage::ReadWrite).removeFromDisk(); | 37 | Sink::Storage(Sink::storageLocation(), "identifier", Sink::Storage::ReadWrite).removeFromDisk(); |
38 | //Setup | 38 | //Setup |
39 | auto domainTypeAdaptorFactory = QSharedPointer<TestEventAdaptorFactory>::create(); | 39 | auto domainTypeAdaptorFactory = QSharedPointer<TestEventAdaptorFactory>::create(); |
40 | { | 40 | { |
41 | Akonadi2::Storage storage(Akonadi2::storageLocation(), identifier, Akonadi2::Storage::ReadWrite); | 41 | Sink::Storage storage(Sink::storageLocation(), identifier, Sink::Storage::ReadWrite); |
42 | auto transaction = storage.createTransaction(Akonadi2::Storage::ReadWrite); | 42 | auto transaction = storage.createTransaction(Sink::Storage::ReadWrite); |
43 | auto db = transaction.openDatabase("event.main"); | 43 | auto db = transaction.openDatabase("event.main"); |
44 | 44 | ||
45 | int bufferSizeTotal = 0; | 45 | int bufferSizeTotal = 0; |
@@ -47,7 +47,7 @@ class DatabasePopulationAndFacadeQueryBenchmark : public QObject | |||
47 | QByteArray attachment; | 47 | QByteArray attachment; |
48 | attachment.fill('c', 1000); | 48 | attachment.fill('c', 1000); |
49 | for (int i = 0; i < count; i++) { | 49 | for (int i = 0; i < count; i++) { |
50 | auto domainObject = Akonadi2::ApplicationDomain::Event::Ptr::create(); | 50 | auto domainObject = Sink::ApplicationDomain::Event::Ptr::create(); |
51 | domainObject->setProperty("uid", "uid"); | 51 | domainObject->setProperty("uid", "uid"); |
52 | domainObject->setProperty("summary", "summary"); | 52 | domainObject->setProperty("summary", "summary"); |
53 | domainObject->setProperty("attachment", attachment); | 53 | domainObject->setProperty("attachment", attachment); |
@@ -82,7 +82,7 @@ class DatabasePopulationAndFacadeQueryBenchmark : public QObject | |||
82 | { | 82 | { |
83 | const auto startingRss = getCurrentRSS(); | 83 | const auto startingRss = getCurrentRSS(); |
84 | 84 | ||
85 | Akonadi2::Query query; | 85 | Sink::Query query; |
86 | query.liveQuery = false; | 86 | query.liveQuery = false; |
87 | query.requestedProperties << "uid" << "summary"; | 87 | query.requestedProperties << "uid" << "summary"; |
88 | 88 | ||
@@ -90,22 +90,22 @@ class DatabasePopulationAndFacadeQueryBenchmark : public QObject | |||
90 | QTime time; | 90 | QTime time; |
91 | time.start(); | 91 | time.start(); |
92 | 92 | ||
93 | auto resultSet = QSharedPointer<Akonadi2::ResultProvider<Akonadi2::ApplicationDomain::Event::Ptr> >::create(); | 93 | auto resultSet = QSharedPointer<Sink::ResultProvider<Sink::ApplicationDomain::Event::Ptr> >::create(); |
94 | auto resourceAccess = QSharedPointer<TestResourceAccess>::create(); | 94 | auto resourceAccess = QSharedPointer<TestResourceAccess>::create(); |
95 | TestResourceFacade facade(identifier, resourceAccess); | 95 | TestResourceFacade facade(identifier, resourceAccess); |
96 | 96 | ||
97 | auto ret = facade.load(query); | 97 | auto ret = facade.load(query); |
98 | ret.first.exec().waitForFinished(); | 98 | ret.first.exec().waitForFinished(); |
99 | auto emitter = ret.second; | 99 | auto emitter = ret.second; |
100 | QList<Akonadi2::ApplicationDomain::Event::Ptr> list; | 100 | QList<Sink::ApplicationDomain::Event::Ptr> list; |
101 | emitter->onAdded([&list](const Akonadi2::ApplicationDomain::Event::Ptr &event) { | 101 | emitter->onAdded([&list](const Sink::ApplicationDomain::Event::Ptr &event) { |
102 | list << event; | 102 | list << event; |
103 | }); | 103 | }); |
104 | bool done = false; | 104 | bool done = false; |
105 | emitter->onInitialResultSetComplete([&done](const Akonadi2::ApplicationDomain::Event::Ptr &event) { | 105 | emitter->onInitialResultSetComplete([&done](const Sink::ApplicationDomain::Event::Ptr &event) { |
106 | done = true; | 106 | done = true; |
107 | }); | 107 | }); |
108 | emitter->fetch(Akonadi2::ApplicationDomain::Event::Ptr()); | 108 | emitter->fetch(Sink::ApplicationDomain::Event::Ptr()); |
109 | QTRY_VERIFY(done); | 109 | QTRY_VERIFY(done); |
110 | QCOMPARE(list.size(), count); | 110 | QCOMPARE(list.size(), count); |
111 | 111 | ||
@@ -114,7 +114,7 @@ class DatabasePopulationAndFacadeQueryBenchmark : public QObject | |||
114 | const auto finalRss = getCurrentRSS(); | 114 | const auto finalRss = getCurrentRSS(); |
115 | const auto rssGrowth = finalRss - startingRss; | 115 | const auto rssGrowth = finalRss - startingRss; |
116 | //Since the database is memory mapped it is attributted to the resident set size. | 116 | //Since the database is memory mapped it is attributted to the resident set size. |
117 | const auto rssWithoutDb = finalRss - Akonadi2::Storage(Akonadi2::storageLocation(), identifier, Akonadi2::Storage::ReadWrite).diskUsage(); | 117 | const auto rssWithoutDb = finalRss - Sink::Storage(Sink::storageLocation(), identifier, Sink::Storage::ReadWrite).diskUsage(); |
118 | const auto peakRss = getPeakRSS(); | 118 | const auto peakRss = getPeakRSS(); |
119 | //How much peak deviates from final rss in percent (should be around 0) | 119 | //How much peak deviates from final rss in percent (should be around 0) |
120 | const auto percentageRssError = static_cast<double>(peakRss - finalRss)*100.0/static_cast<double>(finalRss); | 120 | const auto percentageRssError = static_cast<double>(peakRss - finalRss)*100.0/static_cast<double>(finalRss); |