vppinfra: preserve total_cpu_time across clock freq adjustment 09/23709/4
authorDave Barach <dave@barachs.net>
Sun, 1 Dec 2019 13:59:03 +0000 (08:59 -0500)
committerFlorin Coras <florin.coras@gmail.com>
Mon, 2 Dec 2019 23:00:21 +0000 (23:00 +0000)
commite52d8d880ac644f07154bc2fb94035a198ed6688
treeffbc53cdc8859504d32a6066b033394936332772
parent5ef9ca6c0de25993bde0dbc354cc4a5bc83ab0eb
vppinfra: preserve total_cpu_time across clock freq adjustment

If clib_time_verify_frequency() adjusts the clock frequency, transform
total_cpu_time to the new time coordinate space. Otherwise, we break
comparisons with previous clib_time_now() value.

Without this correction, time jumps in one direction or the other
depending on the sign of the frequency change. Reasonably harmless in
most cases, but under perfect storm conditions the wheels fall off.

Type: fix

Signed-off-by: Dave Barach <dave@barachs.net>
Change-Id: I21802c2630e2c87ff817cd732b7d78bc022cd2d7
src/vppinfra/time.c
src/vppinfra/time.h