GNU bug report logs - #26942
[PATCH] Add Add elapsed time to manual-database hook to output message (was: Performance of the man page database generation)

Previous Next

Package: guix-patches;

Reported by: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Date: Mon, 15 May 2017 16:25:01 UTC

Severity: normal

Tags: patch

Done: Ricardo Wurmus <rekado <at> elephly.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 26942 in the body.
You can then email your comments to 26942 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#26942; Package guix-patches. (Mon, 15 May 2017 16:25:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Maxim Cournoyer <maxim.cournoyer <at> gmail.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Mon, 15 May 2017 16:25:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: guix-patches <at> gnu.org
Cc: Ludovic Courtès <ludo <at> gnu.org>, myglc2 <myglc2 <at> gmail.com>
Subject: [PATCH] Add Add elapsed time to manual-database hook to output
 message (was: Performance of the man page database generation)
Date: Mon, 15 May 2017 09:23:55 -0700
[Message part 1 (text/plain, inline)]
Hi myglc2,

I'm sending a patch which implements the following:

--8<---------------cut here---------------start------------->8---
guix build --check /gnu/store/yx1hdcvyc3agv7bwbxm7jv7zlm6ibzqr-manual-database.drv
[...]
Creating manual page database for 62 packages... done in 35.112 s
--8<---------------cut here---------------end--------------->8---

The change improves the message output by the manual-database hook with
the addition is the closing of the message with a "done in x.xxx s".

Thanks to myglc2 for providing a snippet and ideas about how to improve this.

Maxim

[0001-profiles-Add-elapsed-time-to-manual-database-hook-to.patch (text/x-patch, attachment)]
[Message part 3 (text/plain, inline)]
--
For reference, the last bit of conversation which occured on
guix-devel regarding this was:

myglc2 <myglc2 <at> gmail.com> writes:

[...]

> Hi Maxim and Ludo’,
>
> I hacked profiles.scm (please see git diff below) so that start and end
> seconds appear in the message like this:
>
> creating manual page database for 23 packages...1494773268...1494773275 DONE
>
> I tested a few cases and man-db typically takes only a few seconds.  It
> only _appears_ to take a long time because other processing occurs after
> the man-db command.
>
> So, I suggest either ...
>
> 1) delete the message altogether, or
> 2) close the message with a "DONE"
>
> SORRY for the run-around. In my defense, when I first raised the
> question I did suggest the idea of closing the message:
>

No need to be sorry; improvements/ideas are always welcome! :)

> http://lists.gnu.org/archive/html/guix-devel/2017-04/msg00196.html
>
> HTH, George
>
> g1 <at> g1 ~/src/guix [env]$ git diff
> diff --git a/guix/profiles.scm b/guix/profiles.scm
> index eb172ef45..4dbf44a81 100644
> --- a/guix/profiles.scm
> +++ b/guix/profiles.scm
> @@ -1011,13 +1011,15 @@ the entries in MANIFEST."
>          (mkdir-p man-directory)
>          (setenv "MANPATH" (string-join entries ":"))
>  
> -        (format #t "creating manual page database for ~a packages...~%"
> -                (length entries))
> +        (format #t "creating manual page database for ~a packages...~a"
> +                (length entries)(current-time))
>          (force-output)
>  
>          (zero? (system* #+(file-append man-db "/bin/mandb")
>                          "--quiet" "--create"
> -                        "-C" "man_db.conf"))))
> +                        "-C" "man_db.conf"))
> +        (format #t "...~a DONE~%" (current-time))
> +        (force-output)))
>  
>    (gexp->derivation "manual-database" build
>                      #:modules '((guix build utils)
> g1 <at> g1 ~/src/guix [env]$ 

I'd suggest leaving closing the message on the same line, maybe with
something like:


--8<---------------cut here---------------end--------------->8---
diff --git a/guix/profiles.scm b/guix/profiles.scm
index eb172ef450..6733f105e3 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -957,6 +957,7 @@ the entries in MANIFEST."
     #~(begin
         (use-modules (guix build utils)
                      (srfi srfi-1)
+                     (srfi srfi-19)
                      (srfi srfi-26))
 
         (define entries
@@ -1011,16 +1012,23 @@ the entries in MANIFEST."
         (mkdir-p man-directory)
         (setenv "MANPATH" (string-join entries ":"))
 
-        (format #t "creating manual page database for ~a packages...~%"
+        (format #t "Creating manual page database for ~a packages... "
                 (length entries))
         (force-output)
-
-        (zero? (system* #+(file-append man-db "/bin/mandb")
-                        "--quiet" "--create"
-                        "-C" "man_db.conf"))))
+        (let* ((start-time (current-time))
+               (exit-status (system* #+(file-append man-db "/bin/mandb")
+                                    "--quiet" "--create"
+                                    "-C" "man_db.conf"))
+               (duration (time-difference (current-time) start-time)))
+          (format #t "done in ~,3f s~%"
+                  (+ (time-second duration)
+                     (* (time-nanosecond duration) (expt 10 -9))))
+          (force-output)
+          (zero? exit-status))))
 
   (gexp->derivation "manual-database" build
                     #:modules '((guix build utils)
+                                (srfi srfi-19)
                                 (srfi srfi-26))
                     #:local-build? #t))
--8<---------------cut here---------------end--------------->8---

Information forwarded to guix-patches <at> gnu.org:
bug#26942; Package guix-patches. (Tue, 16 May 2017 21:13:02 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Cc: myglc2 <myglc2 <at> gmail.com>, guix-patches <at> gnu.org
Subject: Re: [PATCH] Add Add elapsed time to manual-database hook to output
 message
Date: Tue, 16 May 2017 23:12:01 +0200
Maxim Cournoyer <maxim.cournoyer <at> gmail.com> skribis:

> From 3ec52305f6a1836b42e34b4dc194c16afb1592a2 Mon Sep 17 00:00:00 2001
> From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
> Date: Mon, 15 May 2017 09:05:48 -0700
> Subject: [PATCH] profiles: Add elapsed time to manual-database hook to output
>  message.
>
> * guix/profiles.scm (manual-database): Add elapsed time to manual-database
> hook to output message.

Applied, thanks!

Ludo’.




Reply sent to Ricardo Wurmus <rekado <at> elephly.net>:
You have taken responsibility. (Tue, 30 May 2017 21:30:02 GMT) Full text and rfc822 format available.

Notification sent to Maxim Cournoyer <maxim.cournoyer <at> gmail.com>:
bug acknowledged by developer. (Tue, 30 May 2017 21:30:03 GMT) Full text and rfc822 format available.

Message #13 received at 26942-done <at> debbugs.gnu.org (full text, mbox):

From: Ricardo Wurmus <rekado <at> elephly.net>
To: 26942-done <at> debbugs.gnu.org
Subject: Re: bug#26942: [PATCH] Add Add elapsed time to manual-database hook
 to output message
Date: Tue, 30 May 2017 23:29:42 +0200
Ludovic Courtès <ludo <at> gnu.org> writes:

> Maxim Cournoyer <maxim.cournoyer <at> gmail.com> skribis:
>
>> From 3ec52305f6a1836b42e34b4dc194c16afb1592a2 Mon Sep 17 00:00:00 2001
>> From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
>> Date: Mon, 15 May 2017 09:05:48 -0700
>> Subject: [PATCH] profiles: Add elapsed time to manual-database hook to output
>>  message.
>>
>> * guix/profiles.scm (manual-database): Add elapsed time to manual-database
>> hook to output message.
>
> Applied, thanks!

Closing.





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 28 Jun 2017 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 302 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.