Measure probes into routing table

This commit is contained in:
Tony Garnock-Jones 2014-05-06 21:35:19 -04:00
parent ad7d8f7a81
commit 6c7efdefca
1 changed files with 28 additions and 1 deletions

View File

@ -16,6 +16,11 @@
#:column-spec '(number-of-entries
bytes-per-entry
current-memory-use)))
(define Tprobe (logbook-table E "probe-rate"
#:column-spec '(number-of-entries
positive-probes-per-second
negative-probes-per-second
large-positive-per-second)))
(define *the-routes* #f)
(define *count* 0)
@ -32,9 +37,30 @@
(define perentry (/ delta (exact->inexact n)))
(write-logbook-datum! T (list n perentry latest-datapoint)))
(define (run-probes!)
(define n-probes 100000)
(define-syntax-rule (probe message-expr)
(let-values (((ignorable-results cpu+gc-time wallclock-time gc-time)
(time-apply
(lambda ()
(let loop ((i 0))
(when (< i n-probes)
(match-value *the-routes* message-expr)
(loop (+ i 1)))))
'())))
(/ n-probes (/ wallclock-time 1000.0))))
(define positive-probes-per-second (probe (list (random *count*) "hello")))
(define large-list (make-list 1000 'x))
(define large-positive-per-second (probe (list (random *count*) large-list)))
(define negative-probes-per-second (probe (list "hello" (random *count*))))
(write-logbook-datum! Tprobe (list *count*
positive-probes-per-second
negative-probes-per-second
large-positive-per-second)))
(record-datapoint!)
(let loop ((next-count 1000))
(when (< next-count 5000000)
(when (< next-count 500000)
(define old-count *count*)
(define-values (ignorable-results cpu+gc-time wallclock-time gc-time)
(time-apply
@ -58,4 +84,5 @@
next-count))
(record-datapoint!)
(run-probes!)
(loop (inexact->exact (truncate (* next-count 1.2))))))