* [PATCH] scripts: gc: Report size in MiBs instead of bytes.
@ 2018-06-22 20:18 Taylan Kammer
2018-06-27 19:48 ` Ludovic Courtès
0 siblings, 1 reply; 3+ messages in thread
From: Taylan Kammer @ 2018-06-22 20:18 UTC (permalink / raw)
To: guix-devel
[-- Attachment #1: Type: text/plain, Size: 118 bytes --]
Thoughts?
I'm quite out of the loop and would appreciate if someone told me where
to best push this if it's OK. :-)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-scripts-gc-Report-size-in-MiBs-instead-of-bytes.patch --]
[-- Type: text/x-patch, Size: 1864 bytes --]
From 4742df4c050fdcfd6caa76baa2c191f5adaa2a30 Mon Sep 17 00:00:00 2001
From: Taylan Kammer <taylanbayirli@gmail.com>
Date: Fri, 22 Jun 2018 21:55:26 +0200
Subject: [PATCH] scripts: gc: Report size in MiBs instead of bytes.
* guix/scripts/gc.scm (guix-gc): Show info in MiBs not bytes.
---
guix/scripts/gc.scm | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/guix/scripts/gc.scm b/guix/scripts/gc.scm
index e4ed7227f..3ec2d76b1 100644
--- a/guix/scripts/gc.scm
+++ b/guix/scripts/gc.scm
@@ -199,10 +199,10 @@ Invoke the garbage collector.\n"))
;; Attempt to have at least SPACE bytes available in STORE.
(let ((free (free-disk-space (%store-prefix))))
(if (> free space)
- (info (G_ "already ~h bytes available on ~a, nothing to do~%")
- free (%store-prefix))
+ (info (G_ "already ~h MiBs available on ~a, nothing to do~%")
+ (/ free 1024 1024) (%store-prefix))
(let ((to-free (- space free)))
- (info (G_ "freeing ~h bytes~%") to-free)
+ (info (G_ "freeing ~h MiBs~%") (/ to-free 1024 1024))
(collect-garbage store to-free)))))
(with-error-handling
@@ -234,10 +234,10 @@ Invoke the garbage collector.\n"))
(ensure-free-space store free-space))
(min-freed
(let-values (((paths freed) (collect-garbage store min-freed)))
- (info (G_ "freed ~h bytes~%") freed)))
+ (info (G_ "freed ~h MiBs~%") (/ freed 1024 1024))))
(else
(let-values (((paths freed) (collect-garbage store)))
- (info (G_ "freed ~h bytes~%") freed))))))
+ (info (G_ "freed ~h MiBs~%") (/ freed 1024 1024)))))))
((delete)
(delete-paths store (map direct-store-path paths)))
((list-references)
--
2.17.1
[-- Attachment #3: Type: text/plain, Size: 8 bytes --]
Taylan
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] scripts: gc: Report size in MiBs instead of bytes.
2018-06-22 20:18 [PATCH] scripts: gc: Report size in MiBs instead of bytes Taylan Kammer
@ 2018-06-27 19:48 ` Ludovic Courtès
2018-06-27 22:32 ` Taylan Kammer
0 siblings, 1 reply; 3+ messages in thread
From: Ludovic Courtès @ 2018-06-27 19:48 UTC (permalink / raw)
To: Taylan Kammer; +Cc: guix-devel
Hello Taylan,
Taylan Kammer <taylanbayirli@gmail.com> skribis:
> I'm quite out of the loop and would appreciate if someone told me where
> to best push this if it's OK. :-)
Heh, good to see you back!
> From 4742df4c050fdcfd6caa76baa2c191f5adaa2a30 Mon Sep 17 00:00:00 2001
> From: Taylan Kammer <taylanbayirli@gmail.com>
> Date: Fri, 22 Jun 2018 21:55:26 +0200
> Subject: [PATCH] scripts: gc: Report size in MiBs instead of bytes.
>
> * guix/scripts/gc.scm (guix-gc): Show info in MiBs not bytes.
[...]
> + (info (G_ "already ~h MiBs available on ~a, nothing to do~%")
> + (/ free 1024 1024) (%store-prefix))
In all divisions, you should write “1024.” to have inexact numbers. It
turns out that currently ~h does that for you, but it’s safer to do it
upfront.
With this change you can push right to master!
In the future we should probably have a ‘number->size’ (the dual of
‘size->number’ in (guix ui)) that would take a byte count and return a
string denoting the size in a human-friendly way (as KiB, MiB, or GiB).
Thanks,
Ludo’.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] scripts: gc: Report size in MiBs instead of bytes.
2018-06-27 19:48 ` Ludovic Courtès
@ 2018-06-27 22:32 ` Taylan Kammer
0 siblings, 0 replies; 3+ messages in thread
From: Taylan Kammer @ 2018-06-27 22:32 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: guix-devel
ludo@gnu.org (Ludovic Courtès) writes:
> Hello Taylan,
>
> Taylan Kammer <taylanbayirli@gmail.com> skribis:
>
>> I'm quite out of the loop and would appreciate if someone told me where
>> to best push this if it's OK. :-)
>
> Heh, good to see you back!
Thank you. I'm afraid I won't be as active as in the past, but I'll try
to drop by occasionally. :-)
>> From 4742df4c050fdcfd6caa76baa2c191f5adaa2a30 Mon Sep 17 00:00:00 2001
>> From: Taylan Kammer <taylanbayirli@gmail.com>
>> Date: Fri, 22 Jun 2018 21:55:26 +0200
>> Subject: [PATCH] scripts: gc: Report size in MiBs instead of bytes.
>>
>> * guix/scripts/gc.scm (guix-gc): Show info in MiBs not bytes.
>
> [...]
>
>> + (info (G_ "already ~h MiBs available on ~a, nothing to do~%")
>> + (/ free 1024 1024) (%store-prefix))
>
> In all divisions, you should write “1024.” to have inexact numbers. It
> turns out that currently ~h does that for you, but it’s safer to do it
> upfront.
>
> With this change you can push right to master!
Done and done.
> In the future we should probably have a ‘number->size’ (the dual of
> ‘size->number’ in (guix ui)) that would take a byte count and return a
> string denoting the size in a human-friendly way (as KiB, MiB, or GiB).
Indeed.
> Thanks,
> Ludo’.
Taylan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-06-27 20:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-22 20:18 [PATCH] scripts: gc: Report size in MiBs instead of bytes Taylan Kammer
2018-06-27 19:48 ` Ludovic Courtès
2018-06-27 22:32 ` Taylan Kammer
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.