summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_LeastLoaded.inl
blob: d2d3dc420cda6d499f95623f58ebfae2c6a2232b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// -*- C++ -*-
//
// $Id$

ACE_INLINE CORBA::Float
TAO_LB_LeastLoaded::raw_load (CORBA::Float load)
{
  return this->dampened_load (load + this->per_balance_load_);
}


ACE_INLINE CORBA::Float
TAO_LB_LeastLoaded::raw_load (CORBA::Float load)
{
  return this->dampened_load (load + this->per_balance_load_);
}


ACE_INLINE CORBA::Float
TAO_LB_LeastLoaded::effective_load (CORBA::Float previous_load,
                                    CORBA::Float new_load)
{
  // Apply per-balance load.  (Recompute raw load)
  previous_load += this->per_balance_load_;

  // Apply dampening.  (Recompute new raw load)
  CORBA::Float result =
    this->dampening_ * previous_load + (1 - this->dampening_) * new_load;

  ACE_ASSERT (this->tolerance_ != 0);

  // Compute th effective load.
  result = raw_load / this->tolerance_;

  return result;
}