src/tcpkali_pacefier.h
static inline void
pacefier_moved(struct pacefier *p, size_t moved, double now) {
    /*
     * The number of allowed events is almost always less
     * than what's actually computed.
     */
    p->previous_ts += moved / p->events_per_second;
    /*
     * If the process cannot keep up with the pace, it will result in
     * previous_ts shifting in the past more and more with time.
     * We don't allow more than 2/Rate seconds skew to prevent too sudden
     * bursts of events and to avoid overfilling the integers.
     */
    double wiggle_seconds;
    if(p->events_per_second > 1.0) {
        wiggle_seconds = 2.0;
    } else {
        wiggle_seconds = 2.0 / p->events_per_second;
    }
    if((now - p->previous_ts) > wiggle_seconds) {
        p->previous_ts = now - wiggle_seconds;
    }
}
/*
 * Record the actually moved events.
 */
Record the actually moved events.
Record the actually moved events .
static inline void
pacefier_moved(struct pacefier *p, size_t moved, double now) {
    p->previous_ts += moved / p->events_per_second;
    double wiggle_seconds;
    if(p->events_per_second > 1.0) {
        wiggle_seconds = 2.0;
    } else {
        wiggle_seconds = 2.0 / p->events_per_second;
    }
    if((now - p->previous_ts) > wiggle_seconds) {
        p->previous_ts = now - wiggle_seconds;
    }
}
static inline void pacefier_moved ( struct pacefier * p , size_t moved , double now ) { p -> previous_ts += moved / p -> events_per_second ; double wiggle_seconds ; if ( p -> events_per_second > 1.0 ) { wiggle_seconds = 2.0 ; } else { wiggle_seconds = 2.0 / p -> events_per_second ; } if ( ( now - p -> previous_ts ) > wiggle_seconds ) { p -> previous_ts = now - wiggle_seconds ; } }
Record the actually moved events.
Record the actually moved events .
/*
     * The number of allowed events is almost always less
     * than what's actually computed.
     */ /*
     * If the process cannot keep up with the pace, it will result in
     * previous_ts shifting in the past more and more with time.
     * We don't allow more than 2/Rate seconds skew to prevent too sudden
     * bursts of events and to avoid overfilling the integers.
     */