diff options
author | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-07-22 21:54:03 +0000 |
---|---|---|
committer | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-07-22 21:54:03 +0000 |
commit | 05568cf38d1afabc44c718dc19fb7b8763c5b836 (patch) | |
tree | 1458d8c142987994d6e99b00923a262a2b935652 /TAO | |
parent | 696a37c97fc2a59ee04700e326889309d435ea38 (diff) | |
download | ATCD-05568cf38d1afabc44c718dc19fb7b8763c5b836.tar.gz |
ChangeLogTag:Thu Jul 22 15:05:21 1999 Carlos O'Ryan <coryan@cs.wustl.edu>
Diffstat (limited to 'TAO')
-rw-r--r-- | TAO/ChangeLog-99c | 17 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/Event/Basic/Reconnect.cpp | 24 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/Event/Basic/Reconnect.h | 4 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/Event/Performance/Connect.cpp | 59 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/Event/Performance/Connect.h | 19 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/Event/Performance/Makefile | 22 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/Event/lib/Consumer.cpp | 19 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/Event/lib/Consumer.h | 12 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/Event/lib/Driver.cpp | 130 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/Event/lib/Driver.h | 67 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/Event/lib/Driver.i | 59 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/Event/lib/Makefile | 27 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/Event/lib/Supplier.cpp | 22 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/Event/lib/Supplier.h | 10 |
14 files changed, 164 insertions, 327 deletions
diff --git a/TAO/ChangeLog-99c b/TAO/ChangeLog-99c index a77bfcd31da..f9cd258ba8c 100644 --- a/TAO/ChangeLog-99c +++ b/TAO/ChangeLog-99c @@ -9,6 +9,23 @@ Thu Jul 22 15:05:21 1999 Carlos O'Ryan <coryan@cs.wustl.edu> even when there is no timeout. Thanks to Irfan for pointing this out. + * orbsvcs/tests/Event/lib/Makefile: + * orbsvcs/tests/Event/lib/Consumer.h: + * orbsvcs/tests/Event/lib/Consumer.cpp: + * orbsvcs/tests/Event/lib/Driver.h: + * orbsvcs/tests/Event/lib/Driver.i: + * orbsvcs/tests/Event/lib/Driver.cpp: + * orbsvcs/tests/Event/lib/Supplier.h: + * orbsvcs/tests/Event/lib/Supplier.cpp: + * orbsvcs/tests/Event/Basic/Reconnect.h: + * orbsvcs/tests/Event/Basic/Reconnect.cpp: + * orbsvcs/tests/Event/Performance/Makefile: + * orbsvcs/tests/Event/Performance/Connect.h: + * orbsvcs/tests/Event/Performance/Connect.cpp: + Changed to use the ACE_Throughput_Stats class, this is more + portable and works on platforms without 64-bit support, thanks + to David Levine for pointing this out. + Thu Jul 22 14:10:47 1999 David L. Levine <levine@cs.wustl.edu> * orbsvcs/tests/AVStreams/benchmark/client.cpp: diff --git a/TAO/orbsvcs/tests/Event/Basic/Reconnect.cpp b/TAO/orbsvcs/tests/Event/Basic/Reconnect.cpp index 2f9c403cd6a..bb629b804e8 100644 --- a/TAO/orbsvcs/tests/Event/Basic/Reconnect.cpp +++ b/TAO/orbsvcs/tests/Event/Basic/Reconnect.cpp @@ -5,6 +5,7 @@ #include "Supplier.h" #include "orbsvcs/Event/EC_Event_Channel.h" #include "ace/Get_Opt.h" +#include "ace/High_Res_Timer.h" ACE_RCSID(EC_Tests_Basic, Reconnect, "$Id$") @@ -90,12 +91,11 @@ void EC_Reconnect::execute_test (CORBA::Environment& ACE_TRY_ENV) { this->execute_consumer_test (ACE_TRY_ENV); - this->execute_supplier_test (ACE_TRY_ENV); - this->consumer_reconnect_.dump_results ("Reconnect", "consumer"); - - this->supplier_reconnect_.dump_results ("Reconnect", "supplier"); + ACE_UINT32 gsf = ACE_High_Res_Timer::global_scale_factor (); + this->consumer_reconnect_.dump_results ("Reconnect/consumer", gsf); + this->supplier_reconnect_.dump_results ("Reconnect/supplier", gsf); // this->EC_Driver::execute_test (ACE_TRY_ENV); } @@ -115,6 +115,7 @@ EC_Reconnect::execute_consumer_test (CORBA::Environment& ACE_TRY_ENV) if (this->allow_consumer_reconnect_) { + ACE_hrtime_t start_time = ACE_OS::gethrtime (); for (int i = 0; i < this->disconnections_; ++i) { ACE_hrtime_t start = ACE_OS::gethrtime (); @@ -123,7 +124,8 @@ EC_Reconnect::execute_consumer_test (CORBA::Environment& ACE_TRY_ENV) ACE_TRY_ENV); ACE_CHECK; ACE_hrtime_t stop = ACE_OS::gethrtime (); - this->consumer_reconnect_.sample (stop - start); + this->consumer_reconnect_.sample (stop - start_time, + stop - start); } } else @@ -152,6 +154,7 @@ EC_Reconnect::execute_consumer_test (CORBA::Environment& ACE_TRY_ENV) this->event_channel_->for_consumers (ACE_TRY_ENV); ACE_CHECK; + ACE_hrtime_t start_time = ACE_OS::gethrtime (); for (int i = 0; i < this->disconnections_; ++i) { ACE_hrtime_t start = ACE_OS::gethrtime (); @@ -163,7 +166,8 @@ EC_Reconnect::execute_consumer_test (CORBA::Environment& ACE_TRY_ENV) ACE_TRY_ENV); ACE_CHECK; ACE_hrtime_t stop = ACE_OS::gethrtime (); - this->consumer_reconnect_.sample (stop - start); + this->consumer_reconnect_.sample (stop - start_time, + stop - start); } } } @@ -178,6 +182,7 @@ EC_Reconnect::execute_supplier_test (CORBA::Environment& ACE_TRY_ENV) if (this->allow_supplier_reconnect_) { + ACE_hrtime_t start_time = ACE_OS::gethrtime (); for (int i = 0; i < this->disconnections_; ++i) { ACE_hrtime_t start = ACE_OS::gethrtime (); @@ -185,7 +190,8 @@ EC_Reconnect::execute_supplier_test (CORBA::Environment& ACE_TRY_ENV) ACE_TRY_ENV); ACE_CHECK; ACE_hrtime_t stop = ACE_OS::gethrtime (); - this->supplier_reconnect_.sample (stop - start); + this->supplier_reconnect_.sample (stop - start_time, + stop - start); } } else @@ -213,6 +219,7 @@ EC_Reconnect::execute_supplier_test (CORBA::Environment& ACE_TRY_ENV) this->event_channel_->for_suppliers (ACE_TRY_ENV); ACE_CHECK; + ACE_hrtime_t start_time = ACE_OS::gethrtime (); for (int i = 0; i < this->disconnections_; ++i) { ACE_hrtime_t start = ACE_OS::gethrtime (); @@ -224,7 +231,8 @@ EC_Reconnect::execute_supplier_test (CORBA::Environment& ACE_TRY_ENV) ACE_TRY_ENV); ACE_CHECK; ACE_hrtime_t stop = ACE_OS::gethrtime (); - this->supplier_reconnect_.sample (stop - start); + this->supplier_reconnect_.sample (stop - start_time, + stop - start); } } } diff --git a/TAO/orbsvcs/tests/Event/Basic/Reconnect.h b/TAO/orbsvcs/tests/Event/Basic/Reconnect.h index 9e98eee77df..66cfbdca3a6 100644 --- a/TAO/orbsvcs/tests/Event/Basic/Reconnect.h +++ b/TAO/orbsvcs/tests/Event/Basic/Reconnect.h @@ -72,8 +72,8 @@ private: int disconnections_; // The number of disconnections - EC_Driver::Latency_Stats consumer_reconnect_; - EC_Driver::Latency_Stats supplier_reconnect_; + ACE_Throughput_Stats consumer_reconnect_; + ACE_Throughput_Stats supplier_reconnect_; }; #endif /* EC_RECONNECT_H */ diff --git a/TAO/orbsvcs/tests/Event/Performance/Connect.cpp b/TAO/orbsvcs/tests/Event/Performance/Connect.cpp index b2d18032e20..d9cba9424f4 100644 --- a/TAO/orbsvcs/tests/Event/Performance/Connect.cpp +++ b/TAO/orbsvcs/tests/Event/Performance/Connect.cpp @@ -5,6 +5,7 @@ #include "Supplier.h" #include "orbsvcs/Event/EC_Event_Channel.h" #include "ace/Arg_Shifter.h" +#include "ace/High_Res_Timer.h" ACE_RCSID(EC_Tests_Performance, Connect, "$Id$") @@ -96,9 +97,10 @@ EC_Connect::print_args (void) const void EC_Connect::dump_results (void) { + ACE_UINT32 gsf = ACE_High_Res_Timer::global_scale_factor (); ACE_DEBUG ((LM_DEBUG, "\nConnect time:\n")); - this->consumer_connect_.dump_results ("Consumer", "connect"); - this->supplier_connect_.dump_results ("Supplier", "connect"); + this->consumer_connect_.dump_results ("Consumer/connect", gsf); + this->supplier_connect_.dump_results ("Supplier/connect", gsf); ACE_DEBUG ((LM_DEBUG, "\nDisconnect time:\n")); } @@ -114,7 +116,8 @@ EC_Connect::connect_consumer ( i, ACE_TRY_ENV); ACE_hrtime_t now = ACE_OS::gethrtime (); - this->consumer_connect_.sample (now - start); + this->consumer_connect_.sample (now - this->start_time_, + now - start); } void @@ -128,7 +131,8 @@ EC_Connect::connect_supplier ( i, ACE_TRY_ENV); ACE_hrtime_t now = ACE_OS::gethrtime (); - this->supplier_connect_.sample (now - start); + this->supplier_connect_.sample (now - this->start_time_, + now - start); } EC_Consumer* @@ -146,6 +150,7 @@ EC_Connect::allocate_supplier (int i) void EC_Connect::connect_clients (CORBA::Environment &ACE_TRY_ENV) { + this->start_time_ = ACE_OS::gethrtime (); switch (this->order_) { default: @@ -231,6 +236,7 @@ EC_Connect::disconnect_clients (CORBA::Environment &ACE_TRY_ENV) this->event_channel_->for_suppliers (ACE_TRY_ENV); ACE_CHECK; + ACE_hrtime_t start_time = ACE_OS::gethrtime (); for (int i = 0; i != max; ++i) { if (i < this->n_suppliers_) @@ -241,7 +247,8 @@ EC_Connect::disconnect_clients (CORBA::Environment &ACE_TRY_ENV) ACE_CHECK; ACE_hrtime_t now = ACE_OS::gethrtime (); - this->supplier_disconnect_.sample (now - start); + this->supplier_disconnect_.sample (now - start_time, + now - start); } if (i < this->n_consumers_) { @@ -251,16 +258,19 @@ EC_Connect::disconnect_clients (CORBA::Environment &ACE_TRY_ENV) ACE_CHECK; ACE_hrtime_t now = ACE_OS::gethrtime (); - this->consumer_disconnect_.sample (now - start); + this->consumer_disconnect_.sample (now - start_time, + now - start); } } - this->consumer_disconnect_.dump_results ("Consumer", "disconnect"); - this->supplier_disconnect_.dump_results ("Supplier", "disconnect"); + ACE_UINT32 gsf = ACE_High_Res_Timer::global_scale_factor (); + this->consumer_disconnect_.dump_results ("Consumer/disconnect", gsf); + this->supplier_disconnect_.dump_results ("Supplier/disconnect", gsf); } void EC_Connect::disconnect_consumers (CORBA::Environment &ACE_TRY_ENV) { + ACE_hrtime_t start_time = ACE_OS::gethrtime (); for (int i = 0; i < this->n_consumers_; ++i) { ACE_hrtime_t start = ACE_OS::gethrtime (); @@ -269,9 +279,12 @@ EC_Connect::disconnect_consumers (CORBA::Environment &ACE_TRY_ENV) ACE_CHECK; ACE_hrtime_t now = ACE_OS::gethrtime (); - this->consumer_disconnect_.sample (now - start); + this->consumer_disconnect_.sample (now - start_time, + now - start); } - this->consumer_disconnect_.dump_results ("Consumer", "disconnect"); + ACE_UINT32 gsf = ACE_High_Res_Timer::global_scale_factor (); + this->consumer_disconnect_.dump_results ("Consumer/disconnect", + gsf); if (this->verbose ()) ACE_DEBUG ((LM_DEBUG, "EC_Connect (%P|%t) consumers disconnected\n")); } @@ -279,6 +292,7 @@ EC_Connect::disconnect_consumers (CORBA::Environment &ACE_TRY_ENV) void EC_Connect::disconnect_suppliers (CORBA::Environment &ACE_TRY_ENV) { + ACE_hrtime_t start_time = ACE_OS::gethrtime (); for (int i = 0; i < this->n_suppliers_; ++i) { ACE_hrtime_t start = ACE_OS::gethrtime (); @@ -287,9 +301,12 @@ EC_Connect::disconnect_suppliers (CORBA::Environment &ACE_TRY_ENV) ACE_CHECK; ACE_hrtime_t now = ACE_OS::gethrtime (); - this->supplier_disconnect_.sample (now - start); + this->supplier_disconnect_.sample (now - start_time, + now - start); } - this->supplier_disconnect_.dump_results ("Supplier", "disconnect"); + ACE_UINT32 gsf = ACE_High_Res_Timer::global_scale_factor (); + this->supplier_disconnect_.dump_results ("Supplier/disconnect", + gsf); if (this->verbose ()) ACE_DEBUG ((LM_DEBUG, "EC_Connect (%P|%t) suppliers disconnected\n")); } @@ -326,14 +343,15 @@ ECC_Consumer::connect ( shutdown_event_type, ACE_TRY_ENV); ACE_hrtime_t now = ACE_OS::gethrtime (); - this->connect_time_.sample (now - start); + this->connect_time_.sample (now, now - start); } void -ECC_Consumer::dump_results (const char* name) +ECC_Consumer::dump_results (const char* name, + ACE_UINT32 gsf) { - this->connect_time_.dump_results ("EC_Consumers/connect", name); - this->EC_Consumer::dump_results (name); + this->connect_time_.dump_results (name, gsf); + this->EC_Consumer::dump_results (name, gsf); } // **************************************************************** @@ -367,14 +385,15 @@ ECC_Supplier::connect ( shutdown_event_type, ACE_TRY_ENV); ACE_hrtime_t now = ACE_OS::gethrtime (); - this->connect_time_.sample (now - start); + this->connect_time_.sample (now, now - start); } void -ECC_Supplier::dump_results (const char* name) +ECC_Supplier::dump_results (const char* name, + ACE_UINT32 gsf) { - this->connect_time_.dump_results ("EC_Suppliers/connect", name); - this->EC_Supplier::dump_results (name); + this->connect_time_.dump_results (name, gsf); + this->EC_Supplier::dump_results (name, gsf); } diff --git a/TAO/orbsvcs/tests/Event/Performance/Connect.h b/TAO/orbsvcs/tests/Event/Performance/Connect.h index e69412ec32f..1b58133482e 100644 --- a/TAO/orbsvcs/tests/Event/Performance/Connect.h +++ b/TAO/orbsvcs/tests/Event/Performance/Connect.h @@ -74,10 +74,11 @@ public: virtual void disconnect_clients (CORBA::Environment&); private: - EC_Driver::Latency_Stats consumer_connect_; - EC_Driver::Latency_Stats supplier_connect_; - EC_Driver::Latency_Stats consumer_disconnect_; - EC_Driver::Latency_Stats supplier_disconnect_; + ACE_hrtime_t start_time_; + ACE_Throughput_Stats consumer_connect_; + ACE_Throughput_Stats supplier_connect_; + ACE_Throughput_Stats consumer_disconnect_; + ACE_Throughput_Stats supplier_disconnect_; int order_; // What is connected first? @@ -99,10 +100,11 @@ public: const RtecEventChannelAdmin::ConsumerQOS& qos, int shutdown_event_type, CORBA::Environment &ACE_TRY_ENV); - virtual void dump_results (const char* name); + virtual void dump_results (const char* name, + ACE_UINT32 global_scale_factor); private: - EC_Driver::Latency_Stats connect_time_; + ACE_Throughput_Stats connect_time_; }; // **************************************************************** @@ -121,10 +123,11 @@ public: const RtecEventChannelAdmin::SupplierQOS& qos, int shutdown_event_type, CORBA::Environment &ACE_TRY_ENV); - virtual void dump_results (const char* name); + virtual void dump_results (const char* name, + ACE_UINT32 global_scale_factor); private: - EC_Driver::Latency_Stats connect_time_; + ACE_Throughput_Stats connect_time_; }; #endif /* EC_CONNECT_H */ diff --git a/TAO/orbsvcs/tests/Event/Performance/Makefile b/TAO/orbsvcs/tests/Event/Performance/Makefile index 99962528d43..a7c67c15e12 100644 --- a/TAO/orbsvcs/tests/Event/Performance/Makefile +++ b/TAO/orbsvcs/tests/Event/Performance/Makefile @@ -184,6 +184,9 @@ endif $(TAO_ROOT)/tao/Sequence_T.h \ $(TAO_ROOT)/tao/Sequence_T.i \ $(TAO_ROOT)/tao/Sequence_T.cpp \ + $(TAO_ROOT)/tao/varout.h \ + $(TAO_ROOT)/tao/varout.i \ + $(TAO_ROOT)/tao/varout.cpp \ $(TAO_ROOT)/tao/Services.i \ $(TAO_ROOT)/tao/IORManipulation.h \ $(TAO_ROOT)/tao/IORS.h \ @@ -213,9 +216,6 @@ endif $(TAO_ROOT)/tao/GIOP.h \ $(TAO_ROOT)/tao/GIOP.i \ $(TAO_ROOT)/tao/Server_Request.i \ - $(TAO_ROOT)/tao/varout.h \ - $(TAO_ROOT)/tao/varout.i \ - $(TAO_ROOT)/tao/varout.cpp \ $(TAO_ROOT)/tao/Marshal.h \ $(TAO_ROOT)/tao/Marshal.i \ $(TAO_ROOT)/tao/singletons.h \ @@ -268,6 +268,7 @@ endif $(TAO_ROOT)/tao/MessagingC.h \ $(TAO_ROOT)/tao/IOPC.h \ $(TAO_ROOT)/tao/IOPC.i \ + $(TAO_ROOT)/tao/PollableC.h \ $(TAO_ROOT)/tao/MessagingC.i \ $(TAO_ROOT)/tao/MessagingS.i \ $(TAO_ROOT)/tao/Stub.i \ @@ -343,6 +344,8 @@ endif $(TAO_ROOT)/orbsvcs/orbsvcs/RtecEventChannelAdminS_T.i \ $(TAO_ROOT)/orbsvcs/orbsvcs/RtecEventChannelAdminS_T.cpp \ $(TAO_ROOT)/orbsvcs/orbsvcs/RtecEventChannelAdminS.i \ + $(ACE_ROOT)/ace/Stats.h \ + $(ACE_ROOT)/ace/Stats.i \ ../lib/Driver.i ../lib/Consumer.h ../lib/Supplier.h \ $(ACE_ROOT)/ace/Task.h \ $(ACE_ROOT)/ace/Task.i \ @@ -490,6 +493,9 @@ endif $(TAO_ROOT)/tao/Sequence_T.h \ $(TAO_ROOT)/tao/Sequence_T.i \ $(TAO_ROOT)/tao/Sequence_T.cpp \ + $(TAO_ROOT)/tao/varout.h \ + $(TAO_ROOT)/tao/varout.i \ + $(TAO_ROOT)/tao/varout.cpp \ $(TAO_ROOT)/tao/Services.i \ $(TAO_ROOT)/tao/IORManipulation.h \ $(TAO_ROOT)/tao/IORS.h \ @@ -519,9 +525,6 @@ endif $(TAO_ROOT)/tao/GIOP.h \ $(TAO_ROOT)/tao/GIOP.i \ $(TAO_ROOT)/tao/Server_Request.i \ - $(TAO_ROOT)/tao/varout.h \ - $(TAO_ROOT)/tao/varout.i \ - $(TAO_ROOT)/tao/varout.cpp \ $(TAO_ROOT)/tao/Marshal.h \ $(TAO_ROOT)/tao/Marshal.i \ $(TAO_ROOT)/tao/singletons.h \ @@ -574,6 +577,7 @@ endif $(TAO_ROOT)/tao/MessagingC.h \ $(TAO_ROOT)/tao/IOPC.h \ $(TAO_ROOT)/tao/IOPC.i \ + $(TAO_ROOT)/tao/PollableC.h \ $(TAO_ROOT)/tao/MessagingC.i \ $(TAO_ROOT)/tao/MessagingS.i \ $(TAO_ROOT)/tao/Stub.i \ @@ -649,6 +653,8 @@ endif $(TAO_ROOT)/orbsvcs/orbsvcs/RtecEventChannelAdminS_T.i \ $(TAO_ROOT)/orbsvcs/orbsvcs/RtecEventChannelAdminS_T.cpp \ $(TAO_ROOT)/orbsvcs/orbsvcs/RtecEventChannelAdminS.i \ + $(ACE_ROOT)/ace/Stats.h \ + $(ACE_ROOT)/ace/Stats.i \ ../lib/Driver.i ../lib/Supplier.h \ $(ACE_ROOT)/ace/Task.h \ $(ACE_ROOT)/ace/Task.i \ @@ -666,6 +672,8 @@ endif $(TAO_ROOT)/orbsvcs/orbsvcs/Event/EC_Factory.i \ $(TAO_ROOT)/orbsvcs/orbsvcs/Event/EC_Defaults.h \ $(TAO_ROOT)/orbsvcs/orbsvcs/Event/EC_Event_Channel.i \ - $(ACE_ROOT)/ace/Arg_Shifter.h + $(ACE_ROOT)/ace/Arg_Shifter.h \ + $(ACE_ROOT)/ace/High_Res_Timer.h \ + $(ACE_ROOT)/ace/High_Res_Timer.i # IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/TAO/orbsvcs/tests/Event/lib/Consumer.cpp b/TAO/orbsvcs/tests/Event/lib/Consumer.cpp index 0622ed6eb4e..91488dba4fe 100644 --- a/TAO/orbsvcs/tests/Event/lib/Consumer.cpp +++ b/TAO/orbsvcs/tests/Event/lib/Consumer.cpp @@ -89,18 +89,16 @@ EC_Consumer::shutdown (CORBA::Environment &ACE_TRY_ENV) } void -EC_Consumer::dump_results (const char* name) +EC_Consumer::dump_results (const char* name, + ACE_UINT32 gsf) { - this->throughput_.dump_results ("EC_Consumers", name); - this->latency_.dump_results ("EC_Consumers", name); + this->throughput_.dump_results (name, gsf); } void -EC_Consumer::accumulate (EC_Driver::Throughput_Stats& throughput, - EC_Driver::Latency_Stats& latency) const +EC_Consumer::accumulate (ACE_Throughput_Stats& throughput) const { throughput.accumulate (this->throughput_); - latency.accumulate (this->latency_); } void @@ -119,10 +117,7 @@ EC_Consumer::push (const RtecEventComm::EventSet& events, ACE_GUARD (ACE_SYNCH_MUTEX, ace_mon, this->lock_); if (this->push_count_ == 0) - this->throughput_.start (); - - // We start the timer as soon as we receive the first event... - this->throughput_.sample (); + this->throughput_start_ = ACE_OS::gethrtime (); this->push_count_ += events.length (); @@ -143,8 +138,8 @@ EC_Consumer::push (const RtecEventComm::EventSet& events, e.header.creation_time); const ACE_hrtime_t now = ACE_OS::gethrtime (); - const ACE_hrtime_t elapsed = now - creation; - this->latency_.sample (elapsed); + this->throughput_.sample (now - this->throughput_start_, + now - creation); if (e.header.type == this->shutdown_event_type_) this->driver_->consumer_shutdown (this->cookie_, ACE_TRY_ENV); diff --git a/TAO/orbsvcs/tests/Event/lib/Consumer.h b/TAO/orbsvcs/tests/Event/lib/Consumer.h index 68231280d09..2679cf51e29 100644 --- a/TAO/orbsvcs/tests/Event/lib/Consumer.h +++ b/TAO/orbsvcs/tests/Event/lib/Consumer.h @@ -70,11 +70,11 @@ public: void shutdown (CORBA::Environment &ACE_TRY_ENV); // The application is shutting down, deactivate the consumer. - void accumulate (EC_Driver::Throughput_Stats& throughput, - EC_Driver::Latency_Stats& latency) const; + void accumulate (ACE_Throughput_Stats& throughput) const; // Accumulate our statistics to the totals. - virtual void dump_results (const char* name); + virtual void dump_results (const char* name, + ACE_UINT32 global_scale_factor); // Printout the statistics // = The RtecEventComm::PushConsumer methods @@ -100,10 +100,10 @@ private: ACE_SYNCH_MUTEX lock_; // Protect internal state - EC_Driver::Throughput_Stats throughput_; - // Used for reporting stats + ACE_hrtime_t throughput_start_; + // The timestamp for the first message received - EC_Driver::Latency_Stats latency_; + ACE_Throughput_Stats throughput_; // Used for reporting stats int push_count_; diff --git a/TAO/orbsvcs/tests/Event/lib/Driver.cpp b/TAO/orbsvcs/tests/Event/lib/Driver.cpp index 324d59ed016..aec9d59d40a 100644 --- a/TAO/orbsvcs/tests/Event/lib/Driver.cpp +++ b/TAO/orbsvcs/tests/Event/lib/Driver.cpp @@ -10,6 +10,7 @@ #include "ace/Sched_Params.h" #include "ace/Arg_Shifter.h" #include "ace/High_Res_Timer.h" +#include "ace/Stats.h" #if !defined(EC_DISABLE_OLD_EC) #include "EC_Scheduler_Info.h" @@ -759,34 +760,32 @@ EC_Driver::shutdown_consumers (CORBA::Environment &ACE_TRY_ENV) void EC_Driver::dump_results (void) { - EC_Driver::Throughput_Stats throughput; - EC_Driver::Latency_Stats latency; + ACE_Throughput_Stats throughput; + ACE_UINT32 gsf = ACE_High_Res_Timer::global_scale_factor (); + char buf[BUFSIZ]; for (int j = 0; j < this->n_consumers_; ++j) { - char buf[BUFSIZ]; - ACE_OS::sprintf (buf, "consumer_%02.2d", j); + ACE_OS::sprintf (buf, "Consumer [%02.2d]", j); - this->consumers_[j]->dump_results (buf); - this->consumers_[j]->accumulate (throughput, latency); + this->consumers_[j]->dump_results (buf, gsf); + this->consumers_[j]->accumulate (throughput); } ACE_DEBUG ((LM_DEBUG, "\n")); - EC_Driver::Throughput_Stats suppliers; + ACE_Throughput_Stats suppliers; for (int i = 0; i < this->n_suppliers_; ++i) { - char buf[BUFSIZ]; - ACE_OS::sprintf (buf, "supplier_%02.2d", i); + ACE_OS::sprintf (buf, "Supplier [%02.2d]", i); - this->suppliers_[i]->dump_results (buf); + this->suppliers_[i]->dump_results (buf, gsf); this->suppliers_[i]->accumulate (suppliers); } ACE_DEBUG ((LM_DEBUG, "\nTotals:\n")); - throughput.dump_results ("EC_Consumer", "throughput"); - latency.dump_results ("EC_Consumer", "latency"); + throughput.dump_results ("EC_Consumer/totals", gsf); ACE_DEBUG ((LM_DEBUG, "\n")); - suppliers.dump_results ("EC_Supplier", "accumulated"); + suppliers.dump_results ("EC_Supplier/totals", gsf); } int @@ -1125,108 +1124,3 @@ EC_Driver::supplier_disconnect (void*, CORBA::Environment&) { } - -// **************************************************************** - -void -EC_Driver::Latency_Stats::dump_results (const char *test_name, - const char *sub_test) -{ - if (this->n_ <= 1) - return; - - ACE_hrtime_t avg = this->sum_ / this->n_; - ACE_hrtime_t dev = - this->sum2_ / this->n_ - avg*avg; - - ACE_UINT32 gsf = ACE_High_Res_Timer::global_scale_factor (); - - double min_usec = ACE_CU64_TO_CU32 (this->min_) / gsf; - double max_usec = ACE_CU64_TO_CU32 (this->max_) / gsf; - double avg_usec = ACE_CU64_TO_CU32 (avg) / gsf; - double dev_usec = ACE_CU64_TO_CU32 (dev) / (gsf * gsf); - ACE_DEBUG ((LM_DEBUG, - "%s/%s: %.2f/%.2f/%.2f/%.2f (min/avg/max/var^2) [usecs]\n", - test_name, sub_test, - min_usec, avg_usec, max_usec, dev_usec)); -} - -void -EC_Driver::Latency_Stats::accumulate (const Latency_Stats& rhs) -{ - if (rhs.n_ == 0) - return; - - if (this->n_ == 0) - { - *this = rhs; - return; - } - - if (this->min_ > rhs.min_) - this->min_ = rhs.min_; - if (this->max_ < rhs.max_) - this->max_ = rhs.max_; - - this->sum_ += rhs.sum_; - this->sum2_ += rhs.sum2_; - this->n_ += rhs.n_; -} - -// **************************************************************** - -void -EC_Driver::Throughput_Stats::accumulate (const Throughput_Stats& rhs) -{ - if (!this->done_) - { - this->done_ = 1; - this->start_ = rhs.start_; - this->stop_ = rhs.stop_; - this->n_ = rhs.n_; - return; - } - - if (this->start_ > rhs.start_) - this->start_ = rhs.start_; - - if (this->stop_ < rhs.stop_) - this->stop_ = rhs.stop_; - - this->n_ += rhs.n_; -} - -void -EC_Driver::Throughput_Stats::dump_results (const char *test_name, - const char *subtest) -{ - if (this->n_ == 0) - { - ACE_DEBUG ((LM_DEBUG, - "%s/%s: no events recorded\n", - test_name, subtest)); - return; - } - - if (this->done_ == 0) - { - ACE_DEBUG ((LM_DEBUG, - "%s/%s: incomplete data," - " potentially skewed results\n", - test_name, subtest)); - } - - ACE_Time_Value tv; - ACE_High_Res_Timer::hrtime_to_tv (tv, this->stop_ - this->start_); - - double f = 1.0/(tv.sec () + tv.usec () / 1000000.0); - double events_per_second = this->n_ * f; - - ACE_DEBUG ((LM_DEBUG, - "%s/%s: " - "%d / %d.%06.6d = %.3f events/second\n", - test_name, subtest, - this->n_, - tv.sec (), tv.usec (), - events_per_second)); -} diff --git a/TAO/orbsvcs/tests/Event/lib/Driver.h b/TAO/orbsvcs/tests/Event/lib/Driver.h index 40f4b51833d..df3d3cc1bf5 100644 --- a/TAO/orbsvcs/tests/Event/lib/Driver.h +++ b/TAO/orbsvcs/tests/Event/lib/Driver.h @@ -24,6 +24,7 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "orbsvcs/RtecEventChannelAdminS.h" +#include "ace/Stats.h" class TAO_EC_Event_Channel_Attributes; class TAO_Module_Factory; @@ -224,72 +225,6 @@ public: // Activate all the tasks, by default runs each supplier on its // own thread. - class EC_Test_Export Latency_Stats - { - // = TITLE - // Maintains latency statistics. - // - // = DESCRIPTION - // This class is used to keep latency statistics, collected - // using the high resolution timers. - // - // = TODO - // Implement a version that keeps a histogram, with bounded - // memory requirements. - // - public: - Latency_Stats (void); - - void dump_results (const char* test_name, - const char* sub_test); - - void sample (ACE_hrtime_t sample); - - void accumulate (const Latency_Stats& stats); - // Useful to merge several Latency_Stats. - - private: - u_long n_; - ACE_hrtime_t sum_; - ACE_hrtime_t sum2_; - ACE_hrtime_t min_; - ACE_hrtime_t max_; - }; - - class EC_Test_Export Throughput_Stats - { - // = TITLE - // Maintains throughput statistics. - // - // = DESCRIPTION - // This class is used to keep throughput statistics, the data is - // collected using the High Resolution Timer. - // - public: - Throughput_Stats (void); - - void dump_results (const char* test_name, - const char* sub_test); - - void start (void); - // Start measuring the time. - - void stop (void); - // The test has completed - - void sample (void); - // An event has been received - - void accumulate (const Throughput_Stats& stats); - // Useful to merge several Throughput_Stats. - - private: - CORBA::ULong n_; - int done_; - ACE_hrtime_t start_; - ACE_hrtime_t stop_; - }; - protected: CORBA::ORB_var orb_; // The ORB diff --git a/TAO/orbsvcs/tests/Event/lib/Driver.i b/TAO/orbsvcs/tests/Event/lib/Driver.i index b93a23fdbd2..f346e7757c1 100644 --- a/TAO/orbsvcs/tests/Event/lib/Driver.i +++ b/TAO/orbsvcs/tests/Event/lib/Driver.i @@ -5,62 +5,3 @@ EC_Driver::verbose (void) const { return this->verbose_; } - -// **************************************************************** - -ACE_INLINE -EC_Driver::Latency_Stats::Latency_Stats (void) - : n_ (0), - sum_ (0), - sum2_ (0), - min_ (0), - max_ (0) -{ -} - -ACE_INLINE -void EC_Driver::Latency_Stats::sample (ACE_hrtime_t sample) -{ - this->sum_ += sample; - this->sum2_ += sample * sample; - if (this->n_ == 0) - { - this->min_ = sample; - this->max_ = sample; - } - else if (this->min_ > sample) - this->min_ = sample; - else if (this->max_ < sample) - this->max_ = sample; - this->n_++; -} - -// **************************************************************** - -ACE_INLINE -EC_Driver::Throughput_Stats::Throughput_Stats (void) - : n_ (0), - done_ (0) -{ -} - -ACE_INLINE void -EC_Driver::Throughput_Stats::start (void) -{ - this->done_ = 0; - this->start_ = ACE_OS::gethrtime (); -} - -ACE_INLINE void -EC_Driver::Throughput_Stats::stop (void) -{ - this->stop_ = ACE_OS::gethrtime (); - this->done_ = 1; -} - -ACE_INLINE void -EC_Driver::Throughput_Stats::sample (void) -{ - this->n_++; - this->stop_ = ACE_OS::gethrtime (); -} diff --git a/TAO/orbsvcs/tests/Event/lib/Makefile b/TAO/orbsvcs/tests/Event/lib/Makefile index 6b182b07c99..8bed6e33f66 100644 --- a/TAO/orbsvcs/tests/Event/lib/Makefile +++ b/TAO/orbsvcs/tests/Event/lib/Makefile @@ -181,6 +181,9 @@ CPPFLAGS += -I$(TAO_ROOT) -I$(TAO_ROOT)/orbsvcs $(TSS_ORB_FLAG) $(TAO_ROOT)/tao/Sequence_T.h \ $(TAO_ROOT)/tao/Sequence_T.i \ $(TAO_ROOT)/tao/Sequence_T.cpp \ + $(TAO_ROOT)/tao/varout.h \ + $(TAO_ROOT)/tao/varout.i \ + $(TAO_ROOT)/tao/varout.cpp \ $(TAO_ROOT)/tao/Services.i \ $(TAO_ROOT)/tao/IORManipulation.h \ $(TAO_ROOT)/tao/IORS.h \ @@ -210,9 +213,6 @@ CPPFLAGS += -I$(TAO_ROOT) -I$(TAO_ROOT)/orbsvcs $(TSS_ORB_FLAG) $(TAO_ROOT)/tao/GIOP.h \ $(TAO_ROOT)/tao/GIOP.i \ $(TAO_ROOT)/tao/Server_Request.i \ - $(TAO_ROOT)/tao/varout.h \ - $(TAO_ROOT)/tao/varout.i \ - $(TAO_ROOT)/tao/varout.cpp \ $(TAO_ROOT)/tao/Marshal.h \ $(TAO_ROOT)/tao/Marshal.i \ $(TAO_ROOT)/tao/singletons.h \ @@ -265,6 +265,7 @@ CPPFLAGS += -I$(TAO_ROOT) -I$(TAO_ROOT)/orbsvcs $(TSS_ORB_FLAG) $(TAO_ROOT)/tao/MessagingC.h \ $(TAO_ROOT)/tao/IOPC.h \ $(TAO_ROOT)/tao/IOPC.i \ + $(TAO_ROOT)/tao/PollableC.h \ $(TAO_ROOT)/tao/MessagingC.i \ $(TAO_ROOT)/tao/MessagingS.i \ $(TAO_ROOT)/tao/Stub.i \ @@ -340,6 +341,8 @@ CPPFLAGS += -I$(TAO_ROOT) -I$(TAO_ROOT)/orbsvcs $(TSS_ORB_FLAG) $(TAO_ROOT)/orbsvcs/orbsvcs/RtecEventChannelAdminS_T.i \ $(TAO_ROOT)/orbsvcs/orbsvcs/RtecEventChannelAdminS_T.cpp \ $(TAO_ROOT)/orbsvcs/orbsvcs/RtecEventChannelAdminS.i \ + $(ACE_ROOT)/ace/Stats.h \ + $(ACE_ROOT)/ace/Stats.i \ Driver.i Consumer.h Supplier.h \ $(ACE_ROOT)/ace/Task.h \ $(ACE_ROOT)/ace/Task.i \ @@ -496,6 +499,9 @@ CPPFLAGS += -I$(TAO_ROOT) -I$(TAO_ROOT)/orbsvcs $(TSS_ORB_FLAG) $(TAO_ROOT)/tao/Sequence_T.h \ $(TAO_ROOT)/tao/Sequence_T.i \ $(TAO_ROOT)/tao/Sequence_T.cpp \ + $(TAO_ROOT)/tao/varout.h \ + $(TAO_ROOT)/tao/varout.i \ + $(TAO_ROOT)/tao/varout.cpp \ $(TAO_ROOT)/tao/Services.i \ $(TAO_ROOT)/tao/IORManipulation.h \ $(TAO_ROOT)/tao/IORS.h \ @@ -525,9 +531,6 @@ CPPFLAGS += -I$(TAO_ROOT) -I$(TAO_ROOT)/orbsvcs $(TSS_ORB_FLAG) $(TAO_ROOT)/tao/GIOP.h \ $(TAO_ROOT)/tao/GIOP.i \ $(TAO_ROOT)/tao/Server_Request.i \ - $(TAO_ROOT)/tao/varout.h \ - $(TAO_ROOT)/tao/varout.i \ - $(TAO_ROOT)/tao/varout.cpp \ $(TAO_ROOT)/tao/Marshal.h \ $(TAO_ROOT)/tao/Marshal.i \ $(TAO_ROOT)/tao/singletons.h \ @@ -580,6 +583,7 @@ CPPFLAGS += -I$(TAO_ROOT) -I$(TAO_ROOT)/orbsvcs $(TSS_ORB_FLAG) $(TAO_ROOT)/tao/MessagingC.h \ $(TAO_ROOT)/tao/IOPC.h \ $(TAO_ROOT)/tao/IOPC.i \ + $(TAO_ROOT)/tao/PollableC.h \ $(TAO_ROOT)/tao/MessagingC.i \ $(TAO_ROOT)/tao/MessagingS.i \ $(TAO_ROOT)/tao/Stub.i \ @@ -655,6 +659,8 @@ CPPFLAGS += -I$(TAO_ROOT) -I$(TAO_ROOT)/orbsvcs $(TSS_ORB_FLAG) $(TAO_ROOT)/orbsvcs/orbsvcs/RtecEventChannelAdminS_T.i \ $(TAO_ROOT)/orbsvcs/orbsvcs/RtecEventChannelAdminS_T.cpp \ $(TAO_ROOT)/orbsvcs/orbsvcs/RtecEventChannelAdminS.i \ + $(ACE_ROOT)/ace/Stats.h \ + $(ACE_ROOT)/ace/Stats.i \ Driver.i \ $(TAO_ROOT)/orbsvcs/orbsvcs/Event_Service_Constants.h \ $(TAO_ROOT)/orbsvcs/orbsvcs/Time_Utilities.h \ @@ -786,6 +792,9 @@ CPPFLAGS += -I$(TAO_ROOT) -I$(TAO_ROOT)/orbsvcs $(TSS_ORB_FLAG) $(TAO_ROOT)/tao/Sequence_T.h \ $(TAO_ROOT)/tao/Sequence_T.i \ $(TAO_ROOT)/tao/Sequence_T.cpp \ + $(TAO_ROOT)/tao/varout.h \ + $(TAO_ROOT)/tao/varout.i \ + $(TAO_ROOT)/tao/varout.cpp \ $(TAO_ROOT)/tao/Services.i \ $(TAO_ROOT)/tao/IORManipulation.h \ $(TAO_ROOT)/tao/IORS.h \ @@ -815,9 +824,6 @@ CPPFLAGS += -I$(TAO_ROOT) -I$(TAO_ROOT)/orbsvcs $(TSS_ORB_FLAG) $(TAO_ROOT)/tao/GIOP.h \ $(TAO_ROOT)/tao/GIOP.i \ $(TAO_ROOT)/tao/Server_Request.i \ - $(TAO_ROOT)/tao/varout.h \ - $(TAO_ROOT)/tao/varout.i \ - $(TAO_ROOT)/tao/varout.cpp \ $(TAO_ROOT)/tao/Marshal.h \ $(TAO_ROOT)/tao/Marshal.i \ $(TAO_ROOT)/tao/singletons.h \ @@ -870,6 +876,7 @@ CPPFLAGS += -I$(TAO_ROOT) -I$(TAO_ROOT)/orbsvcs $(TSS_ORB_FLAG) $(TAO_ROOT)/tao/MessagingC.h \ $(TAO_ROOT)/tao/IOPC.h \ $(TAO_ROOT)/tao/IOPC.i \ + $(TAO_ROOT)/tao/PollableC.h \ $(TAO_ROOT)/tao/MessagingC.i \ $(TAO_ROOT)/tao/MessagingS.i \ $(TAO_ROOT)/tao/Stub.i \ @@ -945,6 +952,8 @@ CPPFLAGS += -I$(TAO_ROOT) -I$(TAO_ROOT)/orbsvcs $(TSS_ORB_FLAG) $(TAO_ROOT)/orbsvcs/orbsvcs/RtecEventChannelAdminS_T.i \ $(TAO_ROOT)/orbsvcs/orbsvcs/RtecEventChannelAdminS_T.cpp \ $(TAO_ROOT)/orbsvcs/orbsvcs/RtecEventChannelAdminS.i \ + $(ACE_ROOT)/ace/Stats.h \ + $(ACE_ROOT)/ace/Stats.i \ Driver.i \ $(ACE_ROOT)/ace/Task.h \ $(ACE_ROOT)/ace/Task.i \ diff --git a/TAO/orbsvcs/tests/Event/lib/Supplier.cpp b/TAO/orbsvcs/tests/Event/lib/Supplier.cpp index 33d9d45af56..8e69ee498c0 100644 --- a/TAO/orbsvcs/tests/Event/lib/Supplier.cpp +++ b/TAO/orbsvcs/tests/Event/lib/Supplier.cpp @@ -58,10 +58,7 @@ EC_Supplier::send_event (const RtecEventComm::EventSet& event, ACE_GUARD (ACE_SYNCH_MUTEX, ace_mon, this->lock_); if (this->push_count_ == 0) - this->throughput_.start (); - - // We start the timer as soon as we receive the first event... - this->throughput_.sample (); + this->throughput_start_ = ACE_OS::gethrtime (); this->push_count_ += event.length (); @@ -72,7 +69,14 @@ EC_Supplier::send_event (const RtecEventComm::EventSet& event, "EC_Consumer (%P|%t): %d events received\n", this->push_count_)); } + + ACE_hrtime_t start = ACE_OS::gethrtime (); + this->consumer_proxy_->push (event, ACE_TRY_ENV); + + ACE_hrtime_t end = ACE_OS::gethrtime (); + this->throughput_.sample (end - this->throughput_start_, + end - start); } void @@ -177,13 +181,14 @@ EC_Supplier::disconnect_push_supplier (CORBA::Environment &ACE_TRY_ENV) } void -EC_Supplier::dump_results (const char* name) +EC_Supplier::dump_results (const char* name, + ACE_UINT32 gsf) { - this->throughput_.dump_results ("EC_Supplier", name); + this->throughput_.dump_results (name, gsf); } void -EC_Supplier::accumulate (EC_Driver::Throughput_Stats& stats) const +EC_Supplier::accumulate (ACE_Throughput_Stats& stats) const { stats.accumulate (this->throughput_); } @@ -262,9 +267,8 @@ EC_Supplier_Task::svc (void) ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "SYS_EX"); } ACE_ENDTRY; - - ACE_OS::sleep (tv); } + ACE_OS::sleep (tv); } ACE_TRY_EX(SHUTDOWN) diff --git a/TAO/orbsvcs/tests/Event/lib/Supplier.h b/TAO/orbsvcs/tests/Event/lib/Supplier.h index b2d5dcc1bfa..8fb4138418b 100644 --- a/TAO/orbsvcs/tests/Event/lib/Supplier.h +++ b/TAO/orbsvcs/tests/Event/lib/Supplier.h @@ -89,10 +89,11 @@ public: void shutdown (CORBA::Environment &ACE_TRY_ENV); // Disconnect from the EC, also deactivates the object - virtual void dump_results (const char* name); + virtual void dump_results (const char* name, + ACE_UINT32 global_scale_factor); // Dump the results... - void accumulate (EC_Driver::Throughput_Stats& stats) const; + void accumulate (ACE_Throughput_Stats& stats) const; // Add our statistics to <stats> void event_type (int event_number, @@ -119,7 +120,10 @@ private: RtecEventChannelAdmin::ProxyPushConsumer_var consumer_proxy_; // We talk to the EC (as a supplier) using this proxy. - EC_Driver::Throughput_Stats throughput_; + ACE_hrtime_t throughput_start_; + // The time for the first event sent + + ACE_Throughput_Stats throughput_; // Measure the elapsed time spent while sending the events. int burst_count_; |