guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/02: scripts: weather: Provide more representative request statistics.


From: guix-commits
Subject: 02/02: scripts: weather: Provide more representative request statistics.
Date: Wed, 17 Mar 2021 17:55:53 -0400 (EDT)

cbaines pushed a commit to branch master
in repository guix.

commit c37f78a9f55874015d10f081be36104bb33a3ae1
Author: Christopher Baines <mail@cbaines.net>
AuthorDate: Mon Mar 15 14:37:49 2021 +0000

    scripts: weather: Provide more representative request statistics.
    
    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 26ec543..3490524 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))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]