summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2000-03-27 04:18:17 +0000
committercoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2000-03-27 04:18:17 +0000
commit6cf46ebda912dfcd571e1de6813df7acf610c20f (patch)
tree7c9c08aa78a333b091d05063db4e62d0ce41b521
parent9017e8b114da17f8578714f11a70e4c1b1f6dce1 (diff)
downloadATCD-6cf46ebda912dfcd571e1de6813df7acf610c20f.tar.gz
ChangeLogTag:Sun Mar 26 20:15:17 2000 Carlos O'Ryan <coryan@uci.edu>
-rw-r--r--TAO/ChangeLogs/ChangeLog-02a93
-rw-r--r--TAO/orbsvcs/orbsvcs/LoadBalancing/Minimum_Dispersion.cpp79
-rw-r--r--TAO/orbsvcs/orbsvcs/LoadBalancing/ReplicaProxy.cpp5
-rw-r--r--TAO/orbsvcs/orbsvcs/LoadBalancing/ReplicaProxy.h3
-rw-r--r--TAO/orbsvcs/orbsvcs/Makefile.LoadBalancing3
-rw-r--r--TAO/orbsvcs/orbsvcs/Minimum_Dispersion.cpp79
-rw-r--r--TAO/orbsvcs/orbsvcs/ReplicaProxy.cpp5
-rw-r--r--TAO/orbsvcs/orbsvcs/ReplicaProxy.h3
-rw-r--r--TAO/orbsvcs/tests/LoadBalancing/Hash_ReplicaControl.cpp13
-rw-r--r--TAO/orbsvcs/tests/LoadBalancing/Hash_ReplicaControl.h4
-rw-r--r--TAO/orbsvcs/tests/LoadBalancing/client.cpp49
-rw-r--r--TAO/orbsvcs/tests/LoadBalancing/server.cpp5
12 files changed, 202 insertions, 139 deletions
diff --git a/TAO/ChangeLogs/ChangeLog-02a b/TAO/ChangeLogs/ChangeLog-02a
index 2b443a21a6a..62ce03547ab 100644
--- a/TAO/ChangeLogs/ChangeLog-02a
+++ b/TAO/ChangeLogs/ChangeLog-02a
@@ -1,25 +1,50 @@
+Sun Mar 26 20:15:17 2000 Carlos O'Ryan <coryan@uci.edu>
+
+ * orbsvcs/orbsvcs/Makefile.LoadBalancing:
+ Add new load balancing strategy
+
+ * orbsvcs/orbsvcs/LoadBalancing/Minimum_Dispersion.cpp:
+ Several improvements to this strategy, i tried to detect
+ crashed servers, not very successfully.
+
+ * orbsvcs/orbsvcs/LoadBalancing/ReplicaProxy.h:
+ * orbsvcs/orbsvcs/LoadBalancing/ReplicaProxy.cpp:
+ More fixes to the load balancer.
+
+ * orbsvcs/tests/LoadBalancing/Hash_ReplicaControl.h:
+ * orbsvcs/tests/LoadBalancing/Hash_ReplicaControl.cpp:
+ Fine tune the load measurement algorithm. Try to make the load
+ less sensible to transient spikes.
+
+ * orbsvcs/tests/LoadBalancing/server.cpp:
+ The Win32 workaround is not the Right Thing [tm]
+
+ * orbsvcs/tests/LoadBalancing/client.cpp:
+ Try to improve fault tolerance, had to back it up, Forwarding
+ does not seems to work right.
+
Sun Mar 26 13:53:40 2000 Carlos O'Ryan <coryan@uci.edu>
- * orbsvcs/LoadBalancer/LoadBalancer.h:
- * orbsvcs/LoadBalancer/LoadBalancer.cpp
- * orbsvcs/orbsvcs/LoadBalancing.dsp:
- * orbsvcs/orbsvcs/LoadBalancing/LoadBalancer_i.h:
- * orbsvcs/orbsvcs/LoadBalancing/LoadBalancer_i.cpp:
- * orbsvcs/orbsvcs/LoadBalancing/LoadBalancing_Strategy.h:
- * orbsvcs/orbsvcs/LoadBalancing/LoadBalancing_Strategy.cpp:
- * orbsvcs/orbsvcs/LoadBalancing/Minimum_Dispersion.h:
- * orbsvcs/orbsvcs/LoadBalancing/Minimum_Dispersion.cpp:
- * orbsvcs/orbsvcs/LoadBalancing/ReplicaProxy.h:
- * orbsvcs/orbsvcs/LoadBalancing/ReplicaProxy.cpp:
- * orbsvcs/orbsvcs/LoadBalancing/Round_Robin_Strategy.cpp:
- Implemented new load balancing strategy.
-
- * orbsvcs/tests/LoadBalancing/Hash_ReplicaControl.h:
- * orbsvcs/tests/LoadBalancing/Hash_ReplicaControl.cpp:
- Add debugging messages
-
- * orbsvcs/tests/LoadBalancing/server.cpp:
- Workaround problems on Win32 implementations of the Reactor.
+ * orbsvcs/LoadBalancer/LoadBalancer.h:
+ * orbsvcs/LoadBalancer/LoadBalancer.cpp
+ * orbsvcs/orbsvcs/LoadBalancing.dsp:
+ * orbsvcs/orbsvcs/LoadBalancing/LoadBalancer_i.h:
+ * orbsvcs/orbsvcs/LoadBalancing/LoadBalancer_i.cpp:
+ * orbsvcs/orbsvcs/LoadBalancing/LoadBalancing_Strategy.h:
+ * orbsvcs/orbsvcs/LoadBalancing/LoadBalancing_Strategy.cpp:
+ * orbsvcs/orbsvcs/LoadBalancing/Minimum_Dispersion.h:
+ * orbsvcs/orbsvcs/LoadBalancing/Minimum_Dispersion.cpp:
+ * orbsvcs/orbsvcs/LoadBalancing/ReplicaProxy.h:
+ * orbsvcs/orbsvcs/LoadBalancing/ReplicaProxy.cpp:
+ * orbsvcs/orbsvcs/LoadBalancing/Round_Robin_Strategy.cpp:
+ Implemented new load balancing strategy.
+
+ * orbsvcs/tests/LoadBalancing/Hash_ReplicaControl.h:
+ * orbsvcs/tests/LoadBalancing/Hash_ReplicaControl.cpp:
+ Add debugging messages
+
+ * orbsvcs/tests/LoadBalancing/server.cpp:
+ Workaround problems on Win32 implementations of the Reactor.
Sat Mar 25 21:27:11 2000 Carlos O'Ryan <coryan@uci.edu>
@@ -114,24 +139,24 @@ Sat Mar 25 16:31:29 2000 Carlos O'Ryan <coryan@uci.edu>
Fri Mar 24 21:32:30 2000 Pradeep Gore <pradeep@flamenco.cs.wustl.edu>
- * docs/releasenotes/index.html:
- Updated the section on the Notification Service.
- Thanks to Roger Tragin <rtragin@wpine.com> for reminding to update.
+ * docs/releasenotes/index.html:
+ Updated the section on the Notification Service.
+ Thanks to Roger Tragin <rtragin@wpine.com> for reminding to update.
Fri Mar 24 17:15:07 2000 Ossama Othman <ossama@uci.edu>
- * tao/IIOP_Acceptor.cpp (is_collocated):
- * tao/SHMIOP_Acceptor.cpp (is_collocated):
- * tao/UIOP_Acceptor.cpp (is_collocated):
+ * tao/IIOP_Acceptor.cpp (is_collocated):
+ * tao/SHMIOP_Acceptor.cpp (is_collocated):
+ * tao/UIOP_Acceptor.cpp (is_collocated):
- Check that dynamically cast pointer is actually valid
- (i.e. non-zero) prior to using it.
+ Check that dynamically cast pointer is actually valid
+ (i.e. non-zero) prior to using it.
Fri Mar 24 18:38:20 2000 Douglas C. Schmidt <schmidt@ace.cs.wustl.edu>
- * orbsvcs/tests/AVStreams/Full_Profile/server.cpp: Fixed a typo where
- ACE_Null_Mutex was being passed as ACE_null_mutex. Thanks to
- Thomas Groth <groth.th@stn-atlas.de> for reporting this.
+ * orbsvcs/tests/AVStreams/Full_Profile/server.cpp: Fixed a typo where
+ ACE_Null_Mutex was being passed as ACE_null_mutex. Thanks to
+ Thomas Groth <groth.th@stn-atlas.de> for reporting this.
Fri Mar 24 15:40:25 2000 Darrell Brunsch <brunsch@uci.edu>
@@ -155,9 +180,9 @@ Fri Mar 24 15:40:25 2000 Darrell Brunsch <brunsch@uci.edu>
Fri Mar 24 10:21:27 2000 Jeff Parsons <parsons@cs.wustl.edu>
- * TAO_IDL/ast/ast_expression.cpp:
- Initialized some variables to avoid cxx warnings,
- and made some cosmetic changes.
+ * TAO_IDL/ast/ast_expression.cpp:
+ Initialized some variables to avoid cxx warnings,
+ and made some cosmetic changes.
Thu Mar 23 21:49:36 2000 Darrell Brunsch <brunsch@uci.edu>
diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/Minimum_Dispersion.cpp b/TAO/orbsvcs/orbsvcs/LoadBalancing/Minimum_Dispersion.cpp
index a5048cd79c1..f94ded70438 100644
--- a/TAO/orbsvcs/orbsvcs/LoadBalancing/Minimum_Dispersion.cpp
+++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/Minimum_Dispersion.cpp
@@ -31,45 +31,48 @@ Minimum_Dispersion_Strategy::~Minimum_Dispersion_Strategy (void)
CORBA::Object_ptr
Minimum_Dispersion_Strategy::replica (CORBA::Environment &ACE_TRY_ENV)
{
- if (this->proxies_.is_empty ())
- {
- // @@ What do we do if the set is empty?
- ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
- CORBA::Object::_nil ());
- }
-
- ReplicaProxySetIterator begin = this->proxies_.begin ();
- ReplicaProxySetIterator end = this->proxies_.end ();
-
- float s = 0;
- CORBA::ULong n = 0;
- ReplicaProxySetIterator i = begin;
- for (;i != end; ++i)
+ while (!this->proxies_.is_empty ())
{
- s += (*i)->current_load ();
- n++;
- }
+ ReplicaProxySetIterator begin = this->proxies_.begin ();
+ ReplicaProxySetIterator end = this->proxies_.end ();
- float avg = s / n;
+ ReplicaProxySetIterator i = begin;
+ ReplicaProxy_Impl * proxy = (*i);
+ float d = (*i)->current_load ();
- i = begin;
- ReplicaProxy_Impl * proxy_servant = (*i);
- float d = 0;
- if (avg > (*i)->current_load ())
- d = avg - (*i)->current_load ();
+ for (++i ; i != end; ++i)
+ {
+ if (d > (*i)->current_load ())
+ {
+ proxy = *i;
+ d = (*i)->current_load ();
+ }
+ }
- for (++i ; i != end; ++i)
- {
- if (avg <= (*i)->current_load ())
- continue;
- if (d < (avg - (*i)->current_load ()))
+ // @@ Setup a timeout
+ ACE_TRY
{
- proxy_servant = *i;
- d = avg - (*i)->current_load ();
+ CORBA::Object_var object =
+ proxy->replica ();
+ CORBA::Boolean non_existent =
+ object->_non_existent (ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+ if (!non_existent)
+ {
+ return object._retn ();
+ }
}
+ ACE_CATCHANY
+ {
+ }
+ ACE_ENDTRY;
+ // @@ A bit melodramatic...
+ this->proxies_.remove (proxy);
}
+ // @@ What do we do if the set is empty?
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ CORBA::Object::_nil ());
- return proxy_servant->replica ();
}
int
@@ -111,17 +114,21 @@ Minimum_Dispersion_Strategy::load_changed (ReplicaProxy_Impl *proxy,
float relative_load = cl / avg;
- ACE_DEBUG ((LM_DEBUG, "Load %f %f %f\n", cl, avg, relative_load));
+ ACE_DEBUG ((LM_DEBUG, "Load[%x] %f %f %f\n",
+ proxy, cl, avg, relative_load));
- if (relative_load < 0.80)
+ if (relative_load > 1 + 1.0F / n)
{
- proxy->control_->nominal_load_advisory (ACE_TRY_ENV);
+ proxy->has_high_load_ = 1;
+ proxy->control_->high_load_advisory (ACE_TRY_ENV);
ACE_CHECK;
+ return;
}
- if (relative_load > 1.05)
+ if (proxy->has_high_load_ && relative_load < 1 + 0.9F / n)
{
- proxy->control_->high_load_advisory (ACE_TRY_ENV);
+ proxy->has_high_load_ = 0;
+ proxy->control_->nominal_load_advisory (ACE_TRY_ENV);
ACE_CHECK;
}
}
diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/ReplicaProxy.cpp b/TAO/orbsvcs/orbsvcs/LoadBalancing/ReplicaProxy.cpp
index b520753278b..42d4f9f7121 100644
--- a/TAO/orbsvcs/orbsvcs/LoadBalancing/ReplicaProxy.cpp
+++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/ReplicaProxy.cpp
@@ -12,7 +12,8 @@
ACE_RCSID(orbsvcs, ReplicaProxy, "$Id$")
ReplicaProxy_Impl::ReplicaProxy_Impl (void)
- : balancer_ (0),
+ : has_high_load_ (0),
+ balancer_ (0),
current_load_ (0),
connected_ (0)
{
@@ -29,7 +30,7 @@ ReplicaProxy_Impl::current_load (CORBA::Float load,
ACE_THROW (LoadBalancing::ReplicaProxy::InvalidLoad ());
this->current_load_ = load;
- ACE_DEBUG ((LM_DEBUG, "Load[%x] = %f\n", long(this), load));
+ // ACE_DEBUG ((LM_DEBUG, "Load[%x] = %f\n", long(this), load));
this->balancer_->load_changed (this, ACE_TRY_ENV);
}
diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/ReplicaProxy.h b/TAO/orbsvcs/orbsvcs/LoadBalancing/ReplicaProxy.h
index 7527c48b559..ef297cda029 100644
--- a/TAO/orbsvcs/orbsvcs/LoadBalancing/ReplicaProxy.h
+++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/ReplicaProxy.h
@@ -58,6 +58,9 @@ public:
CORBA::Object_ptr replica (void);
// Return a reference to the Replica.
+ int has_high_load_;
+ // Has the high load advisory been sent
+
LoadBalancing::ReplicaControl_var control_;
// Reference to the ReplicaControl.
diff --git a/TAO/orbsvcs/orbsvcs/Makefile.LoadBalancing b/TAO/orbsvcs/orbsvcs/Makefile.LoadBalancing
index 9880209a514..85af9c32256 100644
--- a/TAO/orbsvcs/orbsvcs/Makefile.LoadBalancing
+++ b/TAO/orbsvcs/orbsvcs/Makefile.LoadBalancing
@@ -40,7 +40,8 @@ CPP_SRCS += \
LoadBalancing/LoadBalancer_i \
LoadBalancing/LoadBalancing_Strategy \
LoadBalancing/ReplicaProxy \
- LoadBalancing/Round_Robin_Strategy
+ LoadBalancing/Round_Robin_Strategy \
+ LoadBalancing/Minimum_Dispersion
IDL_FILES = \
$(addsuffix S, $(IDL_SRCS)) \
diff --git a/TAO/orbsvcs/orbsvcs/Minimum_Dispersion.cpp b/TAO/orbsvcs/orbsvcs/Minimum_Dispersion.cpp
index a5048cd79c1..f94ded70438 100644
--- a/TAO/orbsvcs/orbsvcs/Minimum_Dispersion.cpp
+++ b/TAO/orbsvcs/orbsvcs/Minimum_Dispersion.cpp
@@ -31,45 +31,48 @@ Minimum_Dispersion_Strategy::~Minimum_Dispersion_Strategy (void)
CORBA::Object_ptr
Minimum_Dispersion_Strategy::replica (CORBA::Environment &ACE_TRY_ENV)
{
- if (this->proxies_.is_empty ())
- {
- // @@ What do we do if the set is empty?
- ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
- CORBA::Object::_nil ());
- }
-
- ReplicaProxySetIterator begin = this->proxies_.begin ();
- ReplicaProxySetIterator end = this->proxies_.end ();
-
- float s = 0;
- CORBA::ULong n = 0;
- ReplicaProxySetIterator i = begin;
- for (;i != end; ++i)
+ while (!this->proxies_.is_empty ())
{
- s += (*i)->current_load ();
- n++;
- }
+ ReplicaProxySetIterator begin = this->proxies_.begin ();
+ ReplicaProxySetIterator end = this->proxies_.end ();
- float avg = s / n;
+ ReplicaProxySetIterator i = begin;
+ ReplicaProxy_Impl * proxy = (*i);
+ float d = (*i)->current_load ();
- i = begin;
- ReplicaProxy_Impl * proxy_servant = (*i);
- float d = 0;
- if (avg > (*i)->current_load ())
- d = avg - (*i)->current_load ();
+ for (++i ; i != end; ++i)
+ {
+ if (d > (*i)->current_load ())
+ {
+ proxy = *i;
+ d = (*i)->current_load ();
+ }
+ }
- for (++i ; i != end; ++i)
- {
- if (avg <= (*i)->current_load ())
- continue;
- if (d < (avg - (*i)->current_load ()))
+ // @@ Setup a timeout
+ ACE_TRY
{
- proxy_servant = *i;
- d = avg - (*i)->current_load ();
+ CORBA::Object_var object =
+ proxy->replica ();
+ CORBA::Boolean non_existent =
+ object->_non_existent (ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+ if (!non_existent)
+ {
+ return object._retn ();
+ }
}
+ ACE_CATCHANY
+ {
+ }
+ ACE_ENDTRY;
+ // @@ A bit melodramatic...
+ this->proxies_.remove (proxy);
}
+ // @@ What do we do if the set is empty?
+ ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (),
+ CORBA::Object::_nil ());
- return proxy_servant->replica ();
}
int
@@ -111,17 +114,21 @@ Minimum_Dispersion_Strategy::load_changed (ReplicaProxy_Impl *proxy,
float relative_load = cl / avg;
- ACE_DEBUG ((LM_DEBUG, "Load %f %f %f\n", cl, avg, relative_load));
+ ACE_DEBUG ((LM_DEBUG, "Load[%x] %f %f %f\n",
+ proxy, cl, avg, relative_load));
- if (relative_load < 0.80)
+ if (relative_load > 1 + 1.0F / n)
{
- proxy->control_->nominal_load_advisory (ACE_TRY_ENV);
+ proxy->has_high_load_ = 1;
+ proxy->control_->high_load_advisory (ACE_TRY_ENV);
ACE_CHECK;
+ return;
}
- if (relative_load > 1.05)
+ if (proxy->has_high_load_ && relative_load < 1 + 0.9F / n)
{
- proxy->control_->high_load_advisory (ACE_TRY_ENV);
+ proxy->has_high_load_ = 0;
+ proxy->control_->nominal_load_advisory (ACE_TRY_ENV);
ACE_CHECK;
}
}
diff --git a/TAO/orbsvcs/orbsvcs/ReplicaProxy.cpp b/TAO/orbsvcs/orbsvcs/ReplicaProxy.cpp
index b520753278b..42d4f9f7121 100644
--- a/TAO/orbsvcs/orbsvcs/ReplicaProxy.cpp
+++ b/TAO/orbsvcs/orbsvcs/ReplicaProxy.cpp
@@ -12,7 +12,8 @@
ACE_RCSID(orbsvcs, ReplicaProxy, "$Id$")
ReplicaProxy_Impl::ReplicaProxy_Impl (void)
- : balancer_ (0),
+ : has_high_load_ (0),
+ balancer_ (0),
current_load_ (0),
connected_ (0)
{
@@ -29,7 +30,7 @@ ReplicaProxy_Impl::current_load (CORBA::Float load,
ACE_THROW (LoadBalancing::ReplicaProxy::InvalidLoad ());
this->current_load_ = load;
- ACE_DEBUG ((LM_DEBUG, "Load[%x] = %f\n", long(this), load));
+ // ACE_DEBUG ((LM_DEBUG, "Load[%x] = %f\n", long(this), load));
this->balancer_->load_changed (this, ACE_TRY_ENV);
}
diff --git a/TAO/orbsvcs/orbsvcs/ReplicaProxy.h b/TAO/orbsvcs/orbsvcs/ReplicaProxy.h
index 7527c48b559..ef297cda029 100644
--- a/TAO/orbsvcs/orbsvcs/ReplicaProxy.h
+++ b/TAO/orbsvcs/orbsvcs/ReplicaProxy.h
@@ -58,6 +58,9 @@ public:
CORBA::Object_ptr replica (void);
// Return a reference to the Replica.
+ int has_high_load_;
+ // Has the high load advisory been sent
+
LoadBalancing::ReplicaControl_var control_;
// Reference to the ReplicaControl.
diff --git a/TAO/orbsvcs/tests/LoadBalancing/Hash_ReplicaControl.cpp b/TAO/orbsvcs/tests/LoadBalancing/Hash_ReplicaControl.cpp
index ccef025c8c8..cb60acf0482 100644
--- a/TAO/orbsvcs/tests/LoadBalancing/Hash_ReplicaControl.cpp
+++ b/TAO/orbsvcs/tests/LoadBalancing/Hash_ReplicaControl.cpp
@@ -46,11 +46,8 @@ Hash_ReplicaControl::init (CORBA::ORB_ptr orb,
int
Hash_ReplicaControl::handle_timeout (const ACE_Time_Value &,
- void *)
+ const void *)
{
- ACE_DEBUG ((LM_DEBUG,
- "Hash_ReplicaControl::handle_timeout\n"));
-
ACE_Time_Value elapsed_time =
ACE_OS::gettimeofday () - this->interval_start_;
this->interval_start_ = ACE_OS::gettimeofday ();
@@ -61,7 +58,7 @@ Hash_ReplicaControl::handle_timeout (const ACE_Time_Value &,
this->interval_start_ = ACE_OS::gettimeofday ();
this->current_load_ =
- 0.25F * this->current_load_ + 0.75F * load;
+ 0.9F * this->current_load_ + 0.1F * load;
ACE_TRY_NEW_ENV
{
@@ -108,7 +105,7 @@ Hash_ReplicaControl::nominal_load_advisory (CORBA::Environment &
{
// Notify the replica that it should once again accept requests.
this->replica_.reject_requests (0);
- ACE_DEBUG ((LM_DEBUG, "**** Load is nomimal\n"));
+ ACE_DEBUG ((LM_DEBUG, "**** Load is nominal\n"));
}
// ****************************************************************
@@ -120,9 +117,7 @@ Timeout_Adapter::Timeout_Adapter (Hash_ReplicaControl *adaptee)
int
Timeout_Adapter::handle_timeout (const ACE_Time_Value &current_time,
- void *arg)
+ const void *arg)
{
- ACE_DEBUG ((LM_DEBUG,
- "Hash_ReplicaControl::handle_timeout\n"));
return this->adaptee_->handle_timeout (current_time, arg);
}
diff --git a/TAO/orbsvcs/tests/LoadBalancing/Hash_ReplicaControl.h b/TAO/orbsvcs/tests/LoadBalancing/Hash_ReplicaControl.h
index 6cc1a5e39d8..264f68edace 100644
--- a/TAO/orbsvcs/tests/LoadBalancing/Hash_ReplicaControl.h
+++ b/TAO/orbsvcs/tests/LoadBalancing/Hash_ReplicaControl.h
@@ -17,7 +17,7 @@ public:
// Receive the timeout event
virtual int handle_timeout (const ACE_Time_Value &current_time,
- void *arg);
+ const void *arg);
private:
Hash_ReplicaControl *adaptee_;
@@ -34,7 +34,7 @@ public:
CORBA::Environment &ACE_TRY_ENV);
int handle_timeout (const ACE_Time_Value &current_time,
- void *arg);
+ const void *arg);
// Handle a timeout event
void request_received (void);
diff --git a/TAO/orbsvcs/tests/LoadBalancing/client.cpp b/TAO/orbsvcs/tests/LoadBalancing/client.cpp
index 4e5b3cbb0dc..8f875e0be8c 100644
--- a/TAO/orbsvcs/tests/LoadBalancing/client.cpp
+++ b/TAO/orbsvcs/tests/LoadBalancing/client.cpp
@@ -9,6 +9,11 @@
#include "ace/Stats.h"
#include "ace/High_Res_Timer.h"
+static void run_test (int iterations,
+ int timeout,
+ Hash_Replica_ptr hasher,
+ CORBA::Environment &ACE_TRY_ENV);
+
int
main (int argc, char *argv[])
{
@@ -63,23 +68,7 @@ main (int argc, char *argv[])
ACE_TRY_ENV);
ACE_TRY_CHECK;
- ACE_Time_Value tv (0, timeout * 1000);
- ACE_Throughput_Stats stats;
- ACE_UINT64 test_start = ACE_OS::gethrtime ();
-
- for (long i = 0; i != iterations; ++i)
- {
- ACE_UINT64 call_start = ACE_OS::gethrtime ();
- hasher->do_hash (argv[0], ACE_TRY_ENV);
- ACE_TRY_CHECK;
- ACE_UINT64 end = ACE_OS::gethrtime ();
-
- stats.sample (end - test_start, end - call_start);
- ACE_OS::sleep (tv);
- }
-
- ACE_UINT32 gsf = ACE_High_Res_Timer::global_scale_factor ();
- stats.dump_results ("Hash Stats", gsf);
+ run_test (iterations, timeout, hasher.in (), ACE_TRY_ENV);
orb->destroy (ACE_TRY_ENV);
ACE_TRY_CHECK;
@@ -92,3 +81,29 @@ main (int argc, char *argv[])
return 0;
}
+
+void
+run_test (int iterations,
+ int timeout,
+ Hash_Replica_ptr hasher,
+ CORBA::Environment &ACE_TRY_ENV)
+{
+ ACE_Time_Value tv (0, timeout * 1000);
+ ACE_Throughput_Stats stats;
+ ACE_UINT64 test_start = ACE_OS::gethrtime ();
+
+ for (long i = 0; i != iterations; ++i)
+ {
+ ACE_UINT64 call_start = ACE_OS::gethrtime ();
+
+ hasher->do_hash ("This is a silly test", ACE_TRY_ENV);
+ ACE_CHECK;
+ ACE_UINT64 end = ACE_OS::gethrtime ();
+
+ stats.sample (end - test_start, end - call_start);
+ ACE_OS::sleep (tv);
+ }
+
+ ACE_UINT32 gsf = ACE_High_Res_Timer::global_scale_factor ();
+ stats.dump_results ("Hash Stats", gsf);
+}
diff --git a/TAO/orbsvcs/tests/LoadBalancing/server.cpp b/TAO/orbsvcs/tests/LoadBalancing/server.cpp
index a4f1cbbe41a..21d89f485d6 100644
--- a/TAO/orbsvcs/tests/LoadBalancing/server.cpp
+++ b/TAO/orbsvcs/tests/LoadBalancing/server.cpp
@@ -86,6 +86,10 @@ main (int argc, char *argv[])
ACE_TRY_ENV);
ACE_TRY_CHECK;
+#ifndef ACE_WIN32
+ orb->run (ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+#else
while (1)
{
ACE_Time_Value tv (1, 0);
@@ -93,6 +97,7 @@ main (int argc, char *argv[])
ACE_TRY_CHECK;
control.handle_timeout (tv, 0);
}
+#endif
root_poa->destroy (1, 1, ACE_TRY_ENV);
ACE_TRY_CHECK;