benchmarks/cyclictest: the rt-tests cyclictest NuttX Port

Despite the existence of the patch in benchmarks/rt-tests,
this commit adds the NuttX Official cyclictest utility.

The main difference is the introduction of different
waiting methods next to POSIX clock_nanosleep:
- The thread can wait for a g_waitsem, posted by board_timerhook()
  if CONFIG_SYSTEMTICK_HOOK is defined.
  Since the semaphore is only one, only one thread can wait.
- The thread can wait for a Timer Device to timeout.
  The timer's timeout determines the waiting time of the thread.
  Since the timer is only one, again, only one thread can wait.

The user can measure the elapsed time using clock_gettime
or the timer device itself. The different waiting and measuring
methods were introduced because NuttX, by default, does not
offer fine measuring capabilities using POSIX time functions
(as of Feb 25).

Signed-off-by: Stepan Pressl <pressl.stepan@gmail.com>
This commit is contained in:
Stepan Pressl 2024-11-07 19:27:07 +01:00 committed by Alan C. Assis
parent 8fcff3e88c
commit 31daca45ba
5 changed files with 1229 additions and 0 deletions

View file

@ -0,0 +1,55 @@
# ##############################################################################
# apps/benchmarks/cyclictest/CMakeLists.txt
#
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. The ASF licenses this
# file to you under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
#
# ##############################################################################
if(CONFIG_BENCHMARK_CYCLICTEST)
# ############################################################################
# Config and Fetch Coremark application
# ############################################################################
set(CYCLICTEST_DIR ${CMAKE_CURRENT_LIST_DIR})
# ############################################################################
# Sources
# ############################################################################
set(CSRCS ${CYCLICTEST_DIR}/cyclictest.c)
# ############################################################################
# Applications Configuration
# ############################################################################
nuttx_add_application(
NAME
cyclictest
PRIORITY
${CONFIG_CYCLICTEST_PRIORITY}
STACKSIZE
${CONFIG_CYCLICTEST_STACKSIZE}
MODULE
${CONFIG_BENCHMARK_CYCLICTEST}
COMPILE_FLAGS
${CFLAGS}
SRCS
${CSRCS}
INCLUDE_DIRECTORIES
${INCDIR})
endif()

View file

@ -0,0 +1,29 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
menuconfig BENCHMARK_CYCLICTEST
bool "Cyclictest"
default n
---help---
Enable the cyclictest application.
if BENCHMARK_CYCLICTEST
config BENCHMARK_CYCLICTEST_PROGNAME
string "Cyclictest App Name"
default "cyclictest"
---help---
This is the name of the program that will be used when the NSH ELF
program is installed.
config BENCHMARK_CYCLICTEST_PRIORITY
int "Cyclictest task priority"
default 100
config BENCHMARK_CYCLICTEST_STACKSIZE
int "Cyclictest task stack size"
default 4096
endif # BENCHMARK_CYCLICTEST

View file

@ -0,0 +1,23 @@
############################################################################
# apps/benchmarks/cyclictest/Make.defs
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
############################################################################
ifneq ($(CONFIG_BENCHMARK_CYCLICTEST),)
CONFIGURED_APPS += $(APPDIR)/benchmarks/cyclictest
endif

View file

@ -0,0 +1,39 @@
############################################################################
# apps/benchmarks/cyclictest/Makefile
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
############################################################################
include $(APPDIR)/Make.defs
# spinlock_bench application
############################################################################
# Applications Configuration
############################################################################
MODULE = $(CONFIG_BENCHMARK_CYCLICTEST)
PROGNAME += $(CONFIG_BENCHMARK_CYCLICTEST_PROGNAME)
PRIORITY += $(CONFIG_BENCHMARK_CYCLICTEST_PRIORITY)
STACKSIZE += $(CONFIG_BENCHMARK_CYCLICTEST_STACKSIZE)
MAINSRC += cyclictest.c
# Build with WebAssembly when CONFIG_INTERPRETERS_WAMR is enabled
include $(APPDIR)/Application.mk

File diff suppressed because it is too large Load diff