Skip to content
Browse files

implement the REMOTE-LAT benchmark

  • Loading branch information...
1 parent 8c7fa64 commit 064158100ea11f7af5005b9769db14a9b513df8c @galdor galdor committed
Showing with 18 additions and 0 deletions.
  1. +18 −0 examples/official-benchmarks.lisp
View
18 examples/official-benchmarks.lisp
@@ -44,3 +44,21 @@
(error "Message of incorrect size ~A received."
(zmq:msg-size message)))
(zmq:send socket message))))))
+
+(defun remote-lat (address message-size roundtrip-count)
+ (zmq:with-context (context 1)
+ (zmq:with-socket (socket context :req)
+ (zmq:connect socket address)
+ (zmq:with-msg-init-size (message message-size)
+ (let* ((elapsed-time (zmq:with-stopwatch
+ (do ((i 0 (1+ i)))
+ ((= i roundtrip-count))
+ (zmq:send socket message)
+ (zmq:recv socket message)
+ (unless (eq (zmq:msg-size message) message-size)
+ (error "Message of incorrect size ~A received."
+ (zmq:msg-size message))))))
+ (latency (/ elapsed-time (* roundtrip-count 2))))
+ (format t "message size: ~A [B]~%" message-size)
+ (format t "roundtrip count: ~A~%" roundtrip-count)
+ (format t "average latency: ~,3F [us]~%" latency))))))

0 comments on commit 0641581

Please sign in to comment.
Something went wrong with that request. Please try again.