#include <Flow.h>
List of all members.
Detailed Description
Definition at line 15 of file Flow.h.
Constructor & Destructor Documentation
ACE_RMCast::Flow::Flow |
( |
Parameters const & |
params |
) |
|
Member Function Documentation
void ACE_RMCast::Flow::recv |
( |
Message_ptr |
m |
) |
[virtual] |
void ACE_RMCast::Flow::send |
( |
Message_ptr |
m |
) |
[virtual] |
Reimplemented from ACE_RMCast::Out_Element.
Definition at line 18 of file Flow.cpp.
{
Flow::
Flow (Parameters const& params)
: params_ (params),
nak_time_ (0, 0),
sample_start_time_ (0, 0),
sample_bytes_ (0),
current_tput_ (0.0),
cap_tput_ (0.0)
{
}
void Flow::send (Message_ptr m)
{
if (Data const* data = static_cast<Data const*> (m->find (Data::id)))
{
ACE_Time_Value now_time (ACE_OS::gettimeofday ());
Lock l (mutex_);
sample_bytes_ += data->size ();
if (sample_start_time_ == ACE_Time_Value (0, 0))
{
sample_start_time_ = now_time;
}
else
{
ACE_Time_Value delta (now_time - sample_start_time_);
if (delta > ACE_Time_Value (0, 2000))
{
current_tput_ =
double (sample_bytes_) / (delta.sec () * 1000000 + delta.usec ());
sample_bytes_ = 0;
sample_start_time_ = ACE_Time_Value (0, 0);
}
}
if (cap_tput_ != 0.0
&& current_tput_ != 0.0
&& current_tput_ > cap_tput_)
{
double dev = (current_tput_ - cap_tput_) / current_tput_;
{
ACE_Time_Value delta (now_time - nak_time_);
unsigned long msec = delta.msec ();
double x = msec / -16000.0;
double y = 1.0 * exp (x);
cap_tput_ = cap_tput_ / y;
}
l.release ();
Member Data Documentation
The documentation for this class was generated from the following files: