tests: timer_monotonic: Use volatile for timing variables
This commit adds the `volatile` qualifier to the timing variables, in order to ensure that the compiler does not try to optimise the test in a way that can affect the execution time measurements. Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
This commit is contained in:
parent
a195f98265
commit
b744130735
|
@ -10,7 +10,8 @@
|
|||
|
||||
int test_frequency(void)
|
||||
{
|
||||
uint32_t start, end, delta, pct;
|
||||
volatile uint32_t start, end;
|
||||
uint32_t delta, pct;
|
||||
|
||||
TC_PRINT("Testing system tick frequency\n");
|
||||
|
||||
|
@ -49,7 +50,8 @@ int test_frequency(void)
|
|||
*/
|
||||
void test_timer(void)
|
||||
{
|
||||
uint32_t t_last, t_now, i, errors;
|
||||
volatile uint32_t t_last, t_now;
|
||||
uint32_t i, errors;
|
||||
int32_t diff;
|
||||
|
||||
errors = 0U;
|
||||
|
|
Loading…
Reference in a new issue