diff options
Diffstat (limited to 'sinksh/syntax_modules/sink_stat.cpp')
-rw-r--r-- | sinksh/syntax_modules/sink_stat.cpp | 7 |
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 | ||
39 | void statResources(const QStringList &resources, const State &state) | 39 | void 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 | ||
67 | bool statAllResources(State &state) | 68 | bool statAllResources(State &state) |