summaryrefslogtreecommitdiff
path: root/perf/cl
diff options
context:
space:
mode:
Diffstat (limited to 'perf/cl')
-rw-r--r--perf/cl/Makefile.am2
-rw-r--r--perf/cl/lat-parms.lisp22
-rw-r--r--perf/cl/local-lat-poll.lisp43
-rw-r--r--perf/cl/local-lat.lisp52
-rw-r--r--perf/cl/local-thr.lisp54
-rw-r--r--perf/cl/remote-lat.lisp50
-rw-r--r--perf/cl/remote-thr.lisp41
-rw-r--r--perf/cl/thr-parms.lisp25
8 files changed, 289 insertions, 0 deletions
diff --git a/perf/cl/Makefile.am b/perf/cl/Makefile.am
new file mode 100644
index 0000000..72d2663
--- /dev/null
+++ b/perf/cl/Makefile.am
@@ -0,0 +1,2 @@
+dist_noinst_CL = local-lat.lisp local-lat-poll.lisp remote-lat.lisp \
+lat-parms.lisp local-thr.lisp remote-thr.lisp thr-params.lisp
diff --git a/perf/cl/lat-parms.lisp b/perf/cl/lat-parms.lisp
new file mode 100644
index 0000000..d821237
--- /dev/null
+++ b/perf/cl/lat-parms.lisp
@@ -0,0 +1,22 @@
+;; Copyright (c) 2009 Vitaly Mayatskikh <v.mayatskih@gmail.com>
+;;
+;; This file is part of 0MQ.
+;;
+;; 0MQ is free software; you can redistribute it and/or modify it under
+;; the terms of the Lesser GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; 0MQ is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; Lesser GNU General Public License for more details.
+;;
+;; You should have received a copy of the Lesser GNU General Public License
+;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+(in-package :zeromq-test)
+
+(defvar *address* "tcp://127.0.0.1:5555/")
+(defvar *roundtrip-count* 1000)
+(defvar *message-size* 32)
diff --git a/perf/cl/local-lat-poll.lisp b/perf/cl/local-lat-poll.lisp
new file mode 100644
index 0000000..4fea85e
--- /dev/null
+++ b/perf/cl/local-lat-poll.lisp
@@ -0,0 +1,43 @@
+;; Copyright (c) 2009 Vitaly Mayatskikh <v.mayatskih@gmail.com>
+;;
+;; This file is part of 0MQ.
+;;
+;; 0MQ is free software; you can redistribute it and/or modify it under
+;; the terms of the Lesser GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; 0MQ is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; Lesser GNU General Public License for more details.
+;;
+;; You should have received a copy of the Lesser GNU General Public License
+;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+(asdf:oos 'asdf:load-op :zeromq)
+
+(defpackage :zeromq-test
+ (:use :cl))
+
+(in-package :zeromq-test)
+
+(load "lat-parms")
+
+(zmq:with-context (ctx 1 1 zmq:poll)
+ (zmq:with-socket (s ctx zmq:rep)
+ (zmq:bind s *address*)
+ (let ((msg (make-instance 'zmq:msg)))
+ (zmq:with-polls ((poll-in . ((s . zmq:pollin)))
+ (poll-out . ((s . zmq:pollout))))
+ (dotimes (i *roundtrip-count*)
+ (zmq:poll poll-in)
+ (zmq:recv s msg zmq:noblock)
+ (zmq:poll poll-out)
+ (zmq:send s msg zmq:noblock))))))
+
+(tg:gc)
+#+sbcl (sb-ext:quit)
+#+clisp (ext:quit)
+
+;
diff --git a/perf/cl/local-lat.lisp b/perf/cl/local-lat.lisp
new file mode 100644
index 0000000..7de16a6
--- /dev/null
+++ b/perf/cl/local-lat.lisp
@@ -0,0 +1,52 @@
+;; Copyright (c) 2009 Vitaly Mayatskikh <v.mayatskih@gmail.com>
+;;
+;; This file is part of 0MQ.
+;;
+;; 0MQ is free software; you can redistribute it and/or modify it under
+;; the terms of the Lesser GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; 0MQ is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; Lesser GNU General Public License for more details.
+;;
+;; You should have received a copy of the Lesser GNU General Public License
+;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+(asdf:oos 'asdf:load-op :zeromq)
+
+(defpackage :zeromq-test
+ (:use :cl))
+
+(in-package :zeromq-test)
+
+(load "lat-parms")
+
+(zmq:with-context (ctx 1 1)
+ (zmq:with-socket (s ctx zmq:rep)
+ (zmq:bind s *address*)
+ (let ((msg (make-instance 'zmq:msg)))
+ (dotimes (i *roundtrip-count*)
+;; non-blocking recv
+ #+nil
+ (tagbody retry
+ (handler-case
+ (progn
+ (zmq:recv s msg zmq:noblock)
+ (format t "size ~d, ~a~%" (zmq:msg-size msg) (zmq:msg-data-as-array msg)))
+ (zmq:error-again (c)
+ (declare (ignore c))
+ (sleep 0.01)
+ (go retry))))
+;; blocking recv
+ (zmq:recv s msg)
+ (zmq:send s msg)))
+ (zmq:sleep 1)))
+
+(tg:gc)
+#+sbcl (sb-ext:quit)
+#+clisp (ext:quit)
+
+;
diff --git a/perf/cl/local-thr.lisp b/perf/cl/local-thr.lisp
new file mode 100644
index 0000000..1098c47
--- /dev/null
+++ b/perf/cl/local-thr.lisp
@@ -0,0 +1,54 @@
+;; Copyright (c) 2009 Vitaly Mayatskikh <v.mayatskih@gmail.com>
+;;
+;; This file is part of 0MQ.
+;;
+;; 0MQ is free software; you can redistribute it and/or modify it under
+;; the terms of the Lesser GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; 0MQ is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; Lesser GNU General Public License for more details.
+;;
+;; You should have received a copy of the Lesser GNU General Public License
+;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+(asdf:oos 'asdf:load-op :zeromq)
+
+(defpackage :zeromq-test
+ (:use :cl))
+
+(in-package :zeromq-test)
+
+(load "thr-parms")
+
+(defvar *elapsed* nil)
+(defvar *throughput* nil)
+(defvar *megabits* nil)
+
+(zmq::with-context (ctx 1 1)
+ (zmq:with-socket (s ctx zmq:sub)
+ (zmq:setsockopt s zmq:subscribe "*")
+ (zmq:setsockopt s zmq:rate *rate*)
+ (zmq:bind s *bind-address*)
+ (let ((msg (make-instance 'zmq:msg)))
+ (zmq:recv s msg)
+ (setf *elapsed*
+ (zmq:with-stopwatch
+ (dotimes (i (1- *message-count*))
+ (zmq:recv s msg))))))
+ (setq *throughput* (* (/ *message-count* *elapsed*) 1e6)
+ *megabits* (/ (* *throughput* *message-count* 8) 1e6))
+
+ (format t "message size: ~d [B]~%" *message-size*)
+ (format t "message count: ~d~%" *message-count*)
+ (format t "mean throughput: ~d [msg/s]~%" (round *throughput*))
+ (format t "mean throughput: ~,3f [Mb/s]~%" *megabits*))
+
+(tg:gc)
+#+sbcl (sb-ext:quit)
+#+clisp (ext:quit)
+
+;
diff --git a/perf/cl/remote-lat.lisp b/perf/cl/remote-lat.lisp
new file mode 100644
index 0000000..c0f0d8a
--- /dev/null
+++ b/perf/cl/remote-lat.lisp
@@ -0,0 +1,50 @@
+;; Copyright (c) 2009 Vitaly Mayatskikh <v.mayatskih@gmail.com>
+;;
+;; This file is part of 0MQ.
+;;
+;; 0MQ is free software; you can redistribute it and/or modify it under
+;; the terms of the Lesser GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; 0MQ is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; Lesser GNU General Public License for more details.
+;;
+;; You should have received a copy of the Lesser GNU General Public License
+;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+(asdf:oos 'asdf:load-op :zeromq)
+
+(defpackage :zeromq-test
+ (:use :cl))
+
+(in-package :zeromq-test)
+
+(load "lat-parms")
+
+(defvar *elapsed* nil)
+(defvar *latency* nil)
+
+(zmq::with-context (ctx 1 1)
+ (zmq:with-socket (s ctx zmq:req)
+ (zmq:connect s *address*)
+ (let ((msg (make-instance 'zmq:msg :size *message-size*)))
+ (setf *elapsed*
+ (zmq:with-stopwatch
+ (dotimes (i *roundtrip-count*)
+ (zmq:send s msg)
+ (zmq:recv s msg)))))
+ (zmq:sleep 1)))
+
+(setf *latency* (/ *elapsed* (* 2 *roundtrip-count*)))
+
+(format t "message size: ~d [B]~%" *message-size*)
+(format t "roundtrip count: ~d~%" *roundtrip-count*)
+(format t "average latency: ~f [us]~%" *latency*)
+
+(tg:gc)
+#+sbcl (sb-ext:quit)
+#+clisp (ext:quit)
+;
diff --git a/perf/cl/remote-thr.lisp b/perf/cl/remote-thr.lisp
new file mode 100644
index 0000000..c50170e
--- /dev/null
+++ b/perf/cl/remote-thr.lisp
@@ -0,0 +1,41 @@
+;; Copyright (c) 2009 Vitaly Mayatskikh <v.mayatskih@gmail.com>
+;;
+;; This file is part of 0MQ.
+;;
+;; 0MQ is free software; you can redistribute it and/or modify it under
+;; the terms of the Lesser GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; 0MQ is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; Lesser GNU General Public License for more details.
+;;
+;; You should have received a copy of the Lesser GNU General Public License
+;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+(asdf:oos 'asdf:load-op :zeromq)
+
+(defpackage :zeromq-test
+ (:use :cl))
+
+(in-package :zeromq-test)
+
+(load "thr-parms")
+
+(zmq::with-context (ctx 1 1)
+ (zmq:with-socket (s ctx zmq:pub)
+ (zmq:setsockopt s zmq:rate *rate*)
+ (zmq:connect s *connect-address*)
+ (let ((msg (make-instance 'zmq:msg)))
+ (dotimes (i *message-count*)
+ (zmq:msg-init-size msg *message-size*)
+ (zmq:send s msg)
+ (zmq:msg-close msg))
+ (zmq:sleep 10))))
+
+(tg:gc)
+#+sbcl (sb-ext:quit)
+#+clisp (ext:quit)
+;
diff --git a/perf/cl/thr-parms.lisp b/perf/cl/thr-parms.lisp
new file mode 100644
index 0000000..e2693e8
--- /dev/null
+++ b/perf/cl/thr-parms.lisp
@@ -0,0 +1,25 @@
+;; Copyright (c) 2009 Vitaly Mayatskikh <v.mayatskih@gmail.com>
+;;
+;; This file is part of 0MQ.
+;;
+;; 0MQ is free software; you can redistribute it and/or modify it under
+;; the terms of the Lesser GNU General Public License as published by
+;; the Free Software Foundation; either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; 0MQ is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; Lesser GNU General Public License for more details.
+;;
+;; You should have received a copy of the Lesser GNU General Public License
+;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+(in-package :zeromq-test)
+
+;(defvar *address* "pgm://lo;224.0.0.1:8000")
+(defvar *bind-address* "tcp://lo:8000")
+(defvar *connect-address* "tcp://localhost:8000")
+(defvar *message-count* 1000)
+(defvar *message-size* 256)
+(defvar *rate* 256)