From 9c522dccaf0b2c8074bd96fbfb4c968f45748ba4 Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Wed, 16 Sep 2009 11:02:18 +0200 Subject: reconnect added to zmq_connecter --- perf/c/remote_lat.c | 10 ++++++---- perf/cpp/remote_lat.cpp | 5 ++++- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'perf') diff --git a/perf/c/remote_lat.c b/perf/c/remote_lat.c index 23695b4..15dfc46 100644 --- a/perf/c/remote_lat.c +++ b/perf/c/remote_lat.c @@ -20,6 +20,7 @@ #include #include #include +#include #include int main (int argc, char *argv []) @@ -54,10 +55,11 @@ int main (int argc, char *argv []) rc = zmq_connect (s, connect_to); assert (rc == 0); - watch = zmq_stopwatch_start (); - rc = zmq_msg_init_size (&msg, message_size); assert (rc == 0); + memset (zmq_msg_data (&msg), 0, message_size); + + watch = zmq_stopwatch_start (); for (i = 0; i != roundtrip_count; i++) { rc = zmq_send (s, &msg, 0); @@ -67,11 +69,11 @@ int main (int argc, char *argv []) assert (zmq_msg_size (&msg) == message_size); } + elapsed = zmq_stopwatch_stop (watch); + rc = zmq_msg_close (&msg); assert (rc == 0); - elapsed = zmq_stopwatch_stop (watch); - latency = (double) elapsed / (roundtrip_count * 2); printf ("message size: %d [B]\n", (int) message_size); diff --git a/perf/cpp/remote_lat.cpp b/perf/cpp/remote_lat.cpp index f1d2a17..f6ccbb4 100644 --- a/perf/cpp/remote_lat.cpp +++ b/perf/cpp/remote_lat.cpp @@ -22,6 +22,7 @@ #include #include #include +#include int main (int argc, char *argv []) { @@ -39,10 +40,12 @@ int main (int argc, char *argv []) zmq::socket_t s (ctx, ZMQ_REQ); s.connect (connect_to); + zmq::message_t msg (message_size); + memset (msg.data (), 0, message_size); + void *watch = zmq_stopwatch_start (); for (int i = 0; i != roundtrip_count; i++) { - zmq::message_t msg (message_size); s.send (msg); s.recv (&msg); assert (msg.size () == message_size); -- cgit v1.2.3