summaryrefslogtreecommitdiff
path: root/perf/c
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@fastmq.commkdir>2009-09-16 11:02:18 +0200
committerMartin Sustrik <sustrik@fastmq.commkdir>2009-09-16 11:02:18 +0200
commit9c522dccaf0b2c8074bd96fbfb4c968f45748ba4 (patch)
treedc57d84016ab8b0d1abbd5291bde434d985ab48a /perf/c
parent6e03cb2f3eb083e1de8e7161d3ab21b52c87eece (diff)
reconnect added to zmq_connecter
Diffstat (limited to 'perf/c')
-rw-r--r--perf/c/remote_lat.c10
1 files changed, 6 insertions, 4 deletions
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 <zmq.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <assert.h>
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);