summaryrefslogtreecommitdiff
path: root/perf
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@fastmq.commkdir>2009-08-30 15:47:39 +0200
committerMartin Sustrik <sustrik@fastmq.commkdir>2009-08-30 15:47:39 +0200
commit314deb61851a0ddc37228d24e9f4eb106461370a (patch)
tree8039b447b2bc3a48937a2adf69a78aee4ffe2ece /perf
parent6c36673949b2256158e8914119d218dce311c585 (diff)
build system for perf/C and perf/C++
Diffstat (limited to 'perf')
-rw-r--r--perf/Makefile.am2
-rw-r--r--perf/c/Makefile.am20
-rw-r--r--perf/c/local_lat.c2
-rw-r--r--perf/c/local_thr.c19
-rw-r--r--perf/c/remote_lat.c7
-rw-r--r--perf/c/remote_thr.c4
-rw-r--r--perf/cpp/Makefile.am20
-rw-r--r--perf/cpp/local_lat.cpp3
-rw-r--r--perf/cpp/local_thr.cpp10
-rw-r--r--perf/cpp/remote_lat.cpp3
-rw-r--r--perf/cpp/remote_thr.cpp3
11 files changed, 70 insertions, 23 deletions
diff --git a/perf/Makefile.am b/perf/Makefile.am
new file mode 100644
index 0000000..7e87d68
--- /dev/null
+++ b/perf/Makefile.am
@@ -0,0 +1,2 @@
+SUBDIRS = c cpp
+DIST_SUBDIRS = c cpp
diff --git a/perf/c/Makefile.am b/perf/c/Makefile.am
new file mode 100644
index 0000000..6762e66
--- /dev/null
+++ b/perf/c/Makefile.am
@@ -0,0 +1,20 @@
+INCLUDES = -I$(top_builddir)/include
+
+bin_PROGRAMS = local_lat remote_lat local_thr remote_thr
+
+local_lat_LDADD = $(top_builddir)/src/libzmq.la
+local_lat_SOURCES = local_lat.c
+local_lat_CXXFLAGS = -Wall -pedantic -Werror
+
+remote_lat_LDADD = $(top_builddir)/src/libzmq.la
+remote_lat_SOURCES = remote_lat.c
+remote_lat_CXXFLAGS = -Wall -pedantic -Werror
+
+local_thr_LDADD = $(top_builddir)/src/libzmq.la
+local_thr_SOURCES = local_thr.c
+local_thr_CXXFLAGS = -Wall -pedantic -Werror
+
+remote_thr_LDADD = $(top_builddir)/src/libzmq.la
+remote_thr_SOURCES = remote_thr.c
+remote_thr_CXXFLAGS = -Wall -pedantic -Werror
+
diff --git a/perf/c/local_lat.c b/perf/c/local_lat.c
index 707d498..c65d4b3 100644
--- a/perf/c/local_lat.c
+++ b/perf/c/local_lat.c
@@ -32,7 +32,7 @@ int main (int argc, char *argv [])
void *s;
int rc;
int i;
- zmq_msg_t msg;
+ struct zmq_msg_t msg;
if (argc != 4) {
printf ("usage: local_lat <bind-to> <roundtrip-count> "
diff --git a/perf/c/local_thr.c b/perf/c/local_thr.c
index c961410..87c3220 100644
--- a/perf/c/local_thr.c
+++ b/perf/c/local_thr.c
@@ -17,10 +17,11 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <zmq.hpp>
+#include <zmq.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
+#include <stdint.h>
#include <sys/time.h>
int main (int argc, char *argv [])
@@ -32,9 +33,11 @@ int main (int argc, char *argv [])
void *s;
int rc;
int i;
- zmq_msg_t msg;
- long long elapsed;
- long long throughput;
+ struct zmq_msg_t msg;
+ struct timeval start;
+ struct timeval end;
+ uint64_t elapsed;
+ uint64_t throughput;
if (argc != 4) {
printf ("usage: local_thr <bind-to> <message-count> "
@@ -61,7 +64,6 @@ int main (int argc, char *argv [])
assert (rc == 0);
assert (zmq_msg_size (&msg) == message_size);
- timeval start;
rc = gettimeofday (&start, NULL);
assert (rc == 0);
@@ -71,17 +73,16 @@ int main (int argc, char *argv [])
assert (zmq_msg_size (&msg) == message_size);
}
- timeval end;
rc = gettimeofday (&end, NULL);
assert (rc == 0);
end.tv_sec -= start.tv_sec;
start.tv_sec = 0;
- elapsed = (end.tv_sec * 1000000 + end.tv_usec) -
- (start.tv_sec * 1000000 + start.tv_usec);
+ elapsed = ((uint64_t) end.tv_sec * 1000000 + end.tv_usec) -
+ ((uint64_t) start.tv_sec * 1000000 + start.tv_usec);
- throughput = (long long) message_count * 1000000 / elapsed;
+ throughput = (uint64_t) message_count * 1000000 / elapsed;
printf ("message size: %d [B]\n", (int) message_size);
printf ("message count: %d\n", (int) message_count);
diff --git a/perf/c/remote_lat.c b/perf/c/remote_lat.c
index 025c57d..e99da2e 100644
--- a/perf/c/remote_lat.c
+++ b/perf/c/remote_lat.c
@@ -32,7 +32,9 @@ int main (int argc, char *argv [])
void *s;
int rc;
int i;
- zmq_msg_t msg;
+ struct zmq_msg_t msg;
+ struct timeval start;
+ struct timeval end;
double elapsed;
double latency;
@@ -54,7 +56,6 @@ int main (int argc, char *argv [])
rc = zmq_connect (s, connect_to);
assert (rc == 0);
- timeval start;
rc = gettimeofday (&start, NULL);
assert (rc == 0);
@@ -70,8 +71,6 @@ int main (int argc, char *argv [])
assert (rc == 0);
}
-
- timeval end;
rc = gettimeofday (&end, NULL);
assert (rc == 0);
diff --git a/perf/c/remote_thr.c b/perf/c/remote_thr.c
index a30c6f2..d542b1e 100644
--- a/perf/c/remote_thr.c
+++ b/perf/c/remote_thr.c
@@ -17,7 +17,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <zmq.hpp>
+#include <zmq.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -32,7 +32,7 @@ int main (int argc, char *argv [])
void *s;
int rc;
int i;
- zmq_msg_t msg;
+ struct zmq_msg_t msg;
if (argc != 4) {
printf ("usage: remote_thr <connect-to> <message-count> "
diff --git a/perf/cpp/Makefile.am b/perf/cpp/Makefile.am
new file mode 100644
index 0000000..7870943
--- /dev/null
+++ b/perf/cpp/Makefile.am
@@ -0,0 +1,20 @@
+INCLUDES = -I$(top_builddir)/include
+
+bin_PROGRAMS = local_lat remote_lat local_thr remote_thr
+
+local_lat_LDADD = $(top_builddir)/src/libzmq.la
+local_lat_SOURCES = local_lat.cpp
+local_lat_CXXFLAGS = -Wall -pedantic -Werror
+
+remote_lat_LDADD = $(top_builddir)/src/libzmq.la
+remote_lat_SOURCES = remote_lat.cpp
+remote_lat_CXXFLAGS = -Wall -pedantic -Werror
+
+local_thr_LDADD = $(top_builddir)/src/libzmq.la
+local_thr_SOURCES = local_thr.cpp
+local_thr_CXXFLAGS = -Wall -pedantic -Werror
+
+remote_thr_LDADD = $(top_builddir)/src/libzmq.la
+remote_thr_SOURCES = remote_thr.cpp
+remote_thr_CXXFLAGS = -Wall -pedantic -Werror
+
diff --git a/perf/cpp/local_lat.cpp b/perf/cpp/local_lat.cpp
index 3a9afcb..9260f0a 100644
--- a/perf/cpp/local_lat.cpp
+++ b/perf/cpp/local_lat.cpp
@@ -22,6 +22,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <assert.h>
+#include <stddef.h>
int main (int argc, char *argv [])
{
@@ -32,7 +33,7 @@ int main (int argc, char *argv [])
}
const char *bind_to = argv [1];
int roundtrip_count = atoi (argv [2]);
- int message_size = atoi (argv [3]);
+ size_t message_size = (size_t) atoi (argv [3]);
zmq::context_t ctx (1, 1);
diff --git a/perf/cpp/local_thr.cpp b/perf/cpp/local_thr.cpp
index 576ac42..fdcbc8d 100644
--- a/perf/cpp/local_thr.cpp
+++ b/perf/cpp/local_thr.cpp
@@ -21,6 +21,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
+#include <stddef.h>
+#include <stdint.h>
#include <sys/time.h>
int main (int argc, char *argv [])
@@ -32,7 +34,7 @@ int main (int argc, char *argv [])
}
const char *bind_to = argv [1];
int message_count = atoi (argv [2]);
- int message_size = atoi (argv [3]);
+ size_t message_size = (size_t) atoi (argv [3]);
zmq::context_t ctx (1, 1);
@@ -59,10 +61,10 @@ int main (int argc, char *argv [])
end.tv_sec -= start.tv_sec;
start.tv_sec = 0;
- long long elapsed = (end.tv_sec * 1000000 + end.tv_usec) -
- (start.tv_sec * 1000000 + start.tv_usec);
+ uint64_t elapsed = ((uint64_t) end.tv_sec * 1000000 + end.tv_usec) -
+ ((uint64_t) start.tv_sec * 1000000 + start.tv_usec);
- long long throughput = (long long) message_count * 1000000 / elapsed;
+ uint64_t throughput = (uint64_t) message_count * 1000000 / elapsed;
printf ("message size: %d [B]\n", (int) message_size);
printf ("message count: %d\n", (int) message_count);
diff --git a/perf/cpp/remote_lat.cpp b/perf/cpp/remote_lat.cpp
index 9ac758b..3472fd8 100644
--- a/perf/cpp/remote_lat.cpp
+++ b/perf/cpp/remote_lat.cpp
@@ -21,6 +21,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
+#include <stddef.h>
#include <sys/time.h>
int main (int argc, char *argv [])
@@ -32,7 +33,7 @@ int main (int argc, char *argv [])
}
const char *connect_to = argv [1];
int roundtrip_count = atoi (argv [2]);
- int message_size = atoi (argv [3]);
+ size_t message_size = (size_t) atoi (argv [3]);
zmq::context_t ctx (1, 1);
diff --git a/perf/cpp/remote_thr.cpp b/perf/cpp/remote_thr.cpp
index 54536fd..06946f5 100644
--- a/perf/cpp/remote_thr.cpp
+++ b/perf/cpp/remote_thr.cpp
@@ -22,6 +22,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <assert.h>
+#include <stddef.h>
int main (int argc, char *argv [])
{
@@ -32,7 +33,7 @@ int main (int argc, char *argv [])
}
const char *connect_to = argv [1];
int message_count = atoi (argv [2]);
- int message_size = atoi (argv [3]);
+ size_t message_size = (size_t) atoi (argv [3]);
zmq::context_t ctx (1, 1);