summaryrefslogtreecommitdiff
path: root/performance-tests/RPC/client.cpp
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/RPC/client.cpp
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/RPC/client.cpp')
-rw-r--r--performance-tests/RPC/client.cpp72
1 files changed, 72 insertions, 0 deletions
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;
+}