summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2017-10-06 13:46:35 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2017-10-06 13:46:35 +0200
commit7cc6c79b9e6ca8c1d786fe2dacb83b27c1c893ae (patch)
treee551a41e37eef0d5c69c434b5e587dc257073430
parent8b24f7f4919c1d4a3a91cf4b21ad76b610dcddf1 (diff)
downloadsink-7cc6c79b9e6ca8c1d786fe2dacb83b27c1c893ae.tar.gz
sink-7cc6c79b9e6ca8c1d786fe2dacb83b27c1c893ae.zip
Improved sinksh stat summary
-rw-r--r--sinksh/syntax_modules/sink_stat.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/sinksh/syntax_modules/sink_stat.cpp b/sinksh/syntax_modules/sink_stat.cpp
index 73b6ac4..3238f4c 100644
--- a/sinksh/syntax_modules/sink_stat.cpp
+++ b/sinksh/syntax_modules/sink_stat.cpp
@@ -38,8 +38,8 @@ namespace SinkStat
38 38
39void statResources(const QStringList &resources, const State &state) 39void statResources(const QStringList &resources, const State &state)
40{ 40{
41 qint64 total = 0;
42 for (const auto &resource : resources) { 41 for (const auto &resource : resources) {
42 qint64 total = 0;
43 Sink::Storage::DataStore storage(Sink::storageLocation(), resource, Sink::Storage::DataStore::ReadOnly); 43 Sink::Storage::DataStore storage(Sink::storageLocation(), resource, Sink::Storage::DataStore::ReadOnly);
44 auto transaction = storage.createTransaction(Sink::Storage::DataStore::ReadOnly); 44 auto transaction = storage.createTransaction(Sink::Storage::DataStore::ReadOnly);
45 45
@@ -51,17 +51,18 @@ void statResources(const QStringList &resources, const State &state)
51 state.printLine(QObject::tr("Size [kb]: %1").arg(size), 1); 51 state.printLine(QObject::tr("Size [kb]: %1").arg(size), 1);
52 total += size; 52 total += size;
53 } 53 }
54 state.printLine(QObject::tr("Resource total in database [kb]: %1").arg(total), 1);
54 int diskUsage = 0; 55 int diskUsage = 0;
55 56
56 QDir dir(Sink::storageLocation()); 57 QDir dir(Sink::storageLocation());
57 for (const auto &folder : dir.entryList(QStringList() << resource + "*")) { 58 for (const auto &folder : dir.entryList(QStringList() << resource + "*")) {
59 state.printLine(QObject::tr("Accumulating %1").arg(folder), 1);
58 diskUsage += Sink::Storage::DataStore(Sink::storageLocation(), folder, Sink::Storage::DataStore::ReadOnly).diskUsage(); 60 diskUsage += Sink::Storage::DataStore(Sink::storageLocation(), folder, Sink::Storage::DataStore::ReadOnly).diskUsage();
59 } 61 }
60 auto size = diskUsage / 1024; 62 auto size = diskUsage / 1024;
61 state.printLine(QObject::tr("Disk usage [kb]: %1").arg(size), 1); 63 state.printLine(QObject::tr("Actual database file sizes [kb]: %1").arg(size), 1);
62 } 64 }
63 65
64 state.printLine(QObject::tr("Total [kb]: %1").arg(total));
65} 66}
66 67
67bool statAllResources(State &state) 68bool statAllResources(State &state)