Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 03070 static void recalc_holdtime(struct queue_ent *qe, int newholdtime)
- 03071 {
- 03072 int oldvalue;
- 03073
- 03074 /* Calculate holdtime using an exponential average */
- 03075 /* Thanks to SRT for this contribution */
- 03076 /* 2^2 (4) is the filter coefficient; a higher exponent would give old entries more weight */
- 03077
- 03078 ao2_lock(qe->parent);
- 03079 oldvalue = qe->parent->holdtime;
- 03080 qe->parent->holdtime = (((oldvalue << 2) - oldvalue) + newholdtime) >> 2;
- 03081 ao2_unlock(qe->parent);
- 03082 }
Add Comment
Please, Sign In to add comment