コード例 #1
0
ファイル: RateEstimator.hpp プロジェクト: Waqee/sirikata
 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;
 }
コード例 #2
0
ファイル: RateEstimator.hpp プロジェクト: Waqee/sirikata
 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;
 }
コード例 #3
0
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();
}
コード例 #4
0
ファイル: MotionVector.hpp プロジェクト: SpaceCadetNia/elysia
 PositionType position(const Duration& dt) const {
     return Base::value().position() + Base::value().velocity() * dt.toSeconds();
 }
コード例 #5
0
ファイル: MotionVector.hpp プロジェクト: SpaceCadetNia/elysia
 MotionVector extrapolate(const Duration& dt) const {
     return MotionVector(mStart + mDirection * dt.toSeconds(), mDirection);
 }