3 Star 0 Fork 0

mirrors_zephyrproject-rtos/rtos-benchmark

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
CMakeLists.txt 1.66 KB
一键复制 编辑 原始数据 按行查看 历史
Bin Cao 提交于 2023-10-30 14:17 . common: Add message queue tests
cmake_minimum_required(VERSION 3.22)
set(AVAILABLE_TESTS
interrupt_latency
malloc_free
message_queue
mutex_lock_unlock
sem_context_switch
sem_signal_release
thread_switch_yield
thread)
set(AVAILABLE_RTOSES
zephyr
freertos)
set(ITERATIONS 10000 CACHE STRING "Number of iterations for each test")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DITERATIONS=${ITERATIONS}")
set(CALIBRATION_LOOPS 10000 CACHE STRING "Number of calibration loops for each test")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DCALIBRATION_LOOPS=${CALIBRATION_LOOPS}")
if (NOT RTOS IN_LIST AVAILABLE_RTOSES)
message(FATAL_ERROR "Choose either [zephyr] or [freertos]")
endif()
# Add include directory for bench_api.h and bench_utils.h
include_directories(h)
# Include any ${RTOS} specific build rules
include(src/${RTOS}/${RTOS}.cmake)
add_subdirectory(src/${RTOS})
project(bench)
list(LENGTH TEST tests_to_run)
if (${tests_to_run} EQUAL 0)
list(TRANSFORM AVAILABLE_TESTS REPLACE "(.+)" "src/common/bench_\\1_test.c" OUTPUT_VARIABLE sources)
target_sources(app PRIVATE ${sources})
target_sources(app PRIVATE src/common/bench_utils.c)
target_sources(app PRIVATE src/common/bench_all.c)
return()
endif()
if(NOT ${tests_to_run} EQUAL 1)
message(FATAL_ERROR "Choose exactly one test")
endif()
if (NOT ${TEST} IN_LIST AVAILABLE_TESTS)
list(JOIN AVAILABLE_TESTS "\n" pretty_print)
message(FATAL_ERROR "Choose one test from:\n${pretty_print}")
endif()
string(TOUPPER ${TEST} test_upper)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DRUN_${test_upper}")
target_sources(app PRIVATE src/common/bench_utils.c)
target_sources(app PRIVATE src/common/bench_${TEST}_test.c)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors_zephyrproject-rtos/rtos-benchmark.git
git@gitee.com:mirrors_zephyrproject-rtos/rtos-benchmark.git
mirrors_zephyrproject-rtos
rtos-benchmark
rtos-benchmark
main

搜索帮助