all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Christopher Baines <mail@cbaines.net>
To: 47158@debbugs.gnu.org
Subject: [bug#47158] [PATCH 2/2] scripts: weather: Provide more representative request statistics.
Date: Mon, 15 Mar 2021 15:12:57 +0000	[thread overview]
Message-ID: <20210315151257.17384-2-mail@cbaines.net> (raw)
In-Reply-To: <20210315151257.17384-1-mail@cbaines.net>

Previously, the "seconds per request" and "requests per second" statistics
really reported (cache lookups + requests) per second.  By looking at the
actual number of requests made within lookup-narinfos, a more representative
value can be reported.

* guix/scripts/weather.scm (let/time): Allow for multiple return values.
(report-server-coverage): Alter the reporting of request statistics.
---
 guix/scripts/weather.scm | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/guix/scripts/weather.scm b/guix/scripts/weather.scm
index 26ec543211..349052459c 100644
--- a/guix/scripts/weather.scm
+++ b/guix/scripts/weather.scm
@@ -117,8 +117,8 @@ values."
          (end    (current-time time-monotonic)))
     (apply kont (time-difference end start) result)))
 
-(define-syntax-rule (let/time ((time result exp)) body ...)
-  (call-with-time (lambda () exp) (lambda (time result) body ...)))
+(define-syntax-rule (let/time ((time result ... exp)) body ...)
+  (call-with-time (lambda () exp) (lambda (time result ...) body ...)))
 
 (define (histogram field proc seed lst)
   "Return an alist giving a histogram of all the values of FIELD for elements
@@ -181,11 +181,12 @@ Return the coverage ratio, an exact number between 0 and 1."
   (format #t (G_ "looking for ~h store items on ~a...~%")
           (length items) server)
 
-  (let/time ((time narinfos (lookup-narinfos
-                             server items
-                             #:make-progress-reporter
-                             (lambda* (total #:key url #:allow-other-keys)
-                               (progress-reporter/bar total)))))
+  (let/time ((time narinfos requests-made
+                   (lookup-narinfos
+                    server items
+                    #:make-progress-reporter
+                    (lambda* (total #:key url #:allow-other-keys)
+                      (progress-reporter/bar total)))))
     (format #t "~a~%" server)
     (let ((obtained  (length narinfos))
           (requested (length items))
@@ -212,9 +213,9 @@ Return the coverage ratio, an exact number between 0 and 1."
       (format #t (G_ "  ~,1h MiB on disk (uncompressed)~%")
               (/ (reduce + 0 (map narinfo-size narinfos)) MiB))
       (format #t (G_ "  ~,3h seconds per request (~,1h seconds in total)~%")
-              (/ time requested 1.) time)
+              (/ time requests-made 1.) time)
       (format #t (G_ "  ~,1h requests per second~%")
-              (/ requested time 1.))
+              (/ requests-made time 1.))
 
       (guard (c ((http-get-error? c)
                  (if (= 404 (http-get-error-code c))
-- 
2.30.1





  reply	other threads:[~2021-03-15 15:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-15 14:44 [bug#47158] [PATCH 0/2] scripts: weather: Provide more representative request statistics Christopher Baines
2021-03-15 15:12 ` [bug#47158] [PATCH 1/2] substitutes: lookup-narinfos: Return the number of requests made Christopher Baines
2021-03-15 15:12   ` Christopher Baines [this message]
2021-03-17 10:56 ` [bug#47158] [PATCH 0/2] scripts: weather: Provide more representative request statistics Ludovic Courtès
2021-03-17 23:07   ` bug#47158: " Christopher Baines

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210315151257.17384-2-mail@cbaines.net \
    --to=mail@cbaines.net \
    --cc=47158@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.