nuttx-apps/testing/libc/arch_libc/Kconfig

136 lines
2.7 KiB
Text
Raw Normal View History

#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
config TESTING_ARCH_LIBC
tristate "arch-specific libc function test"
default n
---help---
Enable the arch libc test
if TESTING_ARCH_LIBC
config TESTING_ARCH_LIBC_MEMCHR
bool "test memchr"
default y
config TESTING_ARCH_LIBC_MEMCMP
bool "test memcmp"
default y
config TESTING_ARCH_LIBC_MEMCPY
bool "test memcpy"
default y
config TESTING_ARCH_LIBC_MEMMOVE
bool "test memmove"
default y
config TESTING_ARCH_LIBC_MEMSET
bool "test memset"
default y
config TESTING_ARCH_LIBC_STRCHR
bool "test strchr"
default y
config TESTING_ARCH_LIBC_STRCMP
bool "test strcmp"
default y
config TESTING_ARCH_LIBC_STRCPY
bool "test strcpy"
default y
config TESTING_ARCH_LIBC_MEMCCPY
bool "test memccpy"
default y
config TESTING_ARCH_LIBC_STPNCPY
bool "test stpncpy"
default y
config TESTING_ARCH_LIBC_STRLCPY
bool "test strlcpy"
default y
config TESTING_ARCH_LIBC_STRLEN
bool "test strlen"
default y
config TESTING_ARCH_LIBC_STRNCMP
bool "test strncmp"
default y
config TESTING_ARCH_LIBC_STRNLEN
bool "test strnlen"
default y
config TESTING_ARCH_LIBC_STRNCPY
bool "test strncpy"
default y
config TESTING_ARCH_LIBC_STPCPY
bool "test stpcpy"
default y
config TESTING_ARCH_LIBC_STRCAT
bool "test strcat"
default y
config TESTING_ARCH_LIBC_STRRCHR
bool "test strrchr"
default y
config TESTING_ARCH_LIBC_STRCHRNUL
bool "test strchrnul"
default y
testing/libc/arch_libc: Add a throughput benchmark. The existing speed checks time one call at one size, 128 bytes, with both operands aligned. A machine implementation usually takes its wide path only when the pointers satisfy some alignment condition, so that single point reports the best case and says nothing about the rest of the input space. Measure the same functions across a size sweep and every source and destination alignment pair instead, plus strlcpy. On rv64 the difference this exposes is not marginal: strcpy 32768 B s+0/d+0 2938.0 MB/s strcpy 32768 B s+1/d+1 2942.0 MB/s strcpy 32768 B s+1/d+2 626.0 MB/s memcmp 32768 B s+0/d+0 412.4 MB/s memcmp 32768 B s+1/d+2 41.0 MB/s Two pointers misaligned by the same amount run at the aligned rate; misaligned by different amounts they fall to a tenth of it. Neither number is visible from an aligned measurement alone. A function with no machine implementation reports the same rate at every alignment, so the sweep also shows which of them a machine directory actually covers. Each result reports MB/s, which compares across machines, and cycles per byte where perf_gettime() is reachable from an application, both from one timed loop. strcat starts from an empty destination on each turn, since appending to the last result would grow it without bound, so its figure includes that store. It sits behind TESTING_ARCH_LIBC_BENCH, default n, because a measurement runs for a fixed interval and a full sweep takes about a minute. Assisted-by: Claude:claude-opus-5 Signed-off-by: Justin Hammond <justin@dynam.ac>
2026-08-15 13:19:20 +08:00
config TESTING_ARCH_LIBC_BENCH
bool "throughput benchmark"
default n
---help---
Measure each function across a size sweep and every source and
destination alignment pair, reporting MB/s and cycles per byte.
An implementation usually takes its wide path only when the
pointers meet some alignment condition, so an aligned measurement
alone does not show what the rest of the input space costs.
if TESTING_ARCH_LIBC_BENCH
config TESTING_ARCH_LIBC_BENCH_BUFSIZE
int "benchmark buffer size"
default 262144
---help---
Size of each of the two buffers the benchmark allocates.
config TESTING_ARCH_LIBC_BENCH_MINMS
int "minimum milliseconds per measurement"
default 250
---help---
Each measurement repeats until it has run for at least this long.
endif
config TESTING_ARCH_LIBC_PROGNAME
string "Program name"
default "arch_libctest"
---help---
This is the name of the program that will be used when the NSH ELF
program is installed.
config TESTING_ARCH_LIBC_PRIORITY
int "arch libc test priority"
default 100
config TESTING_ARCH_LIBC_STACKSIZE
int "arch libc test stack size"
default DEFAULT_TASK_STACKSIZE
config TESTING_ARCH_LIBC_VERBOSE
bool "Verbose output"
default n
endif