Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / performance-tests / Latency / Thread_Per_Connection / Client_Task.cpp
blob9c766855f4c5a58bf35c41d7a201e2b9422f110a
1 #include "Client_Task.h"
2 #include "ace/OS_NS_time.h"
4 Client_Task::Client_Task (Test::Roundtrip_ptr roundtrip,
5 int niterations)
6 : roundtrip_ (Test::Roundtrip::_duplicate (roundtrip))
7 , niterations_ (niterations)
11 int
12 Client_Task::svc ()
14 try
16 this->validate_connection ();
18 for (int i = 0; i != this->niterations_; ++i)
20 ACE_hrtime_t start = ACE_OS::gethrtime ();
22 (void) this->roundtrip_->test_method (start);
24 ACE_hrtime_t now = ACE_OS::gethrtime ();
25 this->latency_.sample (now - start);
28 catch (const CORBA::Exception&)
30 return 0;
32 return 0;
35 void
36 Client_Task::accumulate_and_dump (
37 ACE_Basic_Stats &totals,
38 const ACE_TCHAR *msg,
39 ACE_High_Res_Timer::global_scale_factor_type gsf)
41 totals.accumulate (this->latency_);
42 this->latency_.dump_results (msg, gsf);
45 void
46 Client_Task::validate_connection ()
48 CORBA::ULongLong dummy = 0;
49 for (int i = 0; i != 100; ++i)
51 try
53 (void) this->roundtrip_->test_method (dummy);
55 catch (const CORBA::Exception&){}