diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-01-30 22:33:23 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-01-30 22:40:20 +0100 |
commit | 7a822b0f1d7af17c207cdfc8ccbe255bcd0b1b89 (patch) | |
tree | 599115c9a1635d416b084801f50a4adbf8c169b8 /sinksh | |
parent | 16d003d939feaed90b3533d0b974f02b9c706233 (diff) | |
download | sink-7a822b0f1d7af17c207cdfc8ccbe255bcd0b1b89.tar.gz sink-7a822b0f1d7af17c207cdfc8ccbe255bcd0b1b89.zip |
Improved sinksh stat output
Diffstat (limited to 'sinksh')
-rw-r--r-- | sinksh/syntax_modules/sink_stat.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sinksh/syntax_modules/sink_stat.cpp b/sinksh/syntax_modules/sink_stat.cpp index f263bbc..7cc78cd 100644 --- a/sinksh/syntax_modules/sink_stat.cpp +++ b/sinksh/syntax_modules/sink_stat.cpp | |||
@@ -38,6 +38,7 @@ namespace SinkStat | |||
38 | 38 | ||
39 | void statResource(const QString &resource, const State &state) | 39 | void statResource(const QString &resource, const State &state) |
40 | { | 40 | { |
41 | state.printLine("Resource " + resource + ":"); | ||
41 | qint64 total = 0; | 42 | qint64 total = 0; |
42 | Sink::Storage::DataStore storage(Sink::storageLocation(), resource, Sink::Storage::DataStore::ReadOnly); | 43 | Sink::Storage::DataStore storage(Sink::storageLocation(), resource, Sink::Storage::DataStore::ReadOnly); |
43 | auto transaction = storage.createTransaction(Sink::Storage::DataStore::ReadOnly); | 44 | auto transaction = storage.createTransaction(Sink::Storage::DataStore::ReadOnly); |
@@ -51,14 +52,18 @@ void statResource(const QString &resource, const State &state) | |||
51 | } | 52 | } |
52 | state.printLine(); | 53 | state.printLine(); |
53 | state.printLine(QObject::tr("Calculated named database sizes total of main database: %1 [kb]").arg(total), 1); | 54 | state.printLine(QObject::tr("Calculated named database sizes total of main database: %1 [kb]").arg(total), 1); |
55 | |||
56 | auto stat = transaction.stat(false); | ||
57 | state.printLine(QObject::tr("Total calculated free size [kb]: %1").arg(stat.freePages * stat.pageSize / 1024), 1); | ||
54 | state.printLine(QObject::tr("Write amplification of main database: %1").arg(float(storage.diskUsage() / 1024)/float(total)), 1); | 58 | state.printLine(QObject::tr("Write amplification of main database: %1").arg(float(storage.diskUsage() / 1024)/float(total)), 1); |
55 | int diskUsage = 0; | 59 | int diskUsage = 0; |
56 | 60 | ||
61 | state.printLine(); | ||
57 | QDir dir(Sink::storageLocation()); | 62 | QDir dir(Sink::storageLocation()); |
58 | for (const auto &folder : dir.entryList(QStringList() << resource + "*")) { | 63 | for (const auto &folder : dir.entryList(QStringList() << resource + "*")) { |
59 | auto size = Sink::Storage::DataStore(Sink::storageLocation(), folder, Sink::Storage::DataStore::ReadOnly).diskUsage(); | 64 | auto size = Sink::Storage::DataStore(Sink::storageLocation(), folder, Sink::Storage::DataStore::ReadOnly).diskUsage(); |
60 | diskUsage += size; | 65 | diskUsage += size; |
61 | state.printLine(QObject::tr("...Accumulating %1: %2 [kb]").arg(folder).arg(size / 1024), 1); | 66 | state.printLine(QObject::tr("... accumulating %1: %2 [kb]").arg(folder).arg(size / 1024), 1); |
62 | } | 67 | } |
63 | auto size = diskUsage / 1024; | 68 | auto size = diskUsage / 1024; |
64 | state.printLine(QObject::tr("Actual database file sizes total: %1 [kb]").arg(size), 1); | 69 | state.printLine(QObject::tr("Actual database file sizes total: %1 [kb]").arg(size), 1); |