summaryrefslogtreecommitdiff
path: root/TAO/performance-tests/Latency/client.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/performance-tests/Latency/client.cpp')
-rw-r--r--TAO/performance-tests/Latency/client.cpp31
1 files changed, 25 insertions, 6 deletions
diff --git a/TAO/performance-tests/Latency/client.cpp b/TAO/performance-tests/Latency/client.cpp
index 9190bbdaca6..f978698f01f 100644
--- a/TAO/performance-tests/Latency/client.cpp
+++ b/TAO/performance-tests/Latency/client.cpp
@@ -13,10 +13,14 @@ const char *ior = "file://test.ior";
int nthreads = 5;
int niterations = 5;
+int sleep_flag = 0;
+
+ACE_Time_Value sleep_time (0, 10000);
+
int
parse_args (int argc, char *argv[])
{
- ACE_Get_Opt get_opts (argc, argv, "k:n:i:");
+ ACE_Get_Opt get_opts (argc, argv, "k:n:i:s");
int c;
while ((c = get_opts ()) != -1)
@@ -31,6 +35,9 @@ parse_args (int argc, char *argv[])
case 'i':
niterations = ACE_OS::atoi (get_opts.optarg);
break;
+ case 's':
+ sleep_flag = 1;
+ break;
case '?':
default:
ACE_ERROR_RETURN ((LM_ERROR,
@@ -161,8 +168,8 @@ main (int argc, char *argv[])
}
throughput.dump_results ("Aggregated", gsf);
- server->shutdown (ACE_TRY_ENV);
- ACE_TRY_CHECK;
+ // server->shutdown (ACE_TRY_ENV);
+ // ACE_TRY_CHECK;
}
ACE_CATCHANY
{
@@ -204,15 +211,27 @@ Client::svc (void)
for (int i = 0; i < this->niterations_; ++i)
{
+ // Record current time.
ACE_hrtime_t latency_base = ACE_OS::gethrtime ();
- server_->test_method (ACE_TRY_ENV);
- ACE_hrtime_t now = ACE_OS::gethrtime ();
- ACE_TRY_CHECK;
+ // Invoke method.
+ server_->test_method (latency_base,
+ ACE_TRY_ENV);
+ // Grab timestamp again.
+ ACE_hrtime_t now = ACE_OS::gethrtime ();
+
+ // Record statistics.
this->throughput_.sample (now - throughput_base,
now - latency_base);
+ ACE_TRY_CHECK;
+
+ // Sleep for 10 msecs.
+ if (sleep_flag)
+ ACE_OS::sleep (sleep_time);
+
+
if (TAO_debug_level > 0 && i % 100 == 0)
ACE_DEBUG ((LM_DEBUG, "(%P|%t) iteration = %d\n", i));
}