aboutsummaryrefslogtreecommitdiff
path: root/nix/libstore
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-01-11 22:11:16 +0100
committerLudovic Courtès <ludo@gnu.org>2020-01-12 00:19:09 +0100
commitbe0fb348b8f9e535510d37cc6b84bec480ef5fa1 (patch)
treeec609ec3efaf86c46c0c80886451ca122a69e479 /nix/libstore
parent7033c7692ccbbbad8f7b9952015de071a5588e87 (diff)
downloadguix-be0fb348b8f9e535510d37cc6b84bec480ef5fa1.tar
guix-be0fb348b8f9e535510d37cc6b84bec480ef5fa1.tar.gz
daemon: Fix the displayed GC estimated progress.
* nix/libstore/gc.cc (LocalStore::deletePathRecursive): Fix computation of 'fraction'. Take 'bytesInvalidated' into account.
Diffstat (limited to 'nix/libstore')
-rw-r--r--nix/libstore/gc.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/nix/libstore/gc.cc b/nix/libstore/gc.cc
index 5043963fa2..77d7fa2dc7 100644
--- a/nix/libstore/gc.cc
+++ b/nix/libstore/gc.cc
@@ -426,13 +426,14 @@ void LocalStore::deletePathRecursive(GCState & state, const Path & path)
}
if (state.options.maxFreed != ULLONG_MAX) {
- double fraction = state.results.bytesFreed + size
- / state.options.maxFreed;
+ auto freed = state.results.bytesFreed + state.bytesInvalidated;
+ double fraction = ((double) freed) / (double) state.options.maxFreed;
unsigned int percentage = (fraction > 1. ? 1. : fraction) * 100.;
printMsg(lvlInfo, format("[%1%%%] deleting '%2%'") % percentage % path);
} else {
- size_t total = (state.results.bytesFreed + size) / (1024 * 1024);
- printMsg(lvlInfo, format("[%1% MiB] deleting '%2%'") % total % path);
+ auto freed = state.results.bytesFreed + state.bytesInvalidated;
+ freed /= 1024ULL * 1024ULL;
+ printMsg(lvlInfo, format("[%1% MiB] deleting '%2%'") % freed % path);
}
state.results.paths.insert(path);