summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpradeep <pradeep@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-05-01 19:50:19 +0000
committerpradeep <pradeep@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-05-01 19:50:19 +0000
commit23a919ce7d8204c1dfe54e8702b63bb54999e978 (patch)
treefc42ba0cd082acfea039df72e2844885683b2fa2
parent6e5a5aafb63337042010a5871065813234b18c31 (diff)
downloadATCD-23a919ce7d8204c1dfe54e8702b63bb54999e978.tar.gz
*** empty log message ***
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Periodic_Consumer.cpp14
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Periodic_Supplier.cpp30
-rw-r--r--TAO/orbsvcs/tests/Notify/lib/Periodic_Supplier.h3
3 files changed, 36 insertions, 11 deletions
diff --git a/TAO/orbsvcs/tests/Notify/lib/Periodic_Consumer.cpp b/TAO/orbsvcs/tests/Notify/lib/Periodic_Consumer.cpp
index 2c974ab3de6..afb8a600721 100644
--- a/TAO/orbsvcs/tests/Notify/lib/Periodic_Consumer.cpp
+++ b/TAO/orbsvcs/tests/Notify/lib/Periodic_Consumer.cpp
@@ -124,13 +124,13 @@ TAO_NS_Periodic_Consumer::push_structured_event (const CosNotification::Structur
CORBA::INTERNAL ());
ACE_CHECK;
+ const CosNotification::PropertySeq& prop_seq = notification.header.variable_header;
+
if (this->count_ == -1)
{
if (TAO_debug_level > 0)
ACE_DEBUG ((LM_DEBUG, "(%P, %t)Consumer %s received inital (-1)th event \n", this->name_.c_str ()));
- const CosNotification::PropertySeq& prop_seq = notification.header.variable_header;
-
for (CORBA::ULong i = 0; i < prop_seq.length (); ++i)
{
if (ACE_OS::strcmp (prop_seq[i].name.in (), "BaseTime") == 0)
@@ -169,8 +169,6 @@ TAO_NS_Periodic_Consumer::push_structured_event (const CosNotification::Structur
if (this->check_priority_)
{
// Check if the event carries a Priority.
- const CosNotification::PropertySeq& prop_seq = notification.header.variable_header;
-
int event_has_priority_set = 0;
CORBA::Short event_priority = 0;
@@ -222,6 +220,14 @@ TAO_NS_Periodic_Consumer::push_structured_event (const CosNotification::Structur
}
}
+ for (CORBA::ULong i = 0; i < prop_seq.length (); ++i)
+ {
+ if (ACE_OS::strcmp (prop_seq[i].name.in (), "Stop") == 0)
+ {
+ this->count_ = this->max_count_; // force the count to reach max as we've run out of time.
+ }
+ }
+
TimeBase::TimeT send_time, now;
ACE_hrtime_t send_time_hrtime;
diff --git a/TAO/orbsvcs/tests/Notify/lib/Periodic_Supplier.cpp b/TAO/orbsvcs/tests/Notify/lib/Periodic_Supplier.cpp
index 8d039012dd0..549ba61e21f 100644
--- a/TAO/orbsvcs/tests/Notify/lib/Periodic_Supplier.cpp
+++ b/TAO/orbsvcs/tests/Notify/lib/Periodic_Supplier.cpp
@@ -19,6 +19,7 @@ TAO_NS_Periodic_Supplier::TAO_NS_Periodic_Supplier (void)
:barrier_ (0),
priority_ (0),
period_ (0),
+ run_time_ (0),
exec_time_ (0),
phase_ (0),
iter_ (0),
@@ -130,6 +131,11 @@ TAO_NS_Periodic_Supplier::init_state (ACE_Arg_Shifter& arg_shifter)
load_ = ACE_OS::atoi (current_arg);
arg_shifter.consume_arg ();
}
+ else if ((current_arg = arg_shifter.get_the_parameter ("-RunTime"))) // in seconds
+ {
+ run_time_ = ACE_OS::atoi (current_arg);
+ arg_shifter.consume_arg ();
+ }
else
{
ACE_DEBUG ((LM_DEBUG, "parse Task unknown option %s\n",
@@ -203,13 +209,6 @@ TAO_NS_Periodic_Supplier::svc (void)
// now wait till the phase_ period expires.
ACE_OS::sleep (ACE_Time_Value (0, phase_));
- ACE_UINT32 gsf = ACE_High_Res_Timer::global_scale_factor ();
-
- ACE_hrtime_t before, after;
-
- // This event is special. its not counted to make the performance stats.
- //TAO_NS_StructuredEvent zeroth_event;
-
// populate event.
// send the base time and max count.
TimeBase::TimeT base_time;
@@ -247,6 +246,12 @@ TAO_NS_Periodic_Supplier::svc (void)
}
ACE_ENDTRY;
+ ACE_UINT32 gsf = ACE_High_Res_Timer::global_scale_factor ();
+
+ ACE_hrtime_t before, after;
+
+ ACE_Time_Value run_time = ACE_Time_Value (this->run_time_) + ACE_OS::gettimeofday ();
+
for (int i = 0; i < iter_ ; ++i)
{
before = ACE_OS::gethrtime ();
@@ -259,6 +264,16 @@ TAO_NS_Periodic_Supplier::svc (void)
this->event_.payload (buffer);
+ if (this->run_time_ != 0 && ACE_OS::gettimeofday () > run_time)
+ {
+ // Time up, send a "Stop" event.
+ CORBA::Any buffer;
+ buffer <<= (long) 1;
+ this->event_.opt_header ("Stop", buffer);
+
+ i = iter_; // Load the iter so that the loop exits.
+ }
+
ACE_TRY
{
if (TAO_debug_level > 0)
@@ -325,6 +340,7 @@ TAO_NS_Periodic_Supplier::svc (void)
ACE_Time_Value t_sleep (0, sleep_time);
ACE_OS::sleep (t_sleep);
} /* period != 0 */
+
} /* for */
stats_.end_time (ACE_OS::gethrtime ());
diff --git a/TAO/orbsvcs/tests/Notify/lib/Periodic_Supplier.h b/TAO/orbsvcs/tests/Notify/lib/Periodic_Supplier.h
index 2b3e6b26105..d7b81071b02 100644
--- a/TAO/orbsvcs/tests/Notify/lib/Periodic_Supplier.h
+++ b/TAO/orbsvcs/tests/Notify/lib/Periodic_Supplier.h
@@ -88,6 +88,9 @@ protected:
/// Period
long period_;
+ /// RunTime - The Max. time to run the supplier.
+ long run_time_;
+
/// Worst case exec. time.
unsigned long exec_time_;