Fixing tests.
[cl-zmq.git] / perf / local-lat.lisp
blobcbbd3c9b79baf549bc1edac4fbfe1b1b9ae43478
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")
20 (zmq:with-context (ctx 1)
21 (zmq:with-socket (s ctx zmq:rep)
22 (zmq:bind s *address*)
23 (let ((msg (make-instance 'zmq:msg)))
24 (dotimes (i *roundtrip-count*)
25 ;; non-blocking recv
26 #+nil
27 (tagbody retry
28 (handler-case
29 (progn
30 (zmq:recv s msg zmq:noblock)
31 (format t "size ~d, ~a~%" (zmq:msg-size msg) (zmq:msg-data-as-array msg)))
32 (zmq:error-again (c)
33 (declare (ignore c))
34 (sleep 0.01)
35 (go retry))))
36 ;; blocking recv
37 (zmq:recv s msg)
38 (zmq:send s msg)))
39 (sleep 1)))
41 (tg:gc)
42 #+sbcl (sb-ext:quit)
43 #+clisp (ext:quit)
44 #+ccl (ccl:quit)
45 #+ecl (ext:quit)