This test executes some benchmarks for ztimer's set() / remove() / now() operations.
This set of benchmarks measures ztimer'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.
This repeatedly sets one timer in an otherwise empty list. All but the first iteration will cause ztimer to implicitly remove the timer first. All iterations will cause the underlying periph timer to be updated.
This repeatedly removes one timer from the list. In all but the first iteration, this list will be empty.
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.
This adds NUMOF timers with increasing target times. Each iteration will add a timer at the end of ztimer'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.
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.
This repatedly re-sets the timer in the middle of the list (to the same target time).
This repatedly re-sets the last timer in the list (to the same target time).
Same as the previous three, but does a remove() before set().
This removes all timers from the list, starting with the last.
This simply calls ztimer_now() in a loop.
The aim is to measure the time spent in ztimer'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 ztimer correctly identifies an unset timer.