1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

sys/benchmark: Convert to ztimer

This commit is contained in:
Koen Zandberg 2021-11-03 13:04:54 +01:00
parent 6dbf1c3013
commit 8c2f0dd2af
No known key found for this signature in database
GPG Key ID: BA1718B37D79F51C
5 changed files with 10 additions and 6 deletions

View File

@ -570,7 +570,7 @@ ifneq (,$(filter nanocoap_%,$(USEMODULE)))
endif
ifneq (,$(filter benchmark,$(USEMODULE)))
USEMODULE += xtimer
USEMODULE += ztimer_usec
endif
ifneq (,$(filter skald_%,$(USEMODULE)))

View File

@ -7,5 +7,5 @@
config MODULE_BENCHMARK
bool "Simple benchmarks support"
depends on MODULE_XTIMER
depends on MODULE_ZTIMER_USEC
depends on TEST_KCONFIG

View File

@ -19,6 +19,7 @@
*/
#include <stdio.h>
#include "timex.h"
#include "benchmark.h"
@ -27,7 +28,7 @@ void benchmark_print_time(uint32_t time, unsigned long runs, const char *name)
uint32_t full = (time / runs);
uint32_t div = (time - (full * runs)) / (runs / 1000);
uint32_t per_sec = (uint32_t)(((uint64_t)1000000UL * runs) / time);
uint32_t per_sec = (uint32_t)(((uint64_t)US_PER_SEC * runs) / time);
printf("%25s: %9" PRIu32 "us"
" --- %2" PRIu32 ".%03" PRIu32 "us per call"

View File

@ -24,7 +24,7 @@
#include <stdint.h>
#include "irq.h"
#include "xtimer.h"
#include "ztimer.h"
#ifdef __cplusplus
extern "C" {
@ -43,11 +43,11 @@ extern "C" {
*/
#define BENCHMARK_FUNC(name, runs, func) \
{ \
uint32_t _benchmark_time = xtimer_now_usec(); \
uint32_t _benchmark_time = ztimer_now(ZTIMER_USEC); \
for (unsigned long i = 0; i < runs; i++) { \
func; \
} \
_benchmark_time = (xtimer_now_usec() - _benchmark_time);\
_benchmark_time = (ztimer_now(ZTIMER_USEC) - _benchmark_time);\
benchmark_print_time(_benchmark_time, runs, name); \
}

View File

@ -2,6 +2,9 @@ BOARD_INSUFFICIENT_MEMORY := \
arduino-duemilanove \
arduino-leonardo \
arduino-nano \
arduino-uno \
atmega328p-xplained-mini \
atmega328p \
nucleo-l011k4 \
samd10-xmini \
stm32f030f4-demo \