Skip to content

Commit

Permalink
fixup! tests: add ztimer test applications
Browse files Browse the repository at this point in the history
  • Loading branch information
kaspar030 committed Dec 6, 2019
1 parent 1eeef8c commit 1ac3842
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
DEVELHELP ?= 0
include ../Makefile.tests_common

USEMODULE += ztimer ztimer_periph ztimer_convert ztimer_extend
USEMODULE += ztimer ztimer_periph ztimer_overhead

include $(RIOTBASE)/Makefile.include
18 changes: 9 additions & 9 deletions tests/ztimer_diff/main.c → tests/ztimer_overhead/main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 Kaspar Schleiser <kaspar@schleiser.de>
* Copyright (C) 2019 Kaspar Schleiser <kaspar@schleiser.de>
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
Expand All @@ -11,7 +11,7 @@
* @{
*
* @file
* @brief ztimer diff test application
* @brief ztimer overhead test application
*
* @author Kaspar Schleiser <kaspar@schleiser.de>
*
Expand All @@ -31,7 +31,7 @@ static ztimer_periph_t _ztimer_periph;

int main(void)
{
ztimer_periph_init(&_ztimer_periph, 0, 1000000LU);
ztimer_periph_init(&_ztimer_periph, 0, 1000000LU, 0xffffffff);

uint32_t total = 0;

Expand All @@ -40,13 +40,13 @@ int main(void)

unsigned n = SAMPLES;
while (n--) {
unsigned diff = ztimer_diff((ztimer_dev_t *)&_ztimer_periph, 1000);
total += diff;
if (diff < min) {
min = diff;
unsigned overhead = ztimer_overhead(&_ztimer_periph.super, 1000);
total += overhead;
if (overhead < min) {
min = overhead;
}
else if (diff > max) {
max = diff;
else if (overhead > max) {
max = overhead;
}
}

Expand Down

0 comments on commit 1ac3842

Please sign in to comment.