benchmarks:Move the performance tools to benchmark.

1.dhrystone
2.fio
3.coremark-pro

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
This commit is contained in:
chenrun1 2023-11-06 21:39:42 +08:00 committed by Xiang Xiao
parent e6c3930b2d
commit 270fa07cbd
10 changed files with 441 additions and 1 deletions

View File

@ -0,0 +1,81 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
menuconfig BENCHMARK_COREMARK_PRO
bool "Coremark Pro Benchmark"
default n
depends on LIBC_FLOATINGPOINT
if BENCHMARK_COREMARK_PRO
config BENCHMARK_COREMARK_PRO_STACKSIZE
int "Coremark Pro stack size"
default 131072
config BENCHMARK_COREMARK_PRO_PRIORITY
int "Coremark Pro priority"
default 100
config BENCHMARK_COREMARK_PRO_USE_SINGLE_CONTEXT
bool "use single context"
default n
config BENCHMARK_COREMARK_PRO_SMP
bool "Relevant configurations in case of SMP"
default n
depends on SMP && !BENCHMARK_COREMARK_PRO_USE_SINGLE_CONTEXT
config BENCHMARK_COREMARK_PRO_64BIT
bool "Running on 64-bit operating systems"
default n
config BENCHMARK_COREMARK_PRO_USE_FP64
bool "USE FP64 Data for Test"
default n
config BENCHMARK_COREMARK_PRO_CORE_TEST
bool "Core Test"
default n
config BENCHMARK_COREMARK_PRO_CJPEG_TEST
bool "cjpeg-rose7-preset"
default n
---help---
Before using this case, place the files in coremark-pro/benchmarks/libbmp
and coremark-pro/benchmarks/libjpeg in /data/libbmp and /data/libjpeg
respectively
config BENCHMARK_COREMARK_PRO_LINEAR_ALG_MID_TEST
bool "Linear_alg_mid TEST"
default n
config BENCHMARK_COREMARK_PRO_SHA_TEST
bool "SHA Test"
default n
config BENCHMARK_COREMARK_PRO_ZIP_TEST
bool "Zip Test"
depends on LIB_ZLIB
default n
choice
prompt "Coremark Pro FP Test Case configuration"
default BENCHMARK_COREMARK_PRO_RADIX_TEST
config BENCHMARK_COREMARK_PRO_RADIX_TEST
bool "Radix Test"
config BENCHMARK_COREMARK_PRO_LOOPS_ALL_MID_TEST
bool "Loops-all-mid test"
config BENCHMARK_COREMARK_PRO_NNET_TEST
bool "Nnet Test"
config BENCHMARK_COREMARK_PRO_PARSER_125K
bool "Parser 125K Test"
endchoice
endif

View File

@ -0,0 +1,23 @@
############################################################################
# apps/benchmarks/coremark-pro/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_COREMARK_PRO),)
CONFIGURED_APPS += $(APPDIR)/benchmarks/coremark-pro
endif

View File

@ -0,0 +1,140 @@
############################################################################
# apps/benchmarks/coremark-pro/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
PRIORITY = $(CONFIG_BENCHMARK_COREMARK_PRO_PRIORITY)
STACKSIZE = $(CONFIG_BENCHMARK_COREMARK_PRO_STACKSIZE)
MODULE = $(CONFIG_BENCHMARK_COREMARK_PRO)
CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/benchmarks/coremark-pro/coremark-pro/mith/include
CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/benchmarks/coremark-pro/coremark-pro/mith/al/include
CFLAGS += -DNDEBUG -DHOST_EXAMPLE_CODE=1 -DHAVE_SYS_STAT_H=1 \
-DGCC_INLINE_MACRO=1 -DMAX_CONTEXTS=100 -DEE_SIZEOF_INT=4 \
ifneq ($(CONFIG_BENCHMARK_COREMARK_PRO_USE_SINGLE_CONTEXT),)
CFLAGS += -DUSE_SINGLE_CONTEXT=1 -DHAVE_PTHREAD=0 -DUSE_NATIVE_PTHREAD=0
else
CFLAGS += -DUSE_SINGLE_CONTEXT=0 -DHAVE_PTHREAD=1 -DUSE_NATIVE_PTHREAD=1
endif
ifneq ($(CONFIG_BENCHMARK_COREMARK_PRO_SMP),)
CFLAGS += -DHAVE_PTHREAD_SETAFFINITY_NP=1 -DHAVE_PTHREAD_SELF=1
endif
ifneq ($(CONFIG_BENCHMARK_COREMARK_PRO_64BIT),)
CFLAGS += -DEE_SIZEOF_PTR=8 -DEE_PTR_ALIGN=8 -DEE_SIZEOF_LONG=8
endif
ifneq ($(CONFIG_BENCHMARK_COREMARK_PRO_USE_FP64),)
CFLAGS += -DUSE_FP64=1
CSRCS += coremark-pro/benchmarks/fp/linpack/ref/inputs_f64.c
else
CFLAGS += -DUSE_FP32=1
CSRCS += coremark-pro/benchmarks/fp/linpack/ref/inputs_f32.c
endif
CSRCS += coremark-pro/mith/src/md5.c
CSRCS += coremark-pro/mith/src/mith_lib.c
CSRCS += coremark-pro/mith/src/mith_workload.c
CSRCS += coremark-pro/mith/src/th_bignum.c
CSRCS += coremark-pro/mith/src/th_encode.c
CSRCS += coremark-pro/mith/src/th_lib.c
CSRCS += coremark-pro/mith/src/th_math.c
CSRCS += coremark-pro/mith/src/th_rand.c
CSRCS += $(wildcard coremark-pro/mith/al/src/*.c)
ifneq ($(CONFIG_BENCHMARK_COREMARK_PRO_CORE_TEST),)
CSRCS += $(wildcard coremark-pro/benchmarks/core/*.c)
MAINSRC += coremark-pro/workloads/core/core.c
PROGNAME += core
endif
ifneq ($(CONFIG_BENCHMARK_COREMARK_PRO_CJPEG_TEST),)
CSRCS += $(wildcard coremark-pro/benchmarks/consumer_v2/cjpeg/*.c)
CSRCS += $(wildcard coremark-pro/benchmarks/consumer_v2/cjpeg/data/Rose256_bmp.c)
MAINSRC += coremark-pro/workloads/cjpeg-rose7-preset/cjpeg-rose7-preset.c
PROGNAME += cjpeg_rose7_preset
endif
ifneq ($(CONFIG_BENCHMARK_COREMARK_PRO_SHA_TEST),)
CSRCS += $(wildcard coremark-pro/benchmarks/darkmark/sha/*.c)
MAINSRC += coremark-pro/workloads/sha-test/sha-test.c
PROGNAME += sha_test
endif
ifneq ($(CONFIG_BENCHMARK_COREMARK_PRO_ZIP_TEST),)
CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/system/zlib/zlib
CFLAGS += -Dgzclose_r=coremark_zip_gzclose_r -Dgzclose_w=coremark_zip_gzclose_w
CSRCS += coremark-pro/benchmarks/darkmark/zip/zip_darkmark.c
MAINSRC += coremark-pro/workloads/zip-test/zip-test.c
PROGNAME += zip_test
endif
ifneq ($(CONFIG_BENCHMARK_COREMARK_PRO_LINEAR_ALG_MID_TEST),)
CSRCS += coremark-pro/benchmarks/fp/linpack/linpack.c
MAINSRC += coremark-pro/workloads/linear_alg-mid-100x100-sp/linear_alg-mid-100x100-sp.c
PROGNAME += linear_alg_mid_100x100_sp
endif
ifneq ($(CONFIG_BENCHMARK_COREMARK_PRO_RADIX_TEST),)
ifneq ($(CONFIG_BENCHMARK_COREMARK_PRO_USE_FP64),)
CSRCS += $(wildcard coremark-pro/benchmarks/fp/fft_radix2/ref/*.c)
else
CSRCS += $(wildcard coremark-pro/benchmarks/fp/fft_radix2/ref-sp/*.c)
endif
CSRCS += coremark-pro/benchmarks/fp/fft_radix2/fft_radix2.c
MAINSRC += coremark-pro/workloads/radix2-big-64k/radix2-big-64k.c
PROGNAME += radix2_big_64k
endif
ifneq ($(CONFIG_BENCHMARK_COREMARK_PRO_LOOPS_ALL_MID_TEST),)
ifneq ($(CONFIG_BENCHMARK_COREMARK_PRO_USE_FP64),)
CSRCS += $(wildcard coremark-pro/benchmarks/fp/loops/ref/*.c)
else
CSRCS += $(wildcard coremark-pro/benchmarks/fp/loops/ref-sp/*.c)
endif
CSRCS += coremark-pro/benchmarks/fp/loops/loops.c
MAINSRC += coremark-pro/workloads/loops-all-mid-10k-sp/loops-all-mid-10k-sp.c
PROGNAME += loops_all_mid_10k_sp
endif
ifneq ($(CONFIG_BENCHMARK_COREMARK_PRO_NNET_TEST),)
ifneq ($(CONFIG_BENCHMARK_COREMARK_PRO_USE_FP64),)
CSRCS += $(wildcard coremark-pro/benchmarks/fp/nnet/ref/*.c)
else
CSRCS += $(wildcard coremark-pro/benchmarks/fp/nnet/ref-sp/*.c)
endif
CSRCS += $(wildcard coremark-pro/benchmarks/fp/nnet/*.c)
MAINSRC += coremark-pro/workloads/nnet_test/nnet_test.c
PROGNAME += nnet_test
endif
ifneq ($(CONFIG_BENCHMARK_COREMARK_PRO_PARSER_125K),)
CSRCS += $(wildcard coremark-pro/benchmarks/darkmark/parser/*.c)
MAINSRC += coremark-pro/workloads/parser-125k/parser-125k.c
PROGNAME += parser_125k
endif
include $(APPDIR)/Application.mk

View File

@ -0,0 +1,28 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
config BENCHMARK_DHRYSTONE
tristate "dhrystone benchmark"
default n
---help---
Dhrystone is one of the most common benchmark programs
for measuring the computing power of processors and is commonly
used to measure the performance of integer computing on processors.
if BENCHMARK_DHRYSTONE
config BENCHMARK_DHRYSTONE_PROGNAME
string "Program Name"
default "dhrystone"
config BENCHMARK_DHRYSTONE_STACKSIZE
int "utils dhrystone stack size"
default DEFAULT_TASK_STACKSIZE
config BENCHMARK_DHRYSTONE_PRIORITY
int "Task PRIORITY"
default 100
endif

View File

@ -0,0 +1,23 @@
############################################################################
# apps/benchmarks/dhrystone/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_DHRYSTONE),)
CONFIGURED_APPS += $(APPDIR)/benchmarks/dhrystone
endif

View File

@ -0,0 +1,36 @@
############################################################################
# apps/benchmarks/dhrystone/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
#dhrystone
PROGNAME = $(CONFIG_BENCHMARK_DHRYSTONE_PROGNAME)
PRIORITY = $(CONFIG_BENCHMARK_DHRYSTONE_PRIORITY)
STACKSIZE = $(CONFIG_BENCHMARK_DHRYSTONE_STACKSIZE)
MODULE = $(CONFIG_BENCHMARK_DHRYSTONE)
CFLAGS += -DMSC_CLOCK
CSRCS += dhrystone/v2.1/dhry_2.c
MAINSRC = dhrystone/v2.2/dry.c
include $(APPDIR)/Application.mk

24
benchmarks/fio/Kconfig Normal file
View File

@ -0,0 +1,24 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
config BENCHMARK_FIO
tristate "Flexible I/O Tester"
default n
depends on LIBC_MODLIB && LIBC_DLFCN
---help---
https://github.com/axboe/fio Fio spawns a number of threads or processes
doing a particular type of I/O action as specified by the user.
if BENCHMARK_FIO
config BENCHMARK_FIO_PRIORITY
int "fio task priority"
default 100
config BENCHMARK_FIO_STACKSIZE
int "fio stack size"
default 65536
endif

23
benchmarks/fio/Make.defs Normal file
View File

@ -0,0 +1,23 @@
############################################################################
# apps/benchmarks/fio/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_FIO),)
CONFIGURED_APPS += $(APPDIR)/benchmarks/fio
endif

62
benchmarks/fio/Makefile Normal file
View File

@ -0,0 +1,62 @@
############################################################################
# apps/benchmarks/fio/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
PROGNAME = fio
PRIORITY = $(CONFIG_BENCHMARK_FIO_PRIORITY)
STACKSIZE = $(CONFIG_BENCHMARK_FIO_STACKSIZE)
MODULE = $(CONFIG_BENCHMARK_FIO)
MAINSRC = $(CURDIR)/fio/fio.c
CFLAGS += -DCONFIG_GETTIMEOFDAY -DCONFIG_CLOCK_GETTIME -DCONFIG_HAVE_GETTID
CFLAGS += -DCONFIG_STATIC_ASSERT -DCONFIG_LITTLE_ENDIAN -DCONFIG_POSIX_FALLOCATE
CFLAGS += -DCONFIG_HAVE_BOOL -DFIO_INTERNAL -DCONFIG_NO_SHM
CFLAGS += -DFIO_VERSION='"1.2.0"' -DFIO_USE_GENERIC_SWAP
CFLAGS += -DFIO_USE_GENERIC_INIT_RANDOM_STATE -DFIO_USE_GENERIC_BDEV_SIZE
CFLAGS += -DBLOOM_SIZE=1024*1024 -DBUF_SIZE=512*1024
CFLAGS += -DMAX_POOLS=4 -DINITIAL_POOLS=2 -DINITIAL_SIZE=512*1024
CFLAGS += -DCONFIG_SEED_BUCKETS=8 -DBITS_PER_LONG=32
CFLAGS += -Ifio -Ifio/arch -Ifio/crc -Ifio/os
CFLAGS += -DXXH32_digest=fio_XXH32_digest -DXXH32_update=fio_XXH32_update -DXXH32=fio_XXH32 \
-Dparse_options=fio_parse_options -Dparse_option=fio_parse_option
ifneq ($(CONFIG_ARCH_ARM),)
CFLAGS += -D__ARM_ARCH_6__
endif
CSRCS += $(wildcard fio/lib/*.c)
CSRCS += $(wildcard fio/crc/*.c)
CSRCS += fio/gettime.c fio/ioengines.c fio/init.c fio/stat.c fio/log.c fio/time.c fio/filesetup.c \
fio/eta.c fio/verify.c fio/memory.c fio/io_u.c fio/parse.c fio/fio_sem.c fio/rwlock.c \
fio/pshared.c fio/options.c fio/smalloc.c fio/filehash.c fio/profile.c fio/debug.c \
fio/server.c fio/client.c fio/iolog.c fio/backend.c fio/libfio.c fio/flow.c fio/cconv.c \
fio/gettime-thread.c fio/helpers.c fio/json.c fio/idletime.c fio/td_error.c fio/zbd.c \
fio/profiles/tiobench.c fio/profiles/act.c fio/io_u_queue.c fio/filelock.c fio/steadystate.c \
fio/workqueue.c fio/rate-submit.c fio/optgroup.c fio/helper_thread.c fio/zone-dist.c \
fio/dedupe.c
CSRCS += fio/engines/exec.c fio/engines/cpu.c fio/engines/sync.c fio/engines/ftruncate.c \
fio/engines/falloc.c fio/engines/fileoperations.c fio/engines/mmap.c \
fio/engines/null.c fio/engines/net.c
include $(APPDIR)/Application.mk

View File

@ -1 +1 @@
iozone/
/iozone