Repair broadcast-latency-imperative-syndicate; rename prospect -> syndicate, and start repairing them
This commit is contained in:
parent
da3f737079
commit
7a6b7e3a08
|
@ -32,8 +32,11 @@
|
|||
(let ((src echoer-count)
|
||||
(dst 0))
|
||||
(spawn (on-start
|
||||
(set! run-start-time (current-inexact-milliseconds))
|
||||
(send-ping! src dst))
|
||||
(send! 'kickoff))
|
||||
|
||||
(on (message 'kickoff)
|
||||
(set! run-start-time (current-inexact-milliseconds))
|
||||
(send-ping! src dst))
|
||||
|
||||
(on (message (pong $start-time))
|
||||
(define stop-time (current-inexact-milliseconds))
|
||||
|
@ -55,7 +58,7 @@
|
|||
(- run-start-time boot-start-time)))
|
||||
|
||||
(module+ main
|
||||
(define t 2000)
|
||||
(define t 5000)
|
||||
(define E (standard-logbook-entry (default-logbook #:verbose? #t) "minimart" "broadcast-latency-imperative-syndicate"))
|
||||
(define T (logbook-table E "broadcast-latency"
|
||||
#:column-spec '(number-of-echoers
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
;; Measurement of *broadcast* message delivery latency.
|
||||
|
||||
(require racket/match)
|
||||
(require prospect)
|
||||
(require syndicate)
|
||||
(require logbook)
|
||||
|
||||
(provide run)
|
||||
|
@ -25,11 +25,15 @@
|
|||
;; each roundtrip involves (+ echoer-count 1) messages
|
||||
;; we want messages per second
|
||||
(/ (* count (+ echoer-count 1)) ;; echoer-count pings and one pong per roundtrip
|
||||
(/ total-latency 1000.0) ;; latency in seconds
|
||||
(max 0.000001 (/ total-latency 1000.0)) ;; latency in seconds
|
||||
))
|
||||
|
||||
(define (pinger src dst)
|
||||
(spawn (lambda (e s)
|
||||
(actor #:name 'pinger
|
||||
#:assertions* (patch->initial-assertions
|
||||
(patch-seq (sub (pong ?))
|
||||
(sub 'kickoff)))
|
||||
(lambda (e s)
|
||||
(match e
|
||||
[(message 'kickoff)
|
||||
(set! run-start-time (current-inexact-milliseconds))
|
||||
|
@ -42,7 +46,7 @@
|
|||
(define delta (- stop-time start-time))
|
||||
(set! total-latency (+ total-latency delta))
|
||||
(set! total-roundtrips (+ total-roundtrips 1))
|
||||
(when (zero? (modulo total-roundtrips 1000))
|
||||
(when (zero? (modulo total-roundtrips 10000))
|
||||
(log-info "After ~a roundtrips, ~a milliseconds; ~a Hz"
|
||||
total-roundtrips
|
||||
total-latency
|
||||
|
@ -53,19 +57,19 @@
|
|||
'()))]
|
||||
[_ #f]))
|
||||
#f
|
||||
(patch-seq (sub (pong ?))
|
||||
(sub 'kickoff)
|
||||
(pub (ping src dst ?)))))
|
||||
'()))
|
||||
|
||||
(define (echoer id)
|
||||
(spawn (lambda (e s)
|
||||
(actor #:name (list 'echoer id)
|
||||
#:assertions* (patch->initial-assertions
|
||||
(patch-seq (sub (ping ? ? ?))))
|
||||
(lambda (e s)
|
||||
(match e
|
||||
[(message (ping src (== id) stamp))
|
||||
(transition s (message (pong stamp)))]
|
||||
[_ #f]))
|
||||
#f
|
||||
(patch-seq (sub (ping ? ? ?))
|
||||
(pub (pong ?)))))
|
||||
'()))
|
||||
|
||||
(begin
|
||||
(run-ground (for/list [(id (in-range echoer-count))] (echoer id))
|
||||
|
@ -75,7 +79,7 @@
|
|||
|
||||
(module+ main
|
||||
(define t 10000)
|
||||
(define E (standard-logbook-entry (default-logbook #:verbose? #t) "minimart" "broadcast-latency-prospect"))
|
||||
(define E (standard-logbook-entry (default-logbook #:verbose? #t) "minimart" "broadcast-latency-syndicate"))
|
||||
(define T (logbook-table E "broadcast-latency"
|
||||
#:column-spec '(number-of-echoers
|
||||
secs/msg
|
Loading…
Reference in New Issue