diff options
| author | Efraim Flashner <efraim@flashner.co.il> | 2025-06-29 10:21:12 +0300 |
|---|---|---|
| committer | Efraim Flashner <efraim@flashner.co.il> | 2025-07-28 13:57:53 +0300 |
| commit | cc588d8eb6a5e05bc8c9d41855685a1d8ce70187 (patch) | |
| tree | 8f1091354927a109b82ba558dd7637061479b787 /nix/libstore/gc.cc | |
| parent | cf6868187a68feea41b3cde9bd37670df7192fed (diff) | |
guix gc: Adjust size suffix based on the amount of data.
* guix/ui.scm (number->size): New procedure.
* guix/scripts/gc.scm (guix-gc)[actions]: Display the amount of
collected-garbage using more specific units.
[ensure-free-space]: Display the size using an appropriate size unit.
* nix/libstore/gc.cc (deletePathRecursive, removeUnusedLinks): Same.
* nix/libstore/optimise-store.cc (showBytes): Move function ...
* nix/libstore/misc.cc: ... to here. Expand to adjust the output based
on the amount of bytes received.
Change-Id: Idceb1a13f8e45f959d327f53d1a8accb29d2678b
Diffstat (limited to 'nix/libstore/gc.cc')
| -rw-r--r-- | nix/libstore/gc.cc | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/nix/libstore/gc.cc b/nix/libstore/gc.cc index 1766a684122..08638b51153 100644 --- a/nix/libstore/gc.cc +++ b/nix/libstore/gc.cc | |||
| @@ -433,8 +433,7 @@ void LocalStore::deletePathRecursive(GCState & state, const Path & path) | |||
| 433 | printMsg(lvlInfo, format("[%1%%%] deleting '%2%'") % percentage % path); | 433 | printMsg(lvlInfo, format("[%1%%%] deleting '%2%'") % percentage % path); |
| 434 | } else { | 434 | } else { |
| 435 | auto freed = state.results.bytesFreed + state.bytesInvalidated; | 435 | auto freed = state.results.bytesFreed + state.bytesInvalidated; |
| 436 | freed /= 1024ULL * 1024ULL; | 436 | printMsg(lvlInfo, format("[%1%] deleting '%2%'") % showBytes(freed) % path); |
| 437 | printMsg(lvlInfo, format("[%1% MiB] deleting '%2%'") % freed % path); | ||
| 438 | } | 437 | } |
| 439 | 438 | ||
| 440 | state.results.paths.insert(path); | 439 | state.results.paths.insert(path); |
| @@ -629,9 +628,9 @@ void LocalStore::removeUnusedLinks(const GCState & state) | |||
| 629 | if (stat(linksDir.c_str(), &st) == -1) | 628 | if (stat(linksDir.c_str(), &st) == -1) |
| 630 | throw SysError(format("statting `%1%'") % linksDir); | 629 | throw SysError(format("statting `%1%'") % linksDir); |
| 631 | long long overhead = st.st_size; | 630 | long long overhead = st.st_size; |
| 631 | long long freedbytes = (unsharedSize - actualSize - overhead); | ||
| 632 | 632 | ||
| 633 | printMsg(lvlInfo, format("note: currently hard linking saves %.2f MiB") | 633 | printMsg(lvlInfo, format("note: currently hard linking saves %1%") % showBytes(freedbytes)); |
| 634 | % ((unsharedSize - actualSize - overhead) / (1024.0 * 1024.0))); | ||
| 635 | } | 634 | } |
| 636 | 635 | ||
| 637 | 636 | ||
