mirror of
https://github.com/zeromq/libzmq.git
synced 2025-01-15 10:18:01 +08:00
Ruby binding removed
This commit is contained in:
parent
45414b5444
commit
ea0a44c8a9
@ -2,10 +2,6 @@ if BUILD_JAVA
|
|||||||
DIR_J = java
|
DIR_J = java
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if BUILD_RUBY
|
SUBDIRS = $(DIR_J)
|
||||||
DIR_R = ruby
|
DIST_SUBDIRS = java
|
||||||
endif
|
|
||||||
|
|
||||||
SUBDIRS = $(DIR_J) $(DIR_R)
|
|
||||||
DIST_SUBDIRS = java ruby
|
|
||||||
|
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
INCLUDES = -I$(top_builddir) -I$(top_srcdir)/include -I$(top_builddir)/include
|
|
||||||
|
|
||||||
rblib_LTLIBRARIES = librbzmq.la
|
|
||||||
rblibdir = @RUBYDIR@
|
|
||||||
|
|
||||||
librbzmq_la_SOURCES = rbzmq.cpp
|
|
||||||
|
|
||||||
librbzmq_la_LDFLAGS = -version-info @RBLTVER@
|
|
||||||
librbzmq_la_CXXFLAGS = -Wall -pedantic -Werror -Wno-long-long
|
|
||||||
librbzmq_la_LIBADD = $(top_builddir)/src/libzmq.la
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright (c) 2007-2010 iMatix Corporation
|
|
||||||
#
|
|
||||||
# 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/>.
|
|
||||||
|
|
||||||
require 'mkmf'
|
|
||||||
dir_config('libzmq')
|
|
||||||
if have_library('libzmq', 'zmq_init')
|
|
||||||
puts "Cool, I found your zmq install..."
|
|
||||||
create_makefile("zmq")
|
|
||||||
else
|
|
||||||
raise "Couldn't find zmq library. try setting --with-zmq-dir=<path> to tell me where it is."
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
@ -1,288 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright (c) 2007-2010 iMatix Corporation
|
|
||||||
|
|
||||||
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/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <ruby.h>
|
|
||||||
|
|
||||||
#include "../c/zmq.h"
|
|
||||||
|
|
||||||
static void context_free (void *ctx)
|
|
||||||
{
|
|
||||||
if (ctx) {
|
|
||||||
int rc = zmq_term (ctx);
|
|
||||||
assert (rc == 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static VALUE context_alloc (VALUE class_)
|
|
||||||
{
|
|
||||||
return rb_data_object_alloc (class_, NULL, 0, context_free);
|
|
||||||
}
|
|
||||||
|
|
||||||
static VALUE context_initialize (VALUE self_, VALUE app_threads_,
|
|
||||||
VALUE io_threads_, VALUE flags_)
|
|
||||||
{
|
|
||||||
assert (!DATA_PTR (self_));
|
|
||||||
void *ctx = zmq_init (NUM2INT (app_threads_), NUM2INT (io_threads_),
|
|
||||||
NUM2INT (flags_));
|
|
||||||
if (!ctx) {
|
|
||||||
rb_raise (rb_eRuntimeError, zmq_strerror (zmq_errno ()));
|
|
||||||
return Qnil;
|
|
||||||
}
|
|
||||||
|
|
||||||
DATA_PTR (self_) = (void*) ctx;
|
|
||||||
return self_;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void socket_free (void *s)
|
|
||||||
{
|
|
||||||
if (s) {
|
|
||||||
int rc = zmq_close (s);
|
|
||||||
assert (rc == 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static VALUE socket_alloc (VALUE class_)
|
|
||||||
{
|
|
||||||
return rb_data_object_alloc (class_, NULL, 0, socket_free);
|
|
||||||
}
|
|
||||||
|
|
||||||
static VALUE socket_initialize (VALUE self_, VALUE context_, VALUE type_)
|
|
||||||
{
|
|
||||||
assert (!DATA_PTR (self_));
|
|
||||||
|
|
||||||
if (strcmp (rb_obj_classname (context_), "ZMQ::Context") != 0) {
|
|
||||||
rb_raise (rb_eArgError, "expected ZMQ::Context object");
|
|
||||||
return Qnil;
|
|
||||||
}
|
|
||||||
|
|
||||||
void *s = zmq_socket (DATA_PTR (context_), NUM2INT (type_));
|
|
||||||
if (!s) {
|
|
||||||
rb_raise (rb_eRuntimeError, zmq_strerror (zmq_errno ()));
|
|
||||||
return Qnil;
|
|
||||||
}
|
|
||||||
|
|
||||||
DATA_PTR (self_) = (void*) s;
|
|
||||||
return self_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static VALUE socket_setsockopt (VALUE self_, VALUE option_,
|
|
||||||
VALUE optval_)
|
|
||||||
{
|
|
||||||
|
|
||||||
int rc = 0;
|
|
||||||
|
|
||||||
switch (NUM2INT (option_)) {
|
|
||||||
case ZMQ_HWM:
|
|
||||||
case ZMQ_LWM:
|
|
||||||
case ZMQ_SWAP:
|
|
||||||
case ZMQ_AFFINITY:
|
|
||||||
case ZMQ_RATE:
|
|
||||||
case ZMQ_RECOVERY_IVL:
|
|
||||||
case ZMQ_MCAST_LOOP:
|
|
||||||
{
|
|
||||||
long optval = FIX2LONG (optval_);
|
|
||||||
|
|
||||||
// Forward the code to native 0MQ library.
|
|
||||||
rc = zmq_setsockopt (DATA_PTR (self_), NUM2INT (option_),
|
|
||||||
(void *) &optval, 4);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ZMQ_IDENTITY:
|
|
||||||
case ZMQ_SUBSCRIBE:
|
|
||||||
case ZMQ_UNSUBSCRIBE:
|
|
||||||
|
|
||||||
// Forward the code to native 0MQ library.
|
|
||||||
rc = zmq_setsockopt (DATA_PTR (self_), NUM2INT (option_),
|
|
||||||
(void *) StringValueCStr (optval_), RSTRING_LEN (optval_));
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
rb_raise (rb_eRuntimeError, zmq_strerror (EINVAL));
|
|
||||||
return Qnil;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rc != 0) {
|
|
||||||
rb_raise (rb_eRuntimeError, zmq_strerror (zmq_errno ()));
|
|
||||||
return Qnil;
|
|
||||||
}
|
|
||||||
|
|
||||||
return self_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static VALUE socket_bind (VALUE self_, VALUE addr_)
|
|
||||||
{
|
|
||||||
assert (DATA_PTR (self_));
|
|
||||||
|
|
||||||
int rc = zmq_bind (DATA_PTR (self_), rb_string_value_cstr (&addr_));
|
|
||||||
if (rc != 0) {
|
|
||||||
rb_raise (rb_eRuntimeError, zmq_strerror (zmq_errno ()));
|
|
||||||
return Qnil;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Qnil;
|
|
||||||
}
|
|
||||||
|
|
||||||
static VALUE socket_connect (VALUE self_, VALUE addr_)
|
|
||||||
{
|
|
||||||
assert (DATA_PTR (self_));
|
|
||||||
|
|
||||||
int rc = zmq_connect (DATA_PTR (self_), rb_string_value_cstr (&addr_));
|
|
||||||
if (rc != 0) {
|
|
||||||
rb_raise (rb_eRuntimeError, zmq_strerror (zmq_errno ()));
|
|
||||||
return Qnil;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Qnil;
|
|
||||||
}
|
|
||||||
|
|
||||||
static VALUE socket_send (VALUE self_, VALUE msg_, VALUE flags_)
|
|
||||||
{
|
|
||||||
assert (DATA_PTR (self_));
|
|
||||||
|
|
||||||
Check_Type (msg_, T_STRING);
|
|
||||||
|
|
||||||
zmq_msg_t msg;
|
|
||||||
int rc = zmq_msg_init_size (&msg, RSTRING_LEN (msg_));
|
|
||||||
if (rc != 0) {
|
|
||||||
rb_raise (rb_eRuntimeError, zmq_strerror (zmq_errno ()));
|
|
||||||
return Qnil;
|
|
||||||
}
|
|
||||||
memcpy (zmq_msg_data (&msg), RSTRING_PTR (msg_), RSTRING_LEN (msg_));
|
|
||||||
|
|
||||||
rc = zmq_send (DATA_PTR (self_), &msg, NUM2INT (flags_));
|
|
||||||
if (rc != 0 && zmq_errno () == EAGAIN) {
|
|
||||||
rc = zmq_msg_close (&msg);
|
|
||||||
assert (rc == 0);
|
|
||||||
return Qfalse;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rc != 0) {
|
|
||||||
rb_raise (rb_eRuntimeError, zmq_strerror (zmq_errno ()));
|
|
||||||
rc = zmq_msg_close (&msg);
|
|
||||||
assert (rc == 0);
|
|
||||||
return Qnil;
|
|
||||||
}
|
|
||||||
|
|
||||||
rc = zmq_msg_close (&msg);
|
|
||||||
assert (rc == 0);
|
|
||||||
return Qtrue;
|
|
||||||
}
|
|
||||||
|
|
||||||
static VALUE socket_flush (VALUE self_)
|
|
||||||
{
|
|
||||||
assert (DATA_PTR (self_));
|
|
||||||
|
|
||||||
int rc = zmq_flush (DATA_PTR (self_));
|
|
||||||
if (rc != 0) {
|
|
||||||
rb_raise (rb_eRuntimeError, zmq_strerror (zmq_errno ()));
|
|
||||||
return Qnil;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Qnil;
|
|
||||||
}
|
|
||||||
|
|
||||||
static VALUE socket_recv (VALUE self_, VALUE flags_)
|
|
||||||
{
|
|
||||||
assert (DATA_PTR (self_));
|
|
||||||
|
|
||||||
zmq_msg_t msg;
|
|
||||||
int rc = zmq_msg_init (&msg);
|
|
||||||
assert (rc == 0);
|
|
||||||
|
|
||||||
rc = zmq_recv (DATA_PTR (self_), &msg, NUM2INT (flags_));
|
|
||||||
if (rc != 0 && zmq_errno () == EAGAIN) {
|
|
||||||
rc = zmq_msg_close (&msg);
|
|
||||||
assert (rc == 0);
|
|
||||||
return Qnil;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rc != 0) {
|
|
||||||
rb_raise (rb_eRuntimeError, zmq_strerror (zmq_errno ()));
|
|
||||||
rc = zmq_msg_close (&msg);
|
|
||||||
assert (rc == 0);
|
|
||||||
return Qnil;
|
|
||||||
}
|
|
||||||
|
|
||||||
VALUE message = rb_str_new ((char*) zmq_msg_data (&msg),
|
|
||||||
zmq_msg_size (&msg));
|
|
||||||
rc = zmq_msg_close (&msg);
|
|
||||||
assert (rc == 0);
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" void Init_librbzmq ()
|
|
||||||
{
|
|
||||||
VALUE zmq_module = rb_define_module ("ZMQ");
|
|
||||||
VALUE context_type = rb_define_class_under (zmq_module, "Context",
|
|
||||||
rb_cObject);
|
|
||||||
rb_define_alloc_func (context_type, context_alloc);
|
|
||||||
rb_define_method (context_type, "initialize",
|
|
||||||
(VALUE(*)(...)) context_initialize, 3);
|
|
||||||
|
|
||||||
VALUE socket_type = rb_define_class_under (zmq_module, "Socket",
|
|
||||||
rb_cObject);
|
|
||||||
rb_define_alloc_func (socket_type, socket_alloc);
|
|
||||||
rb_define_method (socket_type, "initialize",
|
|
||||||
(VALUE(*)(...)) socket_initialize, 2);
|
|
||||||
rb_define_method (socket_type, "setsockopt",
|
|
||||||
(VALUE(*)(...)) socket_setsockopt, 2);
|
|
||||||
rb_define_method (socket_type, "bind",
|
|
||||||
(VALUE(*)(...)) socket_bind, 1);
|
|
||||||
rb_define_method (socket_type, "connect",
|
|
||||||
(VALUE(*)(...)) socket_connect, 1);
|
|
||||||
rb_define_method (socket_type, "send",
|
|
||||||
(VALUE(*)(...)) socket_send, 2);
|
|
||||||
rb_define_method (socket_type, "flush",
|
|
||||||
(VALUE(*)(...)) socket_flush, 0);
|
|
||||||
rb_define_method (socket_type, "recv",
|
|
||||||
(VALUE(*)(...)) socket_recv, 1);
|
|
||||||
|
|
||||||
rb_define_const (zmq_module, "HWM", INT2NUM (ZMQ_HWM));
|
|
||||||
rb_define_const (zmq_module, "LWM", INT2NUM (ZMQ_LWM));
|
|
||||||
rb_define_const (zmq_module, "SWAP", INT2NUM (ZMQ_SWAP));
|
|
||||||
rb_define_const (zmq_module, "AFFINITY", INT2NUM (ZMQ_AFFINITY));
|
|
||||||
rb_define_const (zmq_module, "IDENTITY", INT2NUM (ZMQ_IDENTITY));
|
|
||||||
rb_define_const (zmq_module, "SUBSCRIBE", INT2NUM (ZMQ_SUBSCRIBE));
|
|
||||||
rb_define_const (zmq_module, "UNSUBSCRIBE", INT2NUM (ZMQ_UNSUBSCRIBE));
|
|
||||||
rb_define_const (zmq_module, "RATE", INT2NUM (ZMQ_RATE));
|
|
||||||
rb_define_const (zmq_module, "RECOVERY_IVL", INT2NUM (ZMQ_RECOVERY_IVL));
|
|
||||||
rb_define_const (zmq_module, "MCAST_LOOP", INT2NUM (ZMQ_MCAST_LOOP));
|
|
||||||
rb_define_const (zmq_module, "SNDBUF", INT2NUM (ZMQ_SNDBUF));
|
|
||||||
rb_define_const (zmq_module, "RCVBUF", INT2NUM (ZMQ_RCVBUF));
|
|
||||||
|
|
||||||
rb_define_const (zmq_module, "NOBLOCK", INT2NUM (ZMQ_NOBLOCK));
|
|
||||||
rb_define_const (zmq_module, "NOFLUSH", INT2NUM (ZMQ_NOFLUSH));
|
|
||||||
|
|
||||||
rb_define_const (zmq_module, "P2P", INT2NUM (ZMQ_P2P));
|
|
||||||
rb_define_const (zmq_module, "SUB", INT2NUM (ZMQ_SUB));
|
|
||||||
rb_define_const (zmq_module, "PUB", INT2NUM (ZMQ_PUB));
|
|
||||||
rb_define_const (zmq_module, "REQ", INT2NUM (ZMQ_REQ));
|
|
||||||
rb_define_const (zmq_module, "REP", INT2NUM (ZMQ_REP));
|
|
||||||
rb_define_const (zmq_module, "XREQ", INT2NUM (ZMQ_XREQ));
|
|
||||||
rb_define_const (zmq_module, "XREP", INT2NUM (ZMQ_XREP));
|
|
||||||
rb_define_const (zmq_module, "UPSTREAM", INT2NUM (ZMQ_UPSTREAM));
|
|
||||||
rb_define_const (zmq_module, "DOWNSTREAM", INT2NUM (ZMQ_DOWNSTREAM));
|
|
||||||
|
|
||||||
rb_define_const (zmq_module, "POLL", INT2NUM (ZMQ_POLL));
|
|
||||||
}
|
|
57
configure.in
57
configure.in
@ -37,10 +37,6 @@ AC_SUBST(PACKAGE_VERSION)
|
|||||||
LTVER="0:0:0"
|
LTVER="0:0:0"
|
||||||
AC_SUBST(LTVER)
|
AC_SUBST(LTVER)
|
||||||
|
|
||||||
# librbzmq -version-info
|
|
||||||
RBLTVER="0:0:0"
|
|
||||||
AC_SUBST(RBLTVER)
|
|
||||||
|
|
||||||
# libjzmq -version-info
|
# libjzmq -version-info
|
||||||
JLTVER="0:0:0"
|
JLTVER="0:0:0"
|
||||||
AC_SUBST(JLTVER)
|
AC_SUBST(JLTVER)
|
||||||
@ -313,48 +309,6 @@ if test "x$cpp" != "xno"; then
|
|||||||
cppzmq="yes"
|
cppzmq="yes"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# RUBY
|
|
||||||
rbzmq="no"
|
|
||||||
AC_ARG_WITH(ruby_headersdir,
|
|
||||||
AS_HELP_STRING([--with-ruby-headersdir], [ruby.h header file location]),
|
|
||||||
[ruby_headersdir="$withval"], [ruby_headersdir="no"])
|
|
||||||
|
|
||||||
if test "x$ruby_headersdir" != "xno"; then
|
|
||||||
CPPFLAGS="${CPPFLAGS} -I${ruby_headersdir}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_ARG_WITH(ruby_libdir,
|
|
||||||
AS_HELP_STRING([--with-ruby-libdir],[libruby library file location]),
|
|
||||||
[ruby_libdir="$withval"], [ruby_libdir="no"])
|
|
||||||
|
|
||||||
if test "x$ruby_libdir" != "xno"; then
|
|
||||||
LDFLAGS="${LDFLAGS} -L${ruby_libdir}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_ARG_WITH([ruby], [AS_HELP_STRING([--with-ruby], [build ruby language binding [default=no]])], [with_ruby=yes], [with_ruby=no])
|
|
||||||
if test "x$with_ruby" != "xno"; then
|
|
||||||
AC_CHECK_HEADERS([ruby.h], [],
|
|
||||||
[AC_MSG_ERROR([cannot find Ruby header files. Please specify their location with --with-ruby-headersdir.])])
|
|
||||||
|
|
||||||
AC_SEARCH_LIBS(ruby_init,[ruby ruby1.8 ruby18],,
|
|
||||||
[AC_MSG_ERROR([cannot link with Ruby library. Please specify it's location with --with-ruby-libdir.])])
|
|
||||||
|
|
||||||
rbzmq="yes"
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_ARG_WITH([rubydir], [AS_HELP_STRING([--with-rubydir],
|
|
||||||
[librbzmq install dir [default=EPREFIX/lib]])],
|
|
||||||
[rubydir="$withval"], [rubydir="_default_"])
|
|
||||||
|
|
||||||
if test "$rubydir" = "_default_"; then
|
|
||||||
rubydir=${libdir}
|
|
||||||
else
|
|
||||||
rubydir=${rubydir}
|
|
||||||
fi
|
|
||||||
|
|
||||||
RUBYDIR="$rubydir"
|
|
||||||
AC_SUBST([RUBYDIR])
|
|
||||||
|
|
||||||
# Java language binding
|
# Java language binding
|
||||||
jzmq="no"
|
jzmq="no"
|
||||||
AC_ARG_WITH([java], [AS_HELP_STRING([--with-java], [build Java language binding [default=no]])], [with_java=yes], [with_java=no])
|
AC_ARG_WITH([java], [AS_HELP_STRING([--with-java], [build Java language binding [default=no]])], [with_java=yes], [with_java=no])
|
||||||
@ -538,7 +492,7 @@ if test "x$with_perf" != "xno"; then
|
|||||||
perf="yes"
|
perf="yes"
|
||||||
|
|
||||||
if test "x$czmq" = "xno" -a "x$cppzmq" = "xno" -a \
|
if test "x$czmq" = "xno" -a "x$cppzmq" = "xno" -a \
|
||||||
"x$jzmq" = "xno" -a "x$rbzmq" = "xno"; then
|
"x$jzmq" = "xno"; then
|
||||||
AC_MSG_ERROR([the --with-perf option requires at least one language binding.]);
|
AC_MSG_ERROR([the --with-perf option requires at least one language binding.]);
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -548,7 +502,6 @@ if test "x$with_perf" = "xno" -a "x$with_pgm_examples" = "xyes"; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
AM_CONDITIONAL(BUILD_JAVA, test "x$jzmq" = "xyes")
|
AM_CONDITIONAL(BUILD_JAVA, test "x$jzmq" = "xyes")
|
||||||
AM_CONDITIONAL(BUILD_RUBY, test "x$rbzmq" = "xyes")
|
|
||||||
AM_CONDITIONAL(BUILD_C, test "x$czmq" = "xyes")
|
AM_CONDITIONAL(BUILD_C, test "x$czmq" = "xyes")
|
||||||
AM_CONDITIONAL(BUILD_CPP, test "x$cppzmq" = "xyes")
|
AM_CONDITIONAL(BUILD_CPP, test "x$cppzmq" = "xyes")
|
||||||
AM_CONDITIONAL(BUILD_PGM, test "x$pgm_ext" = "xyes")
|
AM_CONDITIONAL(BUILD_PGM, test "x$pgm_ext" = "xyes")
|
||||||
@ -574,9 +527,9 @@ AC_SUBST(LIBZMQ_EXTRA_LDFLAGS)
|
|||||||
AC_TYPE_SIGNAL
|
AC_TYPE_SIGNAL
|
||||||
AC_CHECK_FUNCS(perror gettimeofday memset socket getifaddrs freeifaddrs)
|
AC_CHECK_FUNCS(perror gettimeofday memset socket getifaddrs freeifaddrs)
|
||||||
|
|
||||||
AC_OUTPUT(Makefile src/Makefile doc/Makefile bindings/ruby/Makefile \
|
AC_OUTPUT(Makefile src/Makefile doc/Makefile
|
||||||
bindings/java/Makefile perf/Makefile perf/c/Makefile perf/cpp/Makefile \
|
bindings/java/Makefile perf/Makefile perf/c/Makefile perf/cpp/Makefile \
|
||||||
perf/ruby/Makefile perf/java/Makefile src/libzmq.pc \
|
perf/java/Makefile src/libzmq.pc \
|
||||||
devices/Makefile devices/zmq_forwarder/Makefile \
|
devices/Makefile devices/zmq_forwarder/Makefile \
|
||||||
devices/zmq_streamer/Makefile devices/zmq_queue/Makefile bindings/Makefile)
|
devices/zmq_streamer/Makefile devices/zmq_queue/Makefile bindings/Makefile)
|
||||||
|
|
||||||
@ -605,10 +558,6 @@ AC_MSG_RESULT([ Language bindings:])
|
|||||||
AC_MSG_RESULT([ C: $czmq])
|
AC_MSG_RESULT([ C: $czmq])
|
||||||
AC_MSG_RESULT([ C++: $cppzmq])
|
AC_MSG_RESULT([ C++: $cppzmq])
|
||||||
AC_MSG_RESULT([ Java: $jzmq])
|
AC_MSG_RESULT([ Java: $jzmq])
|
||||||
AC_MSG_RESULT([ Ruby: $rbzmq])
|
|
||||||
if test "x$rbzmq" = "xyes"; then
|
|
||||||
AC_MSG_RESULT([ Ruby library install dir: $rubydir])
|
|
||||||
fi
|
|
||||||
AC_MSG_RESULT([ Transports:])
|
AC_MSG_RESULT([ Transports:])
|
||||||
AC_MSG_RESULT([ tcp: yes])
|
AC_MSG_RESULT([ tcp: yes])
|
||||||
AC_MSG_RESULT([ udp: $pgm_ext])
|
AC_MSG_RESULT([ udp: $pgm_ext])
|
||||||
|
@ -10,9 +10,5 @@ if BUILD_JAVA
|
|||||||
PERF_DIR_J = java
|
PERF_DIR_J = java
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if BUILD_RUBY
|
SUBDIRS = $(PERF_DIR_C) $(PERF_DIR_CPP) $(PERF_DIR_J)
|
||||||
PERF_DIR_R = ruby
|
DIST_SUBDIRS = c cpp java
|
||||||
endif
|
|
||||||
|
|
||||||
SUBDIRS = $(PERF_DIR_C) $(PERF_DIR_CPP) $(PERF_DIR_J) $(PERF_DIR_R)
|
|
||||||
DIST_SUBDIRS = c cpp java ruby
|
|
||||||
|
@ -1 +0,0 @@
|
|||||||
EXTRA_DIST = *.rb
|
|
@ -1,41 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright (c) 2007-2010 iMatix Corporation
|
|
||||||
#
|
|
||||||
# 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/>.
|
|
||||||
|
|
||||||
require 'librbzmq'
|
|
||||||
|
|
||||||
if ARGV.length != 3
|
|
||||||
puts "usage: local_lat <bind-to> <message-size> <roundtrip-count>"
|
|
||||||
Process.exit
|
|
||||||
end
|
|
||||||
|
|
||||||
bind_to = ARGV[0]
|
|
||||||
message_size = ARGV[1].to_i
|
|
||||||
roundtrip_count = ARGV[2].to_i
|
|
||||||
|
|
||||||
ctx = ZMQ::Context.new(1, 1, 0)
|
|
||||||
s = ZMQ::Socket.new(ctx, ZMQ::REP);
|
|
||||||
s.bind(bind_to);
|
|
||||||
|
|
||||||
for i in 0...roundtrip_count do
|
|
||||||
msg = s.recv(0)
|
|
||||||
s.send(msg, 0)
|
|
||||||
end
|
|
||||||
|
|
||||||
sleep 1
|
|
||||||
|
|
||||||
|
|
@ -1,61 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright (c) 2007-2010 iMatix Corporation
|
|
||||||
#
|
|
||||||
# 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/>.
|
|
||||||
|
|
||||||
require 'librbzmq'
|
|
||||||
|
|
||||||
if ARGV.length != 3
|
|
||||||
puts "usage: local_thr <bind-to> <message-size> <message-count>"
|
|
||||||
Process.exit
|
|
||||||
end
|
|
||||||
|
|
||||||
bind_to = ARGV[0]
|
|
||||||
message_size = ARGV[1].to_i
|
|
||||||
message_count = ARGV[2].to_i
|
|
||||||
|
|
||||||
ctx = ZMQ::Context.new(1, 1, 0)
|
|
||||||
s = ZMQ::Socket.new(ctx, ZMQ::SUB);
|
|
||||||
s.setsockopt(ZMQ::SUBSCRIBE, "");
|
|
||||||
|
|
||||||
# Add your socket options here.
|
|
||||||
# For example ZMQ_RATE, ZMQ_RECOVERY_IVL and ZMQ_MCAST_LOOP for PGM.
|
|
||||||
|
|
||||||
s.bind(bind_to);
|
|
||||||
|
|
||||||
msg = s.recv(0)
|
|
||||||
|
|
||||||
start_time = Time.now
|
|
||||||
|
|
||||||
for i in 1...message_count.to_i do
|
|
||||||
msg = s.recv(0)
|
|
||||||
end
|
|
||||||
|
|
||||||
end_time = Time.now
|
|
||||||
|
|
||||||
elapsed = (end_time.to_f - start_time.to_f) * 1000000
|
|
||||||
if elapsed == 0
|
|
||||||
elapsed = 1
|
|
||||||
end
|
|
||||||
|
|
||||||
throughput = message_count * 1000000 / elapsed
|
|
||||||
megabits = throughput * message_size * 8 / 1000000
|
|
||||||
|
|
||||||
puts "message size: %i [B]" % message_size
|
|
||||||
puts "message count: %i" % message_count
|
|
||||||
puts "mean throughput: %i [msg/s]" % throughput
|
|
||||||
puts "mean throughput: %.3f [Mb/s]" % megabits
|
|
||||||
|
|
@ -1,53 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright (c) 2007-2010 iMatix Corporation
|
|
||||||
#
|
|
||||||
# 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/>.
|
|
||||||
|
|
||||||
require 'librbzmq'
|
|
||||||
|
|
||||||
if ARGV.length != 3
|
|
||||||
puts "usage: remote_lat <connect-to> <message-size> <roundtrip-count>"
|
|
||||||
Process.exit
|
|
||||||
end
|
|
||||||
|
|
||||||
connect_to = ARGV[0]
|
|
||||||
message_size = ARGV[1].to_i
|
|
||||||
roundtrip_count = ARGV[2].to_i
|
|
||||||
|
|
||||||
ctx = ZMQ::Context.new(1, 1, 0)
|
|
||||||
s = ZMQ::Socket.new(ctx, ZMQ::REQ);
|
|
||||||
s.connect(connect_to);
|
|
||||||
|
|
||||||
msg = "#{'0'*message_size}"
|
|
||||||
|
|
||||||
start_time = Time.now
|
|
||||||
|
|
||||||
for i in 0...roundtrip_count do
|
|
||||||
s.send(msg, 0)
|
|
||||||
msg = s.recv(0)
|
|
||||||
end
|
|
||||||
|
|
||||||
end_time = Time.now
|
|
||||||
|
|
||||||
elapsed = (end_time.to_f - start_time.to_f) * 1000000
|
|
||||||
latency = elapsed / roundtrip_count / 2
|
|
||||||
|
|
||||||
puts "message size: %i [B]" % message_size
|
|
||||||
puts "roundtrip count: %i" % roundtrip_count
|
|
||||||
puts "mean latency: %.3f [us]" % latency
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,45 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright (c) 2007-2010 iMatix Corporation
|
|
||||||
#
|
|
||||||
# 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/>.
|
|
||||||
|
|
||||||
require 'librbzmq'
|
|
||||||
|
|
||||||
if ARGV.length != 3
|
|
||||||
puts "usage: remote_thr <connect-to> <message-size> <message-count>"
|
|
||||||
Process.exit
|
|
||||||
end
|
|
||||||
|
|
||||||
connect_to = ARGV[0]
|
|
||||||
message_size = ARGV[1].to_i
|
|
||||||
message_count = ARGV[2].to_i
|
|
||||||
|
|
||||||
ctx = ZMQ::Context.new(1, 1, 0)
|
|
||||||
s = ZMQ::Socket.new(ctx, ZMQ::PUB);
|
|
||||||
|
|
||||||
# Add your socket options here.
|
|
||||||
# For example ZMQ_RATE, ZMQ_RECOVERY_IVL and ZMQ_MCAST_LOOP for PGM.
|
|
||||||
|
|
||||||
s.connect(connect_to);
|
|
||||||
|
|
||||||
msg = "#{'0'*message_size}"
|
|
||||||
|
|
||||||
for i in 0...message_count do
|
|
||||||
s.send(msg, 0)
|
|
||||||
end
|
|
||||||
|
|
||||||
sleep 10
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user