From b3be7a8e83b9118d9b490d419bf3d93db53df55f Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Fri, 21 Jun 2019 14:42:21 +0100 Subject: [PATCH] Fix internal-latency-syndicate.rkt --- internal-latency-syndicate.rkt | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/internal-latency-syndicate.rkt b/internal-latency-syndicate.rkt index 4ea32b3..c0e9971 100644 --- a/internal-latency-syndicate.rkt +++ b/internal-latency-syndicate.rkt @@ -2,7 +2,7 @@ ;; Measurement of message delivery latency. (require racket/match) -(require prospect) +(require syndicate) (require logbook) (provide run) @@ -25,7 +25,10 @@ )) (define (pinger src dst) - (spawn (lambda (e s) + (actor #:assertions* (patch->initial-assertions + (patch-seq (sub (ping dst src ?)) + (sub 'kickoff))) + (lambda (e s) (match e [(message 'kickoff) (set! run-start-time (current-inexact-milliseconds)) @@ -38,7 +41,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 @@ -49,19 +52,18 @@ '()))] [_ #f])) #f - (patch-seq (sub (ping dst src ?)) - (sub 'kickoff) - (pub (ping src dst ?))))) + '())) (define (echoer id) - (spawn (lambda (e s) + (actor #:assertions* (patch->initial-assertions + (sub (ping ? id ?))) + (lambda (e s) (match e [(message (ping src (== id) stamp)) (transition s (message (ping id src stamp)))] [_ #f])) #f - (patch-seq (sub (ping ? id ?)) - (pub (ping id ? ?))))) + '())) (begin (run-ground (for/list [(id (in-range echoer-count))] (echoer id)) @@ -71,7 +73,7 @@ (module+ main (define t 10000) - (define E (standard-logbook-entry (default-logbook #:verbose? #t) "minimart" "internal-latency-prospect")) + (define E (standard-logbook-entry (default-logbook #:verbose? #t) "minimart" "internal-latency-syndicate")) (define T (logbook-table E "internal-latency" #:column-spec '(number-of-echoers secs/msg