mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-11 12:35:26 +00:00
The original Pit code encoded the start value of a timer into the count_load_time field as a number of nanoseconds since the start of the host's monotonic time value. Instead, we can use the PitCounter's creation_time as the epoch. This makes the math look a bit more sensible and removes the use of the non-portable clock_gettime() function. Before ====== get_channel_state(): count_load_time = get_monotonic_time() - start.elapsed() === count_load_time = now() - (now() - start) === count_load_time = start set_channel_state(): start = now() - (get_monotonic_time() - count_load_time) === start = now() - now() + count_load_time === start = count_load_time After ===== get_channel_state(): count_load_time = start - creation_time set_channel_state(): start = creation_time + count_load_time BUG=chromium:908689 BUG=b:213149155 TEST=cargo test -p devices pit TEST=tools/run_tests --target=host --arch=win64 Change-Id: I5468d1d964a04b1ce96979ed583b729d139e1005 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3723804 Reviewed-by: Noah Gold <nkgold@google.com> Reviewed-by: Vikram Auradkar <auradkar@google.com> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Daniel Verkamp <dverkamp@chromium.org> |
||
---|---|---|
.. | ||
base_event_token_derive | ||
src | ||
.build_test_serial | ||
Cargo.toml |