mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 21:38:07 -05:00
daemon: GC displays how much it has collected.
* nix/libstore/gc.cc (LocalStore::deletePathRecursive): Display the percentage reached relative to 'maxFreed', or the total amount of data deleted when 'maxFreed' is ULLONG_MAX.
This commit is contained in:
parent
4f5234be03
commit
732c96f182
1 changed files with 10 additions and 1 deletions
|
@ -11,6 +11,7 @@
|
|||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <climits>
|
||||
|
||||
|
||||
namespace nix {
|
||||
|
@ -417,7 +418,15 @@ void LocalStore::deletePathRecursive(GCState & state, const Path & path)
|
|||
throw SysError(format("getting status of %1%") % path);
|
||||
}
|
||||
|
||||
printMsg(lvlInfo, format("deleting `%1%'") % path);
|
||||
if (state.options.maxFreed != ULLONG_MAX) {
|
||||
double fraction = state.results.bytesFreed + size
|
||||
/ 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);
|
||||
}
|
||||
|
||||
state.results.paths.insert(path);
|
||||
|
||||
|
|
Loading…
Reference in a new issue