mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-07 07:26:13 -05:00
daemon: Fix the displayed GC estimated progress.
* nix/libstore/gc.cc (LocalStore::deletePathRecursive): Fix computation of 'fraction'. Take 'bytesInvalidated' into account.
This commit is contained in:
parent
7033c7692c
commit
be0fb348b8
1 changed files with 5 additions and 4 deletions
|
@ -426,13 +426,14 @@ void LocalStore::deletePathRecursive(GCState & state, const Path & path)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.options.maxFreed != ULLONG_MAX) {
|
if (state.options.maxFreed != ULLONG_MAX) {
|
||||||
double fraction = state.results.bytesFreed + size
|
auto freed = state.results.bytesFreed + state.bytesInvalidated;
|
||||||
/ state.options.maxFreed;
|
double fraction = ((double) freed) / (double) state.options.maxFreed;
|
||||||
unsigned int percentage = (fraction > 1. ? 1. : fraction) * 100.;
|
unsigned int percentage = (fraction > 1. ? 1. : fraction) * 100.;
|
||||||
printMsg(lvlInfo, format("[%1%%%] deleting '%2%'") % percentage % path);
|
printMsg(lvlInfo, format("[%1%%%] deleting '%2%'") % percentage % path);
|
||||||
} else {
|
} else {
|
||||||
size_t total = (state.results.bytesFreed + size) / (1024 * 1024);
|
auto freed = state.results.bytesFreed + state.bytesInvalidated;
|
||||||
printMsg(lvlInfo, format("[%1% MiB] deleting '%2%'") % total % path);
|
freed /= 1024ULL * 1024ULL;
|
||||||
|
printMsg(lvlInfo, format("[%1% MiB] deleting '%2%'") % freed % path);
|
||||||
}
|
}
|
||||||
|
|
||||||
state.results.paths.insert(path);
|
state.results.paths.insert(path);
|
||||||
|
|
Loading…
Reference in a new issue