clock: turn expensive division into multiply + cheap division
authorJens Axboe <axboe@kernel.dk>
Fri, 21 Dec 2012 21:54:56 +0000 (22:54 +0100)
committerJens Axboe <axboe@kernel.dk>
Fri, 21 Dec 2012 21:54:56 +0000 (22:54 +0100)
commit71339117638469372f703332d8b969382b12c49b
treeab8c0a5e51204dfb704f47f9b7c3d2f152029409
parent4e59017dd2a031f2b7fbe2931d3c602735b6cfd6
clock: turn expensive division into multiply + cheap division

On x86-64, dividing by a variable turns into a hugely expensive
divq. It's much cheaper to invert the division. Instead of
dividing clocks by clocks-per-usec, multiply by a 16M/clocks-per-usec
constant instead.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
gettime.c