sched: eliminate floating point in calculating byte clock
authorStephen Hemminger <stephen@networkplumber.org>
Sun, 29 Nov 2015 18:46:49 +0000 (10:46 -0800)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Sun, 13 Mar 2016 22:31:59 +0000 (23:31 +0100)
commit03d00293ca7668dfc25741e23fbef18b80105b29
treeea627e46fdcc60b2b878aed9a6ba87b4f8b90dd9
parentffe3ec811ef5028426dfbeb3b2927d1216f4b2f5
sched: eliminate floating point in calculating byte clock

The old code was doing a floating point divide for each rte_dequeue()
which is very expensive. Change to using fixed point scaled inverse
multiply. To maintain equivalent precision, scaled math is used.
The application ABI is the same.

This improved performance from 5Gbit/sec to 10 Gbit/sec when configured
for 10 Gbit/sec rate.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
lib/librte_sched/rte_sched.c