Permalink
Browse files

simplify INPROC-THR

  • Loading branch information...
1 parent 831223a commit d064ca56b33753c23bd1f5ec941e6376e5caeb52 @galdor galdor committed Oct 5, 2011
Showing with 15 additions and 17 deletions.
  1. +15 −17 examples/official-benchmarks.lisp
@@ -77,23 +77,21 @@
(zmq:with-msg-init-size (message message-size)
(zmq:send socket message))))))))
(zmq:with-msg-init (message)
- (zmq:recv socket message)
- (unless (eq (zmq:msg-size message) message-size)
- (error "Message of incorrect size ~A received."
- (zmq:msg-size message)))
- (let* ((elapsed-time (zmq:with-stopwatch
- (do ((i 0 (1+ i)))
- ((= i (- message-count 1)))
- (zmq:recv socket message)
- (unless (eq (zmq:msg-size message) message-size)
- (error "Message of incorrect size ~A received."
- (zmq:msg-size message))))))
- (throughput (* (/ message-count elapsed-time) 1000000))
- (megabits (/ (* throughput message-size 8) 1000000)))
- (format t "message count: ~A~%" message-count)
- (format t "message size: ~A [B]~%" message-size)
- (format t "mean throughput ~A [msg/s]~%" (round throughput))
- (format t "mean throughput ~,3F [Mb/s]~%" (round megabits))))
+ (flet ((receive-message ()
+ (zmq:recv socket message)
+ (when (/= (zmq:msg-size message) message-size)
+ (format t "message of incorrect size received~%"))))
+ (receive-message)
+ (let* ((elapsed-time (zmq:with-stopwatch
+ (do ((i 0 (1+ i)))
+ ((= i (- message-count 1)))
+ (receive-message))))
+ (throughput (* (/ message-count elapsed-time) 1000000))
+ (megabits (/ (* throughput message-size 8) 1000000)))
+ (format t "message count: ~A~%" message-count)
+ (format t "message size: ~A [B]~%" message-size)
+ (format t "mean throughput ~A [msg/s]~%" (round throughput))
+ (format t "mean throughput ~,3F [Mb/s]~%" (round megabits)))))
(bordeaux-threads:join-thread thread)))))
(defun inproc-lat (message-size roundtrip-count)

0 comments on commit d064ca5

Please sign in to comment.