Beispiel #1
0
 double get(const Time& t, double K) const {
     Duration diff = t - _t;
     double dt = diff.toSeconds();
     if (dt<1.0e-9) {
         return _value;
     }
     double blend = exp(-dt/K);
     uint32 new_bytes = _backlog;
     return _value*blend+(1-blend)*new_bytes/dt;
 }
Beispiel #2
0
 double estimate_rate(const Time& t, uint32 len, double K) {
     Duration diff = t - _t;
     double dt = diff.toSeconds();
     if (dt<1.0e-9) {
         _backlog += len;
         return _value;
     }
     double blend = exp(-dt/K);
     uint32 new_bytes = len + _backlog;
     _value=_value*blend+(1-blend)*new_bytes/dt;
     _t = t;
     _backlog = 0;
     return _value;
 }
void TimerSpeedBenchmark::start() {
    mForceStop = false;

    // Check throughput of timer calls
    Time start_time = Timer::now();

    Time dummy_t = Time::null();
    for(uint32 ii = 0; ii < ITERATIONS && !mForceStop; ii++)
        dummy_t = Timer::now();

    if (mForceStop)
        return;

    Time end_time = Timer::now();
    Duration dur = end_time - start_time;

    SILOG(benchmark,info,
          ITERATIONS << " timer invokations, " << dur << ": "
          << (dur.toMicroseconds()*1000/float(ITERATIONS)) << "ns/call, "
          << float(ITERATIONS)/dur.toSeconds() << " calls/s");

    notifyFinished();
}
Beispiel #4
0
 PositionType position(const Duration& dt) const {
     return Base::value().position() + Base::value().velocity() * dt.toSeconds();
 }
Beispiel #5
0
 MotionVector extrapolate(const Duration& dt) const {
     return MotionVector(mStart + mDirection * dt.toSeconds(), mDirection);
 }