diff options
author | William R. Otte <wotte@dre.vanderbilt.edu> | 2008-03-04 14:51:23 +0000 |
---|---|---|
committer | William R. Otte <wotte@dre.vanderbilt.edu> | 2008-03-04 14:51:23 +0000 |
commit | 99aa8c60282c7b8072eb35eb9ac815702f5bf586 (patch) | |
tree | bda96bf8c3a4c2875a083d7b16720533c8ffeaf4 /ACE/performance-tests/RPC | |
parent | c4078c377d74290ebe4e66da0b4975da91732376 (diff) | |
download | ATCD-99aa8c60282c7b8072eb35eb9ac815702f5bf586.tar.gz |
undoing accidental deletion
Diffstat (limited to 'ACE/performance-tests/RPC')
-rw-r--r-- | ACE/performance-tests/RPC/README | 6 | ||||
-rw-r--r-- | ACE/performance-tests/RPC/RPC.mpc | 17 | ||||
-rw-r--r-- | ACE/performance-tests/RPC/client.cpp | 74 | ||||
-rw-r--r-- | ACE/performance-tests/RPC/ping.x | 12 | ||||
-rwxr-xr-x | ACE/performance-tests/RPC/run_test.pl | 34 | ||||
-rw-r--r-- | ACE/performance-tests/RPC/server.c | 15 |
6 files changed, 158 insertions, 0 deletions
diff --git a/ACE/performance-tests/RPC/README b/ACE/performance-tests/RPC/README new file mode 100644 index 00000000000..49b9131733e --- /dev/null +++ b/ACE/performance-tests/RPC/README @@ -0,0 +1,6 @@ +# $Id$ + + Measure latency over RPC, run as: + +$ server +$ client -n <samples> -k host diff --git a/ACE/performance-tests/RPC/RPC.mpc b/ACE/performance-tests/RPC/RPC.mpc new file mode 100644 index 00000000000..feccec74ce5 --- /dev/null +++ b/ACE/performance-tests/RPC/RPC.mpc @@ -0,0 +1,17 @@ +// -*- MPC -*- +// $Id$ + +project(*client) : aceexe, rpc { + source_files { + client.cpp + ping_clnt.c + } +} + +project(*server) : aceexe, rpc { + exename = server + source_files { + server.c + ping_svc.c + } +}
\ No newline at end of file diff --git a/ACE/performance-tests/RPC/client.cpp b/ACE/performance-tests/RPC/client.cpp new file mode 100644 index 00000000000..b3d3982920c --- /dev/null +++ b/ACE/performance-tests/RPC/client.cpp @@ -0,0 +1,74 @@ +/* + * $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* host = 0; + int nsamples = 10000; + int c; + + //FUZZ: disable check_for_lack_ACE_OS + ACE_Get_Opt getopt (argc, argv, "h:i:"); + + while ((c = getopt ()) != -1) + { + //FUZZ: enable check_for_lack_ACE_OS + switch ((char) c) + { + case 'h': + host = getopt.opt_arg (); + break; + + case 'i': + nsamples = ACE_OS::atoi (getopt.opt_arg ()); + break; + } + } + + if (host == 0) + { + ACE_DEBUG ((LM_DEBUG, "Usage: client -h host -i iterations\n")); + return 1; + } + + CLIENT *cl = + clnt_create (host, PINGPROG, PINGVERS, "tcp"); + + if (cl == 0) + { + ACE_DEBUG ((LM_DEBUG, "Cannot create client handle\n")); + return 1; + } + + 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); + + } + + ACE_DEBUG ((LM_DEBUG, "Calibrating high resolution timer . . .")); + ACE_UINT32 gsf = ACE_High_Res_Timer::global_scale_factor (); + ACE_DEBUG ((LM_DEBUG, " done\n")); + + throughput.dump_results ("Client", gsf); + + + return 0; +} diff --git a/ACE/performance-tests/RPC/ping.x b/ACE/performance-tests/RPC/ping.x new file mode 100644 index 00000000000..ea078ffe139 --- /dev/null +++ b/ACE/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/ACE/performance-tests/RPC/run_test.pl b/ACE/performance-tests/RPC/run_test.pl new file mode 100755 index 00000000000..305509dc83a --- /dev/null +++ b/ACE/performance-tests/RPC/run_test.pl @@ -0,0 +1,34 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib '../../bin'; +use PerlACE::Run_Test; + +$SV = new PerlACE::Process ("server"); +$CL = new PerlACE::Process ("client", "-i 10000 -h localhost"); + +$status = 0; + +$SV->Spawn (); + +sleep 5; + +$client = $CL->SpawnWaitKill (60); + +$server = $SV->WaitKill (5); + +if ($server != 0) { + print "ERROR: server returned $server\n"; + $status = 1; +} + +if ($client != 0) { + print "ERROR: client returned $client\n"; + $status = 1; +} + +exit $status; diff --git a/ACE/performance-tests/RPC/server.c b/ACE/performance-tests/RPC/server.c new file mode 100644 index 00000000000..2f8526a6733 --- /dev/null +++ b/ACE/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; +} |