Fixed wrong bitfield options.
[cl-zmq.git] / perf / local-thr.lisp
blobb95d5c40cc502403e6a7c201b19e01bacc2840d4
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 "thr-parms")
19 (load "helpers")
21 (defvar *elapsed* nil)
22 (defvar *throughput* nil)
23 (defvar *megabits* nil)
25 (zmq::with-context (ctx 1)
26 (zmq:with-socket (s ctx zmq:sub)
27 (zmq:setsockopt s zmq:subscribe "")
28 (zmq:setsockopt s zmq:rate *rate*)
29 (zmq:bind s *bind-address*)
30 (let ((msg (make-instance 'zmq:msg)))
31 (zmq:recv s msg)
32 (setf *elapsed*
33 (with-stopwatch
34 (dotimes (i (1- *message-count*))
35 (zmq:recv s msg))))))
36 (setq *throughput* (* (/ *message-count* *elapsed*) 1e6)
37 *megabits* (/ (* *throughput* *message-count* 8) 1e6))
39 (format t "message size: ~d [B]~%" *message-size*)
40 (format t "message count: ~d~%" *message-count*)
41 (format t "mean throughput: ~d [msg/s]~%" (round *throughput*))
42 (format t "mean throughput: ~,3f [Mb/s]~%" *megabits*))
44 (tg:gc)
45 #+sbcl (sb-ext:quit)
46 #+clisp (ext:quit)
47 #+ccl (ccl:quit)
48 #+ecl (ext:quit)