Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12942 from kaspar030/xtimer_bench_listop
tests/bench_xtimer: initial import
- Loading branch information
Showing
4 changed files
with
464 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
include ../Makefile.tests_common | ||
|
||
USEMODULE += xtimer | ||
|
||
# this test uses 1000 timers by default. for boards that boards don't have | ||
# enough memory, reduce that to 100 or 20, unless NUMOF_TIMERS has been overridden. | ||
LOW_MEMORY_BOARDS += \ | ||
airfy-beacon \ | ||
arduino-mega2560 \ | ||
b-l072z-lrwan1 \ | ||
blackpill \ | ||
blackpill-128kib \ | ||
bluepill \ | ||
bluepill-128kib \ | ||
calliope-mini \ | ||
cc1352-launchpad \ | ||
cc2650-launchpad \ | ||
cc2650stk \ | ||
chronos \ | ||
hifive1 \ | ||
hifive1b \ | ||
i-nucleo-lrwan1 \ | ||
lsn50 \ | ||
maple-mini \ | ||
microbit \ | ||
msb-430 \ | ||
msb-430h \ | ||
nrf51dongle \ | ||
nrf6310 \ | ||
nucleo-f030r8 \ | ||
nucleo-f042k6 \ | ||
nucleo-f070rb \ | ||
nucleo-f072rb \ | ||
nucleo-f103rb \ | ||
nucleo-f303k8 \ | ||
nucleo-f334r8 \ | ||
nucleo-l031k6 \ | ||
nucleo-l053r8 \ | ||
nucleo-l073rz \ | ||
opencm904 \ | ||
saml10-xpro \ | ||
saml11-xpro \ | ||
spark-core \ | ||
stm32f0discovery \ | ||
stm32l0538-disco \ | ||
telosb \ | ||
waspmote-pro \ | ||
wsn430-v1_3b \ | ||
wsn430-v1_4 \ | ||
yunjia-nrf51822 \ | ||
z1 \ | ||
# | ||
|
||
SUPER_LOW_MEMORY_BOARDS += \ | ||
arduino-duemilanove \ | ||
arduino-leonardo \ | ||
arduino-nano \ | ||
arduino-uno \ | ||
atmega328p \ | ||
nucleo-f031k6 \ | ||
stm32f030f4-demo \ | ||
# | ||
|
||
ifneq (, $(filter $(BOARD), $(LOW_MEMORY_BOARDS))) | ||
NUMOF_TIMERS ?= 100 | ||
endif | ||
|
||
ifneq (, $(filter $(BOARD), $(SUPER_LOW_MEMORY_BOARDS))) | ||
NUMOF_TIMERS ?= 20 | ||
endif | ||
|
||
NUMOF_TIMERS ?= 1000 | ||
|
||
CFLAGS += -DNUMOF_TIMERS=$(NUMOF_TIMERS) | ||
|
||
include $(RIOTBASE)/Makefile.include |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# Introduction | ||
|
||
This test executes some benchmarks for xtimer's set() / remove() / now() | ||
operations. | ||
|
||
# Details | ||
|
||
This set of benchmarks measures xtimer's list operation efficiency. | ||
Depending on the available memory, the individual benchmarks that are using | ||
multiple timers are run with either 1000 (the default), 100 or 20 timers. | ||
Each benchmark is repeated REPEAT times (default 1000). | ||
As only the operations are benchmarked, it is asserted that no timer ever | ||
actually triggers. | ||
|
||
### set() one | ||
|
||
This repeatedly sets one timer in an otherwise emtpy list. | ||
All but the first iteration will cause xtimer to implicitly remove the timer | ||
first. | ||
All iterations will cause the underlying periph timer to be updated. | ||
|
||
### remove() one | ||
|
||
This repeatedly removes one timer from the list. In all but the first iteration, | ||
this list will be empty. | ||
|
||
|
||
### set() + remove() one | ||
|
||
This repeatedly first sets, then removes one timer. The list is empty | ||
before and after each iteration. | ||
All iterations will cause the underlying periph timer to be updated. | ||
|
||
### set() many increasing targets | ||
|
||
This adds NUMOF timers with increasing target times. Each iteration will add a | ||
timer at the end of xtimer's timer list. | ||
Only the first iteration will cause the underlying periph timer to be updated. | ||
After this test, the list is populated with NUMOF timers. | ||
|
||
### re-set() first | ||
|
||
This repatedly re-sets the first timer in the list (to the same target time). | ||
All iterations will cause the underlying periph timer to be updated. | ||
|
||
### re-set() middle | ||
|
||
This repatedly re-sets the timer in the middle of the list (to the same target | ||
time). | ||
|
||
### re-set() last | ||
|
||
This repatedly re-sets the last timer in the list (to the same target time). | ||
|
||
### remove() + set() first, middle, last | ||
|
||
Same as the previous three, but does a remove() before set(). | ||
|
||
### remove() many decreasing | ||
|
||
This removes all timers from the list, starting with the last. | ||
|
||
### xtimer_now() | ||
|
||
This simply calls xtimer_now() in a loop. | ||
|
||
|
||
# How to interpret results | ||
|
||
The aim is to measure the time spent in xtimer's list operations. | ||
Lower values are better. | ||
The first/middle/last tests give an idea of the best case / average case / | ||
worst case when running the operation with NUMOF timers. | ||
Note that every set() on an already set timer will trigger an implicit remove(), | ||
thus the timer list has to be iterated twice. | ||
The tests that do a remove() before set() show whether xtimer correctly | ||
identifies an unset timer. |
Oops, something went wrong.