summaryrefslogtreecommitdiff
path: root/performance-tests
diff options
context:
space:
mode:
authorcoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-08-23 21:54:22 +0000
committercoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-08-23 21:54:22 +0000
commit3d9ac42b87a7b0b4aa14cfd18cbbd87e811c80dd (patch)
tree996769491b5745165f00d5a37b2b793a842db197 /performance-tests
parent23d9248c90c1a3d5c0dfb7bfe1ca079757c0bd86 (diff)
downloadATCD-3d9ac42b87a7b0b4aa14cfd18cbbd87e811c80dd.tar.gz
ChangeLogTag:Mon Aug 23 16:53:00 1999 Carlos O'Ryan <coryan@cs.wustl.edu>
Diffstat (limited to 'performance-tests')
-rw-r--r--performance-tests/Makefile4
-rw-r--r--performance-tests/RPC/Makefile120
-rw-r--r--performance-tests/RPC/client.cpp72
-rw-r--r--performance-tests/RPC/ping.x12
-rw-r--r--performance-tests/RPC/server.c15
-rw-r--r--performance-tests/TCP/README17
-rw-r--r--performance-tests/TCP/tcp_test.cpp19
7 files changed, 256 insertions, 3 deletions
diff --git a/performance-tests/Makefile b/performance-tests/Makefile
index 4d6cac35d1b..b7f6719b662 100644
--- a/performance-tests/Makefile
+++ b/performance-tests/Makefile
@@ -11,7 +11,9 @@
INFO = README
DIRS = Misc \
- UDP
+ UDP \
+ TCP
+
# @@ This directory is currently under restructuring. It should be
# added back to the makefile once this is done.
# Synch-Benchmarks \
diff --git a/performance-tests/RPC/Makefile b/performance-tests/RPC/Makefile
new file mode 100644
index 00000000000..982bb4f9491
--- /dev/null
+++ b/performance-tests/RPC/Makefile
@@ -0,0 +1,120 @@
+#----------------------------------------------------------------------------
+#
+# $Id$
+#
+#----------------------------------------------------------------------------
+
+#----------------------------------------------------------------------------
+# Local macros
+#----------------------------------------------------------------------------
+
+BIN = client server
+LDLIBS = $(MATHLIB)
+
+BUILD = $(BIN)
+
+CLIENT_OBJS = client.o ping_clnt.o
+SERVER_OBJS = server.o ping_svc.o
+
+# For make depend.
+SRC = client.cpp server.c ping_clnt.c ping_svc.c
+
+#----------------------------------------------------------------------------
+# Include macros and targets
+#----------------------------------------------------------------------------
+
+include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU
+include $(ACE_ROOT)/include/makeinclude/macros.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.common.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.lib.GNU
+include $(ACE_ROOT)/include/makeinclude/rules.local.GNU
+
+#----------------------------------------------------------------------------
+# Local targets
+#----------------------------------------------------------------------------
+
+ping_svc.c ping_clnt.c ping.h: ping.x
+ rpcgen ping.x
+
+server: $(addprefix $(VDIR),$(SERVER_OBJS))
+ $(LINK.c) $(LDFLAGS) -o $@ $^ $(VLDLIBS) $(POSTLINK)
+
+client: $(addprefix $(VDIR),$(CLIENT_OBJS))
+ $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS) $(POSTLINK)
+
+realclean:
+ @$(RM) ping_svc.c ping_clnt.c ping.h
+
+#----------------------------------------------------------------------------
+# Dependencies
+#----------------------------------------------------------------------------
+
+# DO NOT DELETE THIS LINE -- g++dep uses it.
+# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
+
+.obj/client.o .obj/client.so .shobj/client.o .shobj/client.so: client.cpp \
+ $(ACE_ROOT)/ace/Stats.h \
+ $(ACE_ROOT)/ace/ACE.h \
+ $(ACE_ROOT)/ace/OS.h \
+ $(ACE_ROOT)/ace/inc_user_config.h \
+ $(ACE_ROOT)/ace/streams.h \
+ $(ACE_ROOT)/ace/Basic_Types.h \
+ $(ACE_ROOT)/ace/Basic_Types.i \
+ $(ACE_ROOT)/ace/Trace.h \
+ $(ACE_ROOT)/ace/OS.i \
+ $(ACE_ROOT)/ace/Log_Msg.h \
+ $(ACE_ROOT)/ace/Log_Record.h \
+ $(ACE_ROOT)/ace/ACE.i \
+ $(ACE_ROOT)/ace/Log_Priority.h \
+ $(ACE_ROOT)/ace/Log_Record.i \
+ $(ACE_ROOT)/ace/Containers.h \
+ $(ACE_ROOT)/ace/Malloc_Base.h \
+ $(ACE_ROOT)/ace/Containers.i \
+ $(ACE_ROOT)/ace/Containers_T.h \
+ $(ACE_ROOT)/ace/Containers_T.i \
+ $(ACE_ROOT)/ace/Containers_T.cpp \
+ $(ACE_ROOT)/ace/Malloc.h \
+ $(ACE_ROOT)/ace/Malloc.i \
+ $(ACE_ROOT)/ace/Malloc_T.h \
+ $(ACE_ROOT)/ace/Synch.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \
+ $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \
+ $(ACE_ROOT)/ace/Synch.i \
+ $(ACE_ROOT)/ace/Synch_T.h \
+ $(ACE_ROOT)/ace/Event_Handler.h \
+ $(ACE_ROOT)/ace/Event_Handler.i \
+ $(ACE_ROOT)/ace/Synch_T.i \
+ $(ACE_ROOT)/ace/Thread.h \
+ $(ACE_ROOT)/ace/Thread.i \
+ $(ACE_ROOT)/ace/Atomic_Op.i \
+ $(ACE_ROOT)/ace/Synch_T.cpp \
+ $(ACE_ROOT)/ace/Free_List.h \
+ $(ACE_ROOT)/ace/Free_List.i \
+ $(ACE_ROOT)/ace/Free_List.cpp \
+ $(ACE_ROOT)/ace/Malloc_T.i \
+ $(ACE_ROOT)/ace/Malloc_T.cpp \
+ $(ACE_ROOT)/ace/Memory_Pool.h \
+ $(ACE_ROOT)/ace/Signal.h \
+ $(ACE_ROOT)/ace/Signal.i \
+ $(ACE_ROOT)/ace/Object_Manager.h \
+ $(ACE_ROOT)/ace/Object_Manager.i \
+ $(ACE_ROOT)/ace/Managed_Object.h \
+ $(ACE_ROOT)/ace/Managed_Object.i \
+ $(ACE_ROOT)/ace/Managed_Object.cpp \
+ $(ACE_ROOT)/ace/Mem_Map.h \
+ $(ACE_ROOT)/ace/Mem_Map.i \
+ $(ACE_ROOT)/ace/Memory_Pool.i \
+ $(ACE_ROOT)/ace/Stats.i \
+ $(ACE_ROOT)/ace/High_Res_Timer.h \
+ $(ACE_ROOT)/ace/High_Res_Timer.i \
+ $(ACE_ROOT)/ace/Get_Opt.h \
+ $(ACE_ROOT)/ace/Get_Opt.i \
+ ping.h
+.obj/server.o .obj/server.so .shobj/server.o .shobj/server.so: server.c ping.h
+.obj/ping_clnt.o .obj/ping_clnt.so .shobj/ping_clnt.o .shobj/ping_clnt.so: ping_clnt.c ping.h
+.obj/ping_svc.o .obj/ping_svc.so .shobj/ping_svc.o .shobj/ping_svc.so: ping_svc.c ping.h
+
+# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
diff --git a/performance-tests/RPC/client.cpp b/performance-tests/RPC/client.cpp
new file mode 100644
index 00000000000..183c974b828
--- /dev/null
+++ b/performance-tests/RPC/client.cpp
@@ -0,0 +1,72 @@
+/*
+ * $Id$
+ */
+#include "ace/Stats.h"
+#include "ace/High_Res_Timer.h"
+#include "ace/Get_Opt.h"
+
+#include "ping.h"
+
+int main (int argc, char* argv[])
+{
+ const char* key = 0;
+ int nsamples = 10000;
+ int c;
+
+ ACE_Get_Opt getopt (argc, argv, "k:n:");
+
+ while ((c = getopt ()) != -1)
+ {
+ switch ((char) c)
+ {
+ case 'k':
+ key = getopt.optarg;
+ break;
+
+ case 'n':
+ nsamples = ACE_OS::atoi (getopt.optarg);
+ break;
+ }
+ }
+
+ if (key == 0)
+ {
+ ACE_DEBUG ((LM_DEBUG, "Usage: client <server key>\n"));
+ return 1;
+ }
+
+ CLIENT *cl =
+ clnt_create (key, PINGPROG, PINGVERS, "tcp");
+
+ if (cl == 0)
+ {
+ ACE_DEBUG ((LM_DEBUG, "Cannot create client handle\n"));
+ return 1;
+ }
+
+ ACE_DEBUG ((LM_DEBUG, "Calibrating high resolution timer . . ."));
+ ACE_UINT32 gsf = ACE_High_Res_Timer::global_scale_factor ();
+ ACE_DEBUG ((LM_DEBUG, " done\n"));
+
+ ACE_Throughput_Stats throughput;
+
+ ACE_hrtime_t test_start = ACE_OS::gethrtime ();
+ for (int i = 0; i != nsamples; ++i)
+ {
+ ACE_hrtime_t start = ACE_OS::gethrtime ();
+
+ int p = 0;
+ (void) ping_1 (&p, cl);
+
+ ACE_hrtime_t end = ACE_OS::gethrtime ();
+
+ throughput.sample (end - test_start,
+ end - start);
+
+ }
+
+ throughput.dump_results ("Client", gsf);
+
+
+ return 0;
+}
diff --git a/performance-tests/RPC/ping.x b/performance-tests/RPC/ping.x
new file mode 100644
index 00000000000..ea078ffe139
--- /dev/null
+++ b/performance-tests/RPC/ping.x
@@ -0,0 +1,12 @@
+/*
+ * $Id$
+ */
+
+/*
+ * A small program to test RPC round-trip delays.
+ */
+program PINGPROG {
+ version PINGVERS {
+ int PING (int) = 1;
+ } = 1;
+} = 0x20000001;
diff --git a/performance-tests/RPC/server.c b/performance-tests/RPC/server.c
new file mode 100644
index 00000000000..2f8526a6733
--- /dev/null
+++ b/performance-tests/RPC/server.c
@@ -0,0 +1,15 @@
+/*
+ * $Id$
+ */
+
+#include "ping.h"
+#include <rpc/rpc.h>
+#include <stdio.h>
+
+static int return_value = 0;
+
+int* ping_1_svc (int* value, struct svc_req* r)
+{
+ return_value = *value;
+ return &return_value;
+}
diff --git a/performance-tests/TCP/README b/performance-tests/TCP/README
new file mode 100644
index 00000000000..eeb8d65b368
--- /dev/null
+++ b/performance-tests/TCP/README
@@ -0,0 +1,17 @@
+// $Id$
+
+udp_test sends TCP messages and records round-trip latency. The client
+records the latencies and provides nice summary statistics. The server
+simply echos packets back to the client.
+
+To run:
+ 1) On server host:
+ % ./tcp_test -c
+
+ 2) On client host:
+ % ./tcp_test -i 10000 <server host>
+
+The -i option specifies the number of samples (packets to send).
+Other command line options are available: ./tcp_test -? to
+list them.
+
diff --git a/performance-tests/TCP/tcp_test.cpp b/performance-tests/TCP/tcp_test.cpp
index 7a850461dd1..2e28ad7e348 100644
--- a/performance-tests/TCP/tcp_test.cpp
+++ b/performance-tests/TCP/tcp_test.cpp
@@ -54,6 +54,7 @@ static int client = 0;
static int nsamples = DEFITERATIONS;
static int so_bufsz = 0;
static u_int use_reactor = 0;
+static int usecs = 0;
enum {
SELECT = 1,
@@ -70,7 +71,7 @@ usage (void)
" [-v] (Verbose)\n"
" [-m message size]\n"
" [-i iterations]\n"
- // " [-I usdelay]\n"
+ " [-I usdelay]\n"
" [-b socket bufsz] \n"
" [-p port]\n"
" [-s]\n"
@@ -212,6 +213,12 @@ Client::run (void)
ACE_hrtime_t test_start = ACE_OS::gethrtime ();
for (int i = 0; i != nsamples; ++i)
{
+ if (usecs != 0)
+ {
+ ACE_Time_Value tv (0, usecs);
+ ACE_OS::sleep (tv);
+ }
+
ACE_hrtime_t start = ACE_OS::gethrtime ();
if (this->send (sbuf, bufsz) <= 0)
ACE_ERROR_RETURN ((LM_ERROR, "(%P) %p\n", "send"), -1);
@@ -344,7 +351,7 @@ Server::handle_input (ACE_HANDLE)
{
char buf[BUFSIZ];
- ssize_t n = this->endpoint_.recv (buf, sizeof buf);
+ ssize_t n = this->endpoint_.recv (buf, bufsz);
if (n == -1)
ACE_DEBUG ((LM_ERROR,
@@ -523,6 +530,14 @@ main (int argc, char *argv[])
1);
break;
+ case 'I':
+ usecs = ACE_OS::atoi (getopt.optarg);
+ if (usecs < 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "\nInvalid interval value\n\n"),
+ 1);
+ break;
+
case 'a':
use_reactor = SELECT;
break;