Add libzmq.so.3 since cl-zmq supports ZeroMQ3
[cl-zmq.git] / perf / remote-lat.lisp
blobd21ff643a13e3c4a5782b6c4f9cf0a6f5a607b13
1 ;; Copyright (c) 2009, 2010 Vitaly Mayatskikh <v.mayatskih@gmail.com>
2 ;;
3 ;; This file is part of CL-ZMQ.
4 ;;
5 ;; Vitaly Mayatskikh grants you the rights to distribute
6 ;; and use this software as governed by the terms
7 ;; of the Lisp Lesser GNU Public License
8 ;; (http://opensource.franz.com/preamble.html),
9 ;; known as the LLGPL.
11 (asdf:oos 'asdf:load-op :zeromq)
13 (defpackage :zeromq-test
14 (:use :cl))
16 (in-package :zeromq-test)
18 (load "lat-parms")
19 (load "helpers")
21 (defvar *elapsed* nil)
22 (defvar *latency* nil)
24 (zmq::with-context (ctx 1)
25 (zmq:with-socket (s ctx zmq:req)
26 (zmq:connect s *address*)
27 (let ((msg (make-instance 'zmq:msg :size *message-size*)))
28 (setf *elapsed*
29 (with-stopwatch
30 (dotimes (i *roundtrip-count*)
31 (zmq:send s msg)
32 (zmq:recv s msg)))))
33 (sleep 1)))
35 (setf *latency* (/ *elapsed* (* 2 *roundtrip-count*)))
37 (format t "message size: ~d [B]~%" *message-size*)
38 (format t "roundtrip count: ~d~%" *roundtrip-count*)
39 (format t "average latency: ~f [us]~%" *latency*)
41 (tg:gc)
42 #+sbcl (sb-ext:quit)
43 #+clisp (ext:quit)
44 #+ccl (ccl:quit)
45 #+ecl (ext:quit)