summaryrefslogtreecommitdiff
path: root/perf
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@fastmq.commkdir>2009-09-02 14:59:53 +0200
committerMartin Sustrik <sustrik@fastmq.commkdir>2009-09-02 14:59:53 +0200
commitf92de9b2a9ad73fd7cd966e65b5a06b725e779fc (patch)
tree119769a0bf8623e5c266c232eb1ee29cccaaa1af /perf
parent702fdbb5dd6a83e7f656e8d1190e695ebb636765 (diff)
bug during terminal shutdown fixed
Diffstat (limited to 'perf')
-rw-r--r--perf/c/local_lat.c13
-rw-r--r--perf/c/local_thr.c5
-rw-r--r--perf/c/remote_lat.c15
-rw-r--r--perf/c/remote_thr.c3
-rw-r--r--perf/cpp/local_thr.cpp2
-rw-r--r--perf/cpp/remote_lat.cpp2
6 files changed, 28 insertions, 12 deletions
diff --git a/perf/c/local_lat.c b/perf/c/local_lat.c
index c65d4b3..81a2e0c 100644
--- a/perf/c/local_lat.c
+++ b/perf/c/local_lat.c
@@ -52,19 +52,24 @@ int main (int argc, char *argv [])
rc = zmq_bind (s, bind_to);
assert (rc == 0);
+ rc = zmq_msg_init (&msg);
+ assert (rc == 0);
+
for (i = 0; i != roundtrip_count; i++) {
- rc = zmq_msg_init (&msg);
- assert (rc == 0);
rc = zmq_recv (s, &msg, 0);
assert (rc == 0);
assert (zmq_msg_size (&msg) == message_size);
rc = zmq_send (s, &msg, 0);
assert (rc == 0);
- rc = zmq_msg_close (&msg);
- assert (rc == 0);
}
+ rc = zmq_msg_close (&msg);
+ assert (rc == 0);
+
sleep (1);
+ rc = zmq_term (ctx);
+ assert (rc == 0);
+
return 0;
}
diff --git a/perf/c/local_thr.c b/perf/c/local_thr.c
index b58fac3..64c492d 100644
--- a/perf/c/local_thr.c
+++ b/perf/c/local_thr.c
@@ -90,7 +90,10 @@ int main (int argc, char *argv [])
printf ("message size: %d [B]\n", (int) message_size);
printf ("message count: %d\n", (int) message_count);
printf ("mean throughput: %d [msg/s]\n", (int) throughput);
- printf ("mean throughput: %3f [Mb/s]\n", (double) megabits);
+ printf ("mean throughput: %.3f [Mb/s]\n", (double) megabits);
+
+ rc = zmq_term (ctx);
+ assert (rc == 0);
return 0;
}
diff --git a/perf/c/remote_lat.c b/perf/c/remote_lat.c
index e99da2e..32329b8 100644
--- a/perf/c/remote_lat.c
+++ b/perf/c/remote_lat.c
@@ -59,18 +59,20 @@ int main (int argc, char *argv [])
rc = gettimeofday (&start, NULL);
assert (rc == 0);
+ rc = zmq_msg_init_size (&msg, message_size);
+ assert (rc == 0);
+
for (i = 0; i != roundtrip_count; i++) {
- rc = zmq_msg_init_size (&msg, message_size);
- assert (rc == 0);
rc = zmq_send (s, &msg, 0);
assert (rc == 0);
rc = zmq_recv (s, &msg, 0);
assert (rc == 0);
assert (zmq_msg_size (&msg) == message_size);
- rc = zmq_msg_close (&msg);
- assert (rc == 0);
}
+ rc = zmq_msg_close (&msg);
+ assert (rc == 0);
+
rc = gettimeofday (&end, NULL);
assert (rc == 0);
@@ -83,7 +85,10 @@ int main (int argc, char *argv [])
printf ("message size: %d [B]\n", (int) message_size);
printf ("roundtrip count: %d\n", (int) roundtrip_count);
- printf ("average latency: %3f [us]\n", (double) latency);
+ printf ("average latency: %.3f [us]\n", (double) latency);
+
+ rc = zmq_term (ctx);
+ assert (rc == 0);
return 0;
}
diff --git a/perf/c/remote_thr.c b/perf/c/remote_thr.c
index d542b1e..1010bc9 100644
--- a/perf/c/remote_thr.c
+++ b/perf/c/remote_thr.c
@@ -63,5 +63,8 @@ int main (int argc, char *argv [])
sleep (10);
+ rc = zmq_term (ctx);
+ assert (rc == 0);
+
return 0;
}
diff --git a/perf/cpp/local_thr.cpp b/perf/cpp/local_thr.cpp
index e328117..3e961de 100644
--- a/perf/cpp/local_thr.cpp
+++ b/perf/cpp/local_thr.cpp
@@ -71,7 +71,7 @@ int main (int argc, char *argv [])
printf ("message size: %d [B]\n", (int) message_size);
printf ("message count: %d\n", (int) message_count);
printf ("mean throughput: %d [msg/s]\n", (int) throughput);
- printf ("mean throughput: %3f [Mb/s]\n", (double) megabits);
+ printf ("mean throughput: %.3f [Mb/s]\n", (double) megabits);
return 0;
}
diff --git a/perf/cpp/remote_lat.cpp b/perf/cpp/remote_lat.cpp
index 3472fd8..169ed1e 100644
--- a/perf/cpp/remote_lat.cpp
+++ b/perf/cpp/remote_lat.cpp
@@ -64,7 +64,7 @@ int main (int argc, char *argv [])
printf ("message size: %d [B]\n", (int) message_size);
printf ("roundtrip count: %d\n", (int) roundtrip_count);
- printf ("average latency: %3f [us]\n", (double) latency);
+ printf ("average latency: %.3f [us]\n", (double) latency);
return 0;
}