vectorgrp / sil-kit

Vector SIL Kit – Open-Source Library for Connecting Software-in-the-Loop Environments
https://vectorgrp.github.io/sil-kit-docs
MIT License
107 stars 32 forks source link

tests: fix usage of steady_clock in MetricsManager on windows #94

Closed MariusBgm closed 3 months ago

MariusBgm commented 3 months ago

Subject

Fix sporadic unit test failures on MSVC RelWithDebInfo builds.

Description

Turns out that the calls to steady_clock::now() return the same value sometimes (on Windows!). Those calls are now wrapped and checked against the previous value and it's ensured that the timestamp increases strictly monotonically.

Instructions for review / testing

Developer checklist (address before review)

MariusBgm commented 3 months ago

FYI @VDanielEdwards steady_clock::now() is weird on windows in RelWithDebInfo builds. Maybe we should switch to native performance counter APIs on Windows

VDanielEdwards commented 3 months ago

@MariusBgm and @KonradBkd thank you for the fix! I really need to keep clock granularity in mind 😸