travelping / upg-vpp

User Plane Gateway (UPG) based on VPP
Apache License 2.0
146 stars 51 forks source link

[CENNSO-1275] Reduce room for floating point errors in timerwheel #355

Closed mogaika closed 11 months ago

mogaika commented 11 months ago

Truncate timerwheel init time and use pow2 clocks per second to basically convert internal time of timerwheel from f64 to i52 by avoiding any floating point rounding.

This reduces timerwheel capacity from ~2985 hours to ~2332 hours

Timerwheel internal time is subject to rounding error and before this patch imprecise calculations resulted in incorrect calculation of clock cycles inside timerwheel implementation.