Support more (optional) waypoints
This commit is contained in:
parent
1c33949f3b
commit
ae15b002c7
|
@ -9,9 +9,13 @@
|
|||
(define server-entry-type #f)
|
||||
(define server-hostname "localhost")
|
||||
(define server-port 5999)
|
||||
(define max-waypoint 1000)
|
||||
|
||||
(command-line #:program "echo-client.rkt"
|
||||
#:once-each
|
||||
["--max-waypoint" n
|
||||
"set maximum waypoint for this run"
|
||||
(set! max-waypoint (string->number n))]
|
||||
["--host" name
|
||||
"set hostname of server to contact"
|
||||
(set! server-hostname name)]
|
||||
|
@ -49,7 +53,12 @@
|
|||
(define waypoints
|
||||
(list 1 10 20 30 40 50 60 70 80 90 100 120
|
||||
150 200 210 220 230 240 250 260 270 280 290 300 400
|
||||
500 600 700 800 900))
|
||||
500 600 700 800 900
|
||||
;; Here on up, increase by ~1.2× each time
|
||||
1000 1200 1440 1728 2073
|
||||
2488 2985 3583 4299 5159
|
||||
6191 7430 8916 10699 12839
|
||||
15407 18488 22186 26623 31947))
|
||||
|
||||
;; We exchange pings with the server for this many milliseconds before
|
||||
;; moving up to the next waypoint.
|
||||
|
@ -123,18 +132,20 @@
|
|||
(match remaining-waypoints
|
||||
['() (void)]
|
||||
[(cons next-waypoint rest)
|
||||
(grow-to-waypoint next-waypoint)
|
||||
(log-info "At waypoint ~a" next-waypoint)
|
||||
(when (equal? remaining-waypoints waypoints) ;; First ever waypoint. Do some warmup.
|
||||
(log-info "Warming up.")
|
||||
(ping-randomly #f)
|
||||
(log-info "Warmup complete. Proceeding with real measurements."))
|
||||
(ping-randomly)
|
||||
(loop rest)]))
|
||||
(when (<= next-waypoint max-waypoint)
|
||||
(grow-to-waypoint next-waypoint)
|
||||
(log-info "At waypoint ~a" next-waypoint)
|
||||
(when (equal? remaining-waypoints waypoints) ;; First ever waypoint. Do some warmup.
|
||||
(log-info "Warming up.")
|
||||
(ping-randomly #f)
|
||||
(log-info "Warmup complete. Proceeding with real measurements."))
|
||||
(ping-randomly)
|
||||
(loop rest))]))
|
||||
|
||||
(let ()
|
||||
(write-logbook-datum! Tsummary #:label "server-hostname" server-hostname)
|
||||
(write-logbook-datum! Tsummary #:label "server-port" server-port)
|
||||
(write-logbook-datum! Tsummary #:label "waypoints" waypoints)
|
||||
(write-logbook-datum! Tsummary #:label "ping-time" ping-time)
|
||||
(write-logbook-datum! Tsummary #:label "max-waypoint" max-waypoint)
|
||||
(write-logbook-datum! Tsummary #:label "waypoints" waypoints)
|
||||
(void))
|
||||
|
|
|
@ -9,10 +9,14 @@
|
|||
|
||||
(define server-variation #f)
|
||||
(define server-hostname "localhost")
|
||||
(define max-waypoint #f)
|
||||
|
||||
(command-line #:program "external-latency.rkt"
|
||||
#:once-each
|
||||
["--host" name "hostname where server is reachable" (set! server-hostname name)]
|
||||
["--max-waypoint" n
|
||||
"set maximum waypoint for this run"
|
||||
(set! max-waypoint (string->number n))]
|
||||
#:once-any
|
||||
["--erlang" "use erlang server" (set! server-variation 'erlang)]
|
||||
["--minimart" "use minimart server" (set! server-variation 'minimart)]
|
||||
|
@ -65,7 +69,8 @@
|
|||
(log-info "Starting client...")
|
||||
(define client-control
|
||||
(start-bg
|
||||
(format "racket echo-client.rkt --host ~a --logbook-entry-name ~a --logbook-entry-type ~a"
|
||||
(format "racket echo-client.rkt ~a--host ~a --logbook-entry-name ~a --logbook-entry-type ~a"
|
||||
(if max-waypoint (format "--max-waypoint ~a " max-waypoint) "")
|
||||
server-hostname
|
||||
entry-name
|
||||
entry-type)))
|
||||
|
|
Loading…
Reference in New Issue