diff options
Diffstat (limited to 'perf')
| -rw-r--r-- | perf/Makefile.am | 4 | ||||
| -rw-r--r-- | perf/c/local_lat.c | 11 | ||||
| -rw-r--r-- | perf/c/local_thr.c | 10 | ||||
| -rw-r--r-- | perf/c/remote_lat.c | 11 | ||||
| -rw-r--r-- | perf/c/remote_thr.c | 11 | ||||
| -rw-r--r-- | perf/cpp/local_lat.cpp | 8 | ||||
| -rw-r--r-- | perf/cpp/local_thr.cpp | 8 | ||||
| -rw-r--r-- | perf/cpp/remote_lat.cpp | 8 | ||||
| -rw-r--r-- | perf/cpp/remote_thr.cpp | 8 | ||||
| -rw-r--r-- | perf/python/Makefile.am | 5 | ||||
| -rw-r--r-- | perf/python/local_lat.py | 6 | ||||
| -rw-r--r-- | perf/python/remote_lat.py | 4 | ||||
| -rw-r--r-- | perf/python/remote_thr.py | 2 | 
13 files changed, 56 insertions, 40 deletions
diff --git a/perf/Makefile.am b/perf/Makefile.am index 7e87d68..dbebc93 100644 --- a/perf/Makefile.am +++ b/perf/Makefile.am @@ -1,2 +1,2 @@ -SUBDIRS = c cpp -DIST_SUBDIRS = c cpp +SUBDIRS = c cpp python +DIST_SUBDIRS = c cpp python diff --git a/perf/c/local_lat.c b/perf/c/local_lat.c index 81a2e0c..92cfadf 100644 --- a/perf/c/local_lat.c +++ b/perf/c/local_lat.c @@ -35,13 +35,13 @@ int main (int argc, char *argv [])      struct zmq_msg_t msg;      if (argc != 4) { -        printf ("usage: local_lat <bind-to> <roundtrip-count> " -            "<message-size>\n"); +        printf ("usage: local_lat <bind-to> <message-size> " +            "<roundtrip-count>\n");          return 1;      }      bind_to = argv [1]; -    roundtrip_count = atoi (argv [2]); -    message_size = atoi (argv [3]); +    message_size = atoi (argv [2]); +    roundtrip_count = atoi (argv [3]);      ctx = zmq_init (1, 1);      assert (ctx); @@ -68,6 +68,9 @@ int main (int argc, char *argv [])      sleep (1); +    rc = zmq_close (s); +    assert (rc == 0); +      rc = zmq_term (ctx);      assert (rc == 0); diff --git a/perf/c/local_thr.c b/perf/c/local_thr.c index 64c492d..71ed21c 100644 --- a/perf/c/local_thr.c +++ b/perf/c/local_thr.c @@ -41,13 +41,12 @@ int main (int argc, char *argv [])      double megabits;      if (argc != 4) { -        printf ("usage: local_thr <bind-to> <message-count> " -            "<message-size>\n"); +        printf ("usage: local_thr <bind-to> <message-size> <message-count>\n");          return 1;      }      bind_to = argv [1]; -    message_count = atoi (argv [2]); -    message_size = atoi (argv [3]); +    message_size = atoi (argv [2]); +    message_count = atoi (argv [3]);      ctx = zmq_init (1, 1);      assert (ctx); @@ -92,6 +91,9 @@ int main (int argc, char *argv [])      printf ("mean throughput: %d [msg/s]\n", (int) throughput);      printf ("mean throughput: %.3f [Mb/s]\n", (double) megabits); +    rc = zmq_close (s); +    assert (rc == 0); +      rc = zmq_term (ctx);      assert (rc == 0); diff --git a/perf/c/remote_lat.c b/perf/c/remote_lat.c index 32329b8..6da1c42 100644 --- a/perf/c/remote_lat.c +++ b/perf/c/remote_lat.c @@ -39,13 +39,13 @@ int main (int argc, char *argv [])      double latency;      if (argc != 4) { -        printf ("usage: remote_lat <connect-to> <roundtrip-count> " -            "<message-size>\n"); +        printf ("usage: remote_lat <connect-to> <message-size> " +            "<roundtrip-count>\n");          return 1;      }      connect_to = argv [1]; -    roundtrip_count = atoi (argv [2]); -    message_size = atoi (argv [3]); +    message_size = atoi (argv [2]); +    roundtrip_count = atoi (argv [3]);      ctx = zmq_init (1, 1);      assert (ctx); @@ -87,6 +87,9 @@ int main (int argc, char *argv [])      printf ("roundtrip count: %d\n", (int) roundtrip_count);      printf ("average latency: %.3f [us]\n", (double) latency); +    rc = zmq_close (s); +    assert (rc == 0); +      rc = zmq_term (ctx);      assert (rc == 0); diff --git a/perf/c/remote_thr.c b/perf/c/remote_thr.c index 1010bc9..9606d00 100644 --- a/perf/c/remote_thr.c +++ b/perf/c/remote_thr.c @@ -35,13 +35,13 @@ int main (int argc, char *argv [])      struct zmq_msg_t msg;      if (argc != 4) { -        printf ("usage: remote_thr <connect-to> <message-count> " -            "<message-size>\n"); +        printf ("usage: remote_thr <connect-to> <message-size> " +            "<message-count>\n");          return 1;      }      connect_to = argv [1]; -    message_count = atoi (argv [2]); -    message_size = atoi (argv [3]); +    message_size = atoi (argv [2]); +    message_count = atoi (argv [3]);      ctx = zmq_init (1, 1);      assert (ctx); @@ -63,6 +63,9 @@ int main (int argc, char *argv [])      sleep (10); +    rc = zmq_close (s); +    assert (rc == 0); +      rc = zmq_term (ctx);      assert (rc == 0); diff --git a/perf/cpp/local_lat.cpp b/perf/cpp/local_lat.cpp index 9260f0a..343ca74 100644 --- a/perf/cpp/local_lat.cpp +++ b/perf/cpp/local_lat.cpp @@ -27,13 +27,13 @@  int main (int argc, char *argv [])  {      if (argc != 4) { -        printf ("usage: local_lat <bind-to> <roundtrip-count> " -            "<message-size>\n"); +        printf ("usage: local_lat <bind-to> <message-size> " +            "<roundtrip-count>\n");          return 1;      }      const char *bind_to = argv [1]; -    int roundtrip_count = atoi (argv [2]); -    size_t message_size = (size_t) atoi (argv [3]); +    size_t message_size = (size_t) atoi (argv [2]); +    int roundtrip_count = atoi (argv [3]);      zmq::context_t ctx (1, 1); diff --git a/perf/cpp/local_thr.cpp b/perf/cpp/local_thr.cpp index 3e961de..ca81ba9 100644 --- a/perf/cpp/local_thr.cpp +++ b/perf/cpp/local_thr.cpp @@ -28,13 +28,13 @@  int main (int argc, char *argv [])  {      if (argc != 4) { -        printf ("usage: local_thr <bind-to> <message-count> " -            "<message-size>\n"); +        printf ("usage: local_thr <bind-to> <message-size> " +            "<message-count>\n");          return 1;      }      const char *bind_to = argv [1]; -    int message_count = atoi (argv [2]); -    size_t message_size = (size_t) atoi (argv [3]); +    size_t message_size = (size_t) atoi (argv [2]); +    int message_count = atoi (argv [3]);      zmq::context_t ctx (1, 1); diff --git a/perf/cpp/remote_lat.cpp b/perf/cpp/remote_lat.cpp index 169ed1e..c3ded10 100644 --- a/perf/cpp/remote_lat.cpp +++ b/perf/cpp/remote_lat.cpp @@ -27,13 +27,13 @@  int main (int argc, char *argv [])  {      if (argc != 4) { -        printf ("usage: remote_lat <connect-to> <roundtrip-count> " -            "<message-size>\n"); +        printf ("usage: remote_lat <connect-to> <message-size> " +            "<roundtrip-count>\n");          return 1;      }      const char *connect_to = argv [1]; -    int roundtrip_count = atoi (argv [2]); -    size_t message_size = (size_t) atoi (argv [3]); +    size_t message_size = (size_t) atoi (argv [2]); +    int roundtrip_count = atoi (argv [3]);      zmq::context_t ctx (1, 1); diff --git a/perf/cpp/remote_thr.cpp b/perf/cpp/remote_thr.cpp index 06946f5..5474c6a 100644 --- a/perf/cpp/remote_thr.cpp +++ b/perf/cpp/remote_thr.cpp @@ -27,13 +27,13 @@  int main (int argc, char *argv [])  {      if (argc != 4) { -        printf ("usage: remote_thr <connect-to> <message-count> " -            "<message-size>\n"); +        printf ("usage: remote_thr <connect-to> <message-size> " +            "<message-count>\n");          return 1;      }      const char *connect_to = argv [1]; -    int message_count = atoi (argv [2]); -    size_t message_size = (size_t) atoi (argv [3]); +    size_t message_size = (size_t) atoi (argv [2]); +    int message_count = atoi (argv [3]);      zmq::context_t ctx (1, 1); diff --git a/perf/python/Makefile.am b/perf/python/Makefile.am new file mode 100644 index 0000000..cda8477 --- /dev/null +++ b/perf/python/Makefile.am @@ -0,0 +1,5 @@ +EXTRA_DIST = \ +    local_lat.py \ +    remote_lat.py \ +    local_thr.py \ +    remote_thr.py diff --git a/perf/python/local_lat.py b/perf/python/local_lat.py index 7f1503f..e9d46e0 100644 --- a/perf/python/local_lat.py +++ b/perf/python/local_lat.py @@ -23,13 +23,13 @@ import libpyzmq  def main ():      if len (sys.argv) != 4: -        print 'usage: local_lat <bind-to> <roundtrip-count> <message-size>' +        print 'usage: local_lat <bind-to> <message-size> <roundtrip-count>'          sys.exit (1)      try:          bind_to = sys.argv [1] -        roundtrip_count = int (sys.argv [2]) -        message_size = int (sys.argv [3]) +        message_size = int (sys.argv [2]) +        roundtrip_count = int (sys.argv [3])      except (ValueError, OverflowError), e:          print 'message-size and roundtrip-count must be integers'          sys.exit (1) diff --git a/perf/python/remote_lat.py b/perf/python/remote_lat.py index 372f567..f2ee04a 100644 --- a/perf/python/remote_lat.py +++ b/perf/python/remote_lat.py @@ -23,7 +23,7 @@ import libpyzmq  def main ():      if len(sys.argv) != 4: -        print 'usage: remote_lat <connect-to> <roundtrip-count> <message-size>' +        print 'usage: remote_lat <connect-to> <message-size> <roundtrip-count>'          sys.exit (1)      try: @@ -49,7 +49,7 @@ def main ():      end = datetime.now ()      delta = (end - start).microseconds + 1000000 * (end - start).seconds -    latency = delta / roundtrip_count / 2 +    latency = float (delta) / roundtrip_count / 2      print "message size: %.0f [B]" % (message_size, )      print "roundtrip count: %.0f" % (roundtrip_count, ) diff --git a/perf/python/remote_thr.py b/perf/python/remote_thr.py index a80adfd..bab001d 100644 --- a/perf/python/remote_thr.py +++ b/perf/python/remote_thr.py @@ -27,7 +27,7 @@ def main ():          sys.exit (1)      try: -        connect_to = argv [1] +        connect_to = sys.argv [1]          message_size = int (sys.argv [2])          message_count = int (sys.argv [3])      except (ValueError, OverflowError), e:  | 
