From 438e07b30ec38234f35baa04955d9d3c0358ca89 Mon Sep 17 00:00:00 2001 From: Xiao Xufeng Date: Tue, 25 Nov 2025 23:01:02 +0800 Subject: [PATCH] refactor: Remove idf_test component Split the idf_performance.h and target ver, which hold the performance thresholds, into the headers of each testing. In the past pytest also parse the common header to get the thresholds. Now the logic is also removed. Performance thresholds are supposed to be in the pytest scripts. --- .gitlab/CODEOWNERS | 1 - .../test_apps/adc/include/adc_performance.h | 27 ++++ .../adc/include/adc_performance_esp32.h | 8 ++ .../adc/include/adc_performance_esp32c2.h | 7 + .../adc/include/adc_performance_esp32c3.h} | 6 +- .../adc/include/adc_performance_esp32c5.h} | 6 +- .../adc/include/adc_performance_esp32c6.h | 13 ++ .../adc/include/adc_performance_esp32c61.h | 13 ++ .../adc/include/adc_performance_esp32h2.h | 13 ++ .../adc/include/adc_performance_esp32p4.h} | 11 +- .../adc/include/adc_performance_esp32s2.h | 13 ++ .../adc/include/adc_performance_esp32s3.h | 13 ++ .../esp_adc/test_apps/adc/main/CMakeLists.txt | 1 + .../test_apps/adc/main/test_adc_performance.c | 3 +- .../test_apps/include/sdio_performance.h | 12 ++ .../include/sdio_performance_esp32.h | 35 +++++ .../include/sdio_performance_esp32c6.h | 25 ++++ .../spi_bench_mark/include/spi_performance.h | 2 + .../test_apps/include/event_performance.h | 33 +++++ .../test_apps/main/test_event_target.c | 7 +- .../include/hw_support_performance.h | 17 +++ .../include/hw_support_performance_esp32.h | 8 ++ .../include/hw_support_performance_esp32c2.h | 9 ++ .../include/hw_support_performance_esp32c3.h | 9 ++ .../include/hw_support_performance_esp32h2.h | 9 ++ .../include/hw_support_performance_esp32s3.h | 8 ++ .../esp_hw_support_unity_tests/main/test_fp.c | 1 + .../test_apps/include/esp_timer_performance.h | 21 +++ .../include/esp_timer_performance_esp32c2.h | 13 ++ .../include/esp_timer_performance_esp32c5.h | 7 + .../include/esp_timer_performance_esp32c6.h | 7 + .../include/esp_timer_performance_esp32c61.h | 7 + .../include/esp_timer_performance_esp32h2.h} | 4 +- .../include/esp_timer_performance_esp32h21.h | 7 + .../esp_timer/test_apps/main/test_esp_timer.c | 4 +- .../freertos/include/freertos_performance.h | 30 ++++ .../include/freertos_performance_esp32p4.h | 12 ++ .../test_freertos_scheduling_time.c | 1 + .../freertos/performance/test_isr_latency.c | 2 + .../test_apps/freertos/port/test_spinlocks.c | 1 + .../heap/test_apps/include/heap_performance.h | 14 ++ components/idf_test/CMakeLists.txt | 7 - components/idf_test/README.md | 4 - .../include/esp32/idf_performance_target.h | 64 --------- .../include/esp32c3/idf_performance_target.h | 33 ----- .../include/esp32c6/idf_performance_target.h | 46 ------ .../include/esp32h4/idf_performance_target.h | 5 - .../include/esp32s3/idf_performance_target.h | 34 ----- components/idf_test/include/idf_performance.h | 132 ------------------ .../test_apps/include/crypto_performance.h | 22 +++ .../include/crypto_performance_esp32.h | 29 ++++ .../include/crypto_performance_esp32c2.h} | 17 +-- .../include/crypto_performance_esp32c3.h | 18 +++ .../include/crypto_performance_esp32c6.h | 14 ++ .../include/crypto_performance_esp32h2.h} | 17 +-- .../include/crypto_performance_esp32s2.h} | 11 +- .../include/crypto_performance_esp32s3.h | 19 +++ .../mbedtls/test_apps/main/test_aes_perf.c | 1 + components/mbedtls/test_apps/main/test_ecp.c | 2 + .../test_apps/main/test_mbedtls_ecdsa.c | 1 + .../mbedtls/test_apps/main/test_psa_rsa.c | 1 + components/mbedtls/test_apps/main/test_sha.c | 2 +- .../mbedtls/test_apps/main/test_sha_perf.c | 2 +- .../vfs/test_apps/include/vfs_performance.h | 26 ++++ components/vfs/test_apps/main/test_vfs_fd.c | 1 + .../test_apps/include/xtensa_performance.h | 10 ++ conftest.py | 55 -------- .../contribute/esp-idf-tests-with-pytest.rst | 2 +- .../contribute/esp-idf-tests-with-pytest.rst | 2 +- .../iperf/include/eth_iperf_performance.h | 33 +++++ examples/ethernet/iperf/pytest_eth_iperf.py | 67 +++++---- .../iperf/include/wifi_iperf_performance.h | 20 +++ examples/wifi/iperf/pytest_iperf.py | 30 ++-- tools/ci/check_copyright_ignore.txt | 1 - tools/ci/check_public_headers_exceptions.txt | 1 - .../components/test_utils/CMakeLists.txt | 2 +- .../test_utils/include/test_utils.h | 3 - 77 files changed, 676 insertions(+), 498 deletions(-) create mode 100644 components/esp_adc/test_apps/adc/include/adc_performance.h create mode 100644 components/esp_adc/test_apps/adc/include/adc_performance_esp32.h create mode 100644 components/esp_adc/test_apps/adc/include/adc_performance_esp32c2.h rename components/{idf_test/include/esp32c5/idf_performance_target.h => esp_adc/test_apps/adc/include/adc_performance_esp32c3.h} (80%) rename components/{idf_test/include/esp32c61/idf_performance_target.h => esp_adc/test_apps/adc/include/adc_performance_esp32c5.h} (80%) create mode 100644 components/esp_adc/test_apps/adc/include/adc_performance_esp32c6.h create mode 100644 components/esp_adc/test_apps/adc/include/adc_performance_esp32c61.h create mode 100644 components/esp_adc/test_apps/adc/include/adc_performance_esp32h2.h rename components/{idf_test/include/esp32p4/idf_performance_target.h => esp_adc/test_apps/adc/include/adc_performance_esp32p4.h} (57%) create mode 100644 components/esp_adc/test_apps/adc/include/adc_performance_esp32s2.h create mode 100644 components/esp_adc/test_apps/adc/include/adc_performance_esp32s3.h create mode 100644 components/esp_driver_sdio/test_apps/include/sdio_performance.h create mode 100644 components/esp_driver_sdio/test_apps/include/sdio_performance_esp32.h create mode 100644 components/esp_driver_sdio/test_apps/include/sdio_performance_esp32c6.h create mode 100644 components/esp_event/test_apps/include/event_performance.h create mode 100644 components/esp_hw_support/test_apps/esp_hw_support_unity_tests/include/hw_support_performance.h create mode 100644 components/esp_hw_support/test_apps/esp_hw_support_unity_tests/include/hw_support_performance_esp32.h create mode 100644 components/esp_hw_support/test_apps/esp_hw_support_unity_tests/include/hw_support_performance_esp32c2.h create mode 100644 components/esp_hw_support/test_apps/esp_hw_support_unity_tests/include/hw_support_performance_esp32c3.h create mode 100644 components/esp_hw_support/test_apps/esp_hw_support_unity_tests/include/hw_support_performance_esp32h2.h create mode 100644 components/esp_hw_support/test_apps/esp_hw_support_unity_tests/include/hw_support_performance_esp32s3.h create mode 100644 components/esp_timer/test_apps/include/esp_timer_performance.h create mode 100644 components/esp_timer/test_apps/include/esp_timer_performance_esp32c2.h create mode 100644 components/esp_timer/test_apps/include/esp_timer_performance_esp32c5.h create mode 100644 components/esp_timer/test_apps/include/esp_timer_performance_esp32c6.h create mode 100644 components/esp_timer/test_apps/include/esp_timer_performance_esp32c61.h rename components/{idf_test/include/esp32h21/idf_performance_target.h => esp_timer/test_apps/include/esp_timer_performance_esp32h2.h} (68%) create mode 100644 components/esp_timer/test_apps/include/esp_timer_performance_esp32h21.h create mode 100644 components/freertos/test_apps/freertos/include/freertos_performance.h create mode 100644 components/freertos/test_apps/freertos/include/freertos_performance_esp32p4.h create mode 100644 components/heap/test_apps/include/heap_performance.h delete mode 100644 components/idf_test/CMakeLists.txt delete mode 100644 components/idf_test/README.md delete mode 100644 components/idf_test/include/esp32/idf_performance_target.h delete mode 100644 components/idf_test/include/esp32c3/idf_performance_target.h delete mode 100644 components/idf_test/include/esp32c6/idf_performance_target.h delete mode 100644 components/idf_test/include/esp32h4/idf_performance_target.h delete mode 100644 components/idf_test/include/esp32s3/idf_performance_target.h delete mode 100644 components/idf_test/include/idf_performance.h create mode 100644 components/mbedtls/test_apps/include/crypto_performance.h create mode 100644 components/mbedtls/test_apps/include/crypto_performance_esp32.h rename components/{idf_test/include/esp32c2/idf_performance_target.h => mbedtls/test_apps/include/crypto_performance_esp32c2.h} (56%) create mode 100644 components/mbedtls/test_apps/include/crypto_performance_esp32c3.h create mode 100644 components/mbedtls/test_apps/include/crypto_performance_esp32c6.h rename components/{idf_test/include/esp32h2/idf_performance_target.h => mbedtls/test_apps/include/crypto_performance_esp32h2.h} (56%) rename components/{idf_test/include/esp32s2/idf_performance_target.h => mbedtls/test_apps/include/crypto_performance_esp32s2.h} (65%) create mode 100644 components/mbedtls/test_apps/include/crypto_performance_esp32s3.h create mode 100644 components/vfs/test_apps/include/vfs_performance.h create mode 100644 components/xtensa/test_apps/include/xtensa_performance.h create mode 100644 examples/ethernet/iperf/include/eth_iperf_performance.h create mode 100644 examples/wifi/iperf/include/wifi_iperf_performance.h diff --git a/.gitlab/CODEOWNERS b/.gitlab/CODEOWNERS index e5c8bf4767..b03595c686 100644 --- a/.gitlab/CODEOWNERS +++ b/.gitlab/CODEOWNERS @@ -136,7 +136,6 @@ /components/hal/test_apps/tee/ @esp-idf-codeowners/peripherals @esp-idf-codeowners/security /components/heap/ @esp-idf-codeowners/system /components/http_parser/ @esp-idf-codeowners/app-utilities -/components/idf_test/ @esp-idf-codeowners/peripherals @esp-idf-codeowners/system /components/ieee802154/ @esp-idf-codeowners/ieee802154 /components/linux/ @esp-idf-codeowners/system /components/log/ @esp-idf-codeowners/system diff --git a/components/esp_adc/test_apps/adc/include/adc_performance.h b/components/esp_adc/test_apps/adc/include/adc_performance.h new file mode 100644 index 0000000000..721e52213b --- /dev/null +++ b/components/esp_adc/test_apps/adc/include/adc_performance.h @@ -0,0 +1,27 @@ +/* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#if __has_include("adc_performance_esp32.h") +#include "adc_performance_esp32.h" +#elif __has_include("adc_performance_esp32s2.h") +#include "adc_performance_esp32s2.h" +#elif __has_include("adc_performance_esp32s3.h") +#include "adc_performance_esp32s3.h" +#elif __has_include("adc_performance_esp32c2.h") +#include "adc_performance_esp32c2.h" +#elif __has_include("adc_performance_esp32c3.h") +#include "adc_performance_esp32c3.h" +#elif __has_include("adc_performance_esp32c5.h") +#include "adc_performance_esp32c5.h" +#elif __has_include("adc_performance_esp32c6.h") +#include "adc_performance_esp32c6.h" +#elif __has_include("adc_performance_esp32c61.h") +#include "adc_performance_esp32c61.h" +#elif __has_include("adc_performance_esp32h2.h") +#include "adc_performance_esp32h2.h" +#elif __has_include("adc_performance_esp32p4.h") +#include "adc_performance_esp32p4.h" +#endif diff --git a/components/esp_adc/test_apps/adc/include/adc_performance_esp32.h b/components/esp_adc/test_apps/adc/include/adc_performance_esp32.h new file mode 100644 index 0000000000..9cf8f03d63 --- /dev/null +++ b/components/esp_adc/test_apps/adc/include/adc_performance_esp32.h @@ -0,0 +1,8 @@ +/* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_NO_FILTER 3 +#define IDF_PERFORMANCE_MAX_ADC_ONESHOT_STD_ATTEN3 3 diff --git a/components/esp_adc/test_apps/adc/include/adc_performance_esp32c2.h b/components/esp_adc/test_apps/adc/include/adc_performance_esp32c2.h new file mode 100644 index 0000000000..1ffdf72d24 --- /dev/null +++ b/components/esp_adc/test_apps/adc/include/adc_performance_esp32c2.h @@ -0,0 +1,7 @@ +/* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#define IDF_PERFORMANCE_MAX_ADC_ONESHOT_STD_ATTEN3 3 diff --git a/components/idf_test/include/esp32c5/idf_performance_target.h b/components/esp_adc/test_apps/adc/include/adc_performance_esp32c3.h similarity index 80% rename from components/idf_test/include/esp32c5/idf_performance_target.h rename to components/esp_adc/test_apps/adc/include/adc_performance_esp32c3.h index bbdf1665da..6deff44134 100644 --- a/components/idf_test/include/esp32c5/idf_performance_target.h +++ b/components/esp_adc/test_apps/adc/include/adc_performance_esp32c3.h @@ -1,13 +1,9 @@ -/* - * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD +/* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ - #pragma once -#define IDF_PERFORMANCE_MAX_ESP_TIMER_GET_TIME_PER_CALL 1200 - #define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_NO_FILTER 5 #define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_2 5 #define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_4 5 diff --git a/components/idf_test/include/esp32c61/idf_performance_target.h b/components/esp_adc/test_apps/adc/include/adc_performance_esp32c5.h similarity index 80% rename from components/idf_test/include/esp32c61/idf_performance_target.h rename to components/esp_adc/test_apps/adc/include/adc_performance_esp32c5.h index f6f6179265..f52d212237 100644 --- a/components/idf_test/include/esp32c61/idf_performance_target.h +++ b/components/esp_adc/test_apps/adc/include/adc_performance_esp32c5.h @@ -1,13 +1,9 @@ -/* - * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD +/* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ - #pragma once -#define IDF_PERFORMANCE_MAX_ESP_TIMER_GET_TIME_PER_CALL 1300 - #define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_NO_FILTER 5 #define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_2 5 #define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_4 5 diff --git a/components/esp_adc/test_apps/adc/include/adc_performance_esp32c6.h b/components/esp_adc/test_apps/adc/include/adc_performance_esp32c6.h new file mode 100644 index 0000000000..a7cb854a24 --- /dev/null +++ b/components/esp_adc/test_apps/adc/include/adc_performance_esp32c6.h @@ -0,0 +1,13 @@ +/* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_NO_FILTER 10 +#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_2 10 +#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_4 10 +#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_8 10 +#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_16 10 +#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_64 10 +#define IDF_PERFORMANCE_MAX_ADC_ONESHOT_STD_ATTEN3 10 diff --git a/components/esp_adc/test_apps/adc/include/adc_performance_esp32c61.h b/components/esp_adc/test_apps/adc/include/adc_performance_esp32c61.h new file mode 100644 index 0000000000..f52d212237 --- /dev/null +++ b/components/esp_adc/test_apps/adc/include/adc_performance_esp32c61.h @@ -0,0 +1,13 @@ +/* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_NO_FILTER 5 +#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_2 5 +#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_4 5 +#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_8 5 +#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_16 5 +#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_64 5 +#define IDF_PERFORMANCE_MAX_ADC_ONESHOT_STD_ATTEN3 5 diff --git a/components/esp_adc/test_apps/adc/include/adc_performance_esp32h2.h b/components/esp_adc/test_apps/adc/include/adc_performance_esp32h2.h new file mode 100644 index 0000000000..a7cb854a24 --- /dev/null +++ b/components/esp_adc/test_apps/adc/include/adc_performance_esp32h2.h @@ -0,0 +1,13 @@ +/* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_NO_FILTER 10 +#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_2 10 +#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_4 10 +#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_8 10 +#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_16 10 +#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_64 10 +#define IDF_PERFORMANCE_MAX_ADC_ONESHOT_STD_ATTEN3 10 diff --git a/components/idf_test/include/esp32p4/idf_performance_target.h b/components/esp_adc/test_apps/adc/include/adc_performance_esp32p4.h similarity index 57% rename from components/idf_test/include/esp32p4/idf_performance_target.h rename to components/esp_adc/test_apps/adc/include/adc_performance_esp32p4.h index 90ad9b1e3a..3791480ab2 100644 --- a/components/idf_test/include/esp32p4/idf_performance_target.h +++ b/components/esp_adc/test_apps/adc/include/adc_performance_esp32p4.h @@ -1,15 +1,8 @@ -/* - * SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD +/* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ - -/* Spinlock performance on esp32p4 is slower. */ -#define IDF_PERFORMANCE_MAX_FREERTOS_SPINLOCK_CYCLES_PER_OP 400 -#define IDF_PERFORMANCE_MAX_FREERTOS_SPINLOCK_CYCLES_PER_OP_UNICORE 150 - -/* Solicited yields (portYIELD() or taskYIELD()) take longer on esp32p4. TODO: IDF-2809 */ -#define IDF_PERFORMANCE_MAX_SCHEDULING_TIME 3200 +#pragma once #define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_NO_FILTER 10 #define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_2 10 diff --git a/components/esp_adc/test_apps/adc/include/adc_performance_esp32s2.h b/components/esp_adc/test_apps/adc/include/adc_performance_esp32s2.h new file mode 100644 index 0000000000..a9f4258bec --- /dev/null +++ b/components/esp_adc/test_apps/adc/include/adc_performance_esp32s2.h @@ -0,0 +1,13 @@ +/* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_NO_FILTER 3 +#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_2 3 +#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_4 3 +#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_8 3 +#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_16 3 +#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_64 3 +#define IDF_PERFORMANCE_MAX_ADC_ONESHOT_STD_ATTEN3 6 diff --git a/components/esp_adc/test_apps/adc/include/adc_performance_esp32s3.h b/components/esp_adc/test_apps/adc/include/adc_performance_esp32s3.h new file mode 100644 index 0000000000..5de3f83386 --- /dev/null +++ b/components/esp_adc/test_apps/adc/include/adc_performance_esp32s3.h @@ -0,0 +1,13 @@ +/* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_NO_FILTER 4 +#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_2 4 +#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_4 4 +#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_8 4 +#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_16 4 +#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_64 4 +#define IDF_PERFORMANCE_MAX_ADC_ONESHOT_STD_ATTEN3 4 diff --git a/components/esp_adc/test_apps/adc/main/CMakeLists.txt b/components/esp_adc/test_apps/adc/main/CMakeLists.txt index e7eed57470..a6b4d26652 100644 --- a/components/esp_adc/test_apps/adc/main/CMakeLists.txt +++ b/components/esp_adc/test_apps/adc/main/CMakeLists.txt @@ -10,6 +10,7 @@ set(srcs "test_app_main.c" # In order for the cases defined by `TEST_CASE` to be linked into the final elf, # the component can be registered as WHOLE_ARCHIVE idf_component_register(SRCS ${srcs} + PRIV_INCLUDE_DIRS "../include" PRIV_REQUIRES esp_driver_gptimer esp_driver_gpio esp_wifi nvs_flash esp_adc test_utils efuse esp_driver_tsens WHOLE_ARCHIVE) diff --git a/components/esp_adc/test_apps/adc/main/test_adc_performance.c b/components/esp_adc/test_apps/adc/main/test_adc_performance.c index a5867aa9c1..d4fec3e917 100644 --- a/components/esp_adc/test_apps/adc/main/test_adc_performance.c +++ b/components/esp_adc/test_apps/adc/main/test_adc_performance.c @@ -11,6 +11,7 @@ #include "esp_log.h" #include "esp_err.h" #include "esp_cpu.h" +#include "esp_heap_caps.h" #include "hal/adc_periph.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" @@ -18,7 +19,7 @@ #include "esp_adc/adc_continuous.h" #include "esp_adc/adc_filter.h" #include "test_common_adc.h" -#include "idf_performance.h" +#include "adc_performance.h" __attribute__((unused)) static const char *TAG = "TEST_ADC"; diff --git a/components/esp_driver_sdio/test_apps/include/sdio_performance.h b/components/esp_driver_sdio/test_apps/include/sdio_performance.h new file mode 100644 index 0000000000..c5600fdf68 --- /dev/null +++ b/components/esp_driver_sdio/test_apps/include/sdio_performance.h @@ -0,0 +1,12 @@ +/* + * SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#if __has_include("sdio_performance_esp32.h") +#include "sdio_performance_esp32.h" +#elif __has_include("sdio_performance_esp32c6.h") +#include "sdio_performance_esp32c6.h" +#endif diff --git a/components/esp_driver_sdio/test_apps/include/sdio_performance_esp32.h b/components/esp_driver_sdio/test_apps/include/sdio_performance_esp32.h new file mode 100644 index 0000000000..b2a82e2b27 --- /dev/null +++ b/components/esp_driver_sdio/test_apps/include/sdio_performance_esp32.h @@ -0,0 +1,35 @@ +/* + * SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#include "sdkconfig.h" + +#ifndef IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_TOHOST_4BIT +#define IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_TOHOST_4BIT 12200 +#endif + +#if !CONFIG_FREERTOS_SMP // IDF-5826 +#ifndef IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_FRHOST_4BIT +#define IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_FRHOST_4BIT 11000 +#endif +#else +#ifndef IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_FRHOST_4BIT +#define IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_FRHOST_4BIT 12200 +#endif +#endif + +#ifndef IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_TOHOST_1BIT +#define IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_TOHOST_1BIT 4000 +#endif +#ifndef IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_FRHOST_1BIT +#define IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_FRHOST_1BIT 4000 +#endif +#ifndef IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_TOHOST_SPI +#define IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_TOHOST_SPI 1000 +#endif +#ifndef IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_FRHOST_SPI +#define IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_FRHOST_SPI 1000 +#endif diff --git a/components/esp_driver_sdio/test_apps/include/sdio_performance_esp32c6.h b/components/esp_driver_sdio/test_apps/include/sdio_performance_esp32c6.h new file mode 100644 index 0000000000..fde1ba7283 --- /dev/null +++ b/components/esp_driver_sdio/test_apps/include/sdio_performance_esp32c6.h @@ -0,0 +1,25 @@ +/* + * SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#ifndef IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_TOHOST_4BIT +#define IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_TOHOST_4BIT 9000 +#endif +#ifndef IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_FRHOST_4BIT +#define IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_FRHOST_4BIT 10000 +#endif +#ifndef IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_TOHOST_1BIT +#define IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_TOHOST_1BIT 4000 +#endif +#ifndef IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_FRHOST_1BIT +#define IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_FRHOST_1BIT 4000 +#endif +#ifndef IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_TOHOST_SPI +#define IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_TOHOST_SPI 1000 +#endif +#ifndef IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_FRHOST_SPI +#define IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_FRHOST_SPI 1000 +#endif diff --git a/components/esp_driver_spi/test_apps/components/spi_bench_mark/include/spi_performance.h b/components/esp_driver_spi/test_apps/components/spi_bench_mark/include/spi_performance.h index 4f73ba3c5b..cd8e4a0176 100644 --- a/components/esp_driver_spi/test_apps/components/spi_bench_mark/include/spi_performance.h +++ b/components/esp_driver_spi/test_apps/components/spi_bench_mark/include/spi_performance.h @@ -6,6 +6,8 @@ #pragma once +#include "sdkconfig.h" + #if CONFIG_IDF_TARGET_ESP32 #define IDF_TARGET_MAX_SPI_CLK_FREQ 16*1000*1000 #define IDF_TARGET_MAX_TRANS_TIME_POLL_DMA 15 diff --git a/components/esp_event/test_apps/include/event_performance.h b/components/esp_event/test_apps/include/event_performance.h new file mode 100644 index 0000000000..83a26029b4 --- /dev/null +++ b/components/esp_event/test_apps/include/event_performance.h @@ -0,0 +1,33 @@ +/* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#include "sdkconfig.h" + +// events dispatched per second by event loop library +#if !CONFIG_FREERTOS_SMP // IDF-5826 +#if CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ < 100 // Allowing lesser event dispatch performance for slower CPU frequency chips +#ifndef IDF_PERFORMANCE_MIN_EVENT_DISPATCH +#define IDF_PERFORMANCE_MIN_EVENT_DISPATCH 11000 +#endif +#ifndef IDF_PERFORMANCE_MIN_EVENT_DISPATCH_PSRAM +#define IDF_PERFORMANCE_MIN_EVENT_DISPATCH_PSRAM 9000 +#endif +#else +#ifndef IDF_PERFORMANCE_MIN_EVENT_DISPATCH +#define IDF_PERFORMANCE_MIN_EVENT_DISPATCH 25000 +#endif +#ifndef IDF_PERFORMANCE_MIN_EVENT_DISPATCH_PSRAM +#define IDF_PERFORMANCE_MIN_EVENT_DISPATCH_PSRAM 21000 +#endif +#endif +#else +#ifndef IDF_PERFORMANCE_MIN_EVENT_DISPATCH +#define IDF_PERFORMANCE_MIN_EVENT_DISPATCH 18000 +#endif +#ifndef IDF_PERFORMANCE_MIN_EVENT_DISPATCH_PSRAM +#define IDF_PERFORMANCE_MIN_EVENT_DISPATCH_PSRAM 14000 +#endif +#endif diff --git a/components/esp_event/test_apps/main/test_event_target.c b/components/esp_event/test_apps/main/test_event_target.c index b3acd53964..811fccea8a 100644 --- a/components/esp_event/test_apps/main/test_event_target.c +++ b/components/esp_event/test_apps/main/test_event_target.c @@ -29,6 +29,7 @@ #include "unity_test_utils_memory.h" #include "test_utils.h" +#include "event_performance.h" static const char* TAG = "test_event"; @@ -236,7 +237,7 @@ TEST_CASE("can exit running loop at approximately the set amount of time", "[eve TEST_CASE("can register/unregister handlers simultaneously", "[event]") { /* this test aims to verify that the event handlers list remains consistent despite - * simultaneous access by differenct tasks */ + * simultaneous access by different tasks */ const char* base = "base"; int32_t id = 0; @@ -358,7 +359,7 @@ TEST_CASE("can post and run events simultaneously", "[event]") { /* this test aims to verify that: * - multiple tasks can post to the queue simultaneously - * - handlers recieve the appropriate handler arg and associated event data */ + * - handlers receive the appropriate handler arg and associated event data */ esp_event_loop_handle_t loop; @@ -433,7 +434,7 @@ TEST_CASE("can post and run events simultaneously with instances", "[event]") { /* this test aims to verify that: * - multiple tasks can post to the queue simultaneously - * - handlers recieve the appropriate handler arg and associated event data */ + * - handlers receive the appropriate handler arg and associated event data */ esp_event_loop_handle_t loop; diff --git a/components/esp_hw_support/test_apps/esp_hw_support_unity_tests/include/hw_support_performance.h b/components/esp_hw_support/test_apps/esp_hw_support_unity_tests/include/hw_support_performance.h new file mode 100644 index 0000000000..04afd1de68 --- /dev/null +++ b/components/esp_hw_support/test_apps/esp_hw_support_unity_tests/include/hw_support_performance.h @@ -0,0 +1,17 @@ +/* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#if __has_include("hw_support_performance_esp32.h") +#include "hw_support_performance_esp32.h" +#elif __has_include("hw_support_performance_esp32c2.h") +#include "hw_support_performance_esp32c2.h" +#elif __has_include("hw_support_performance_esp32c3.h") +#include "hw_support_performance_esp32c3.h" +#elif __has_include("hw_support_performance_esp32h2.h") +#include "hw_support_performance_esp32h2.h" +#elif __has_include("hw_support_performance_esp32s3.h") +#include "hw_support_performance_esp32s3.h" +#endif diff --git a/components/esp_hw_support/test_apps/esp_hw_support_unity_tests/include/hw_support_performance_esp32.h b/components/esp_hw_support/test_apps/esp_hw_support_unity_tests/include/hw_support_performance_esp32.h new file mode 100644 index 0000000000..d8d64f6c2e --- /dev/null +++ b/components/esp_hw_support/test_apps/esp_hw_support_unity_tests/include/hw_support_performance_esp32.h @@ -0,0 +1,8 @@ +/* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#define IDF_PERFORMANCE_MAX_CYCLES_PER_DIV 70 +#define IDF_PERFORMANCE_MAX_CYCLES_PER_SQRT 140 diff --git a/components/esp_hw_support/test_apps/esp_hw_support_unity_tests/include/hw_support_performance_esp32c2.h b/components/esp_hw_support/test_apps/esp_hw_support_unity_tests/include/hw_support_performance_esp32c2.h new file mode 100644 index 0000000000..4ebc01ecb2 --- /dev/null +++ b/components/esp_hw_support/test_apps/esp_hw_support_unity_tests/include/hw_support_performance_esp32c2.h @@ -0,0 +1,9 @@ +/* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +// floating point instructions per divide and per sqrt (configured for worst-case with PSRAM workaround) +#define IDF_PERFORMANCE_MAX_CYCLES_PER_DIV 70 +#define IDF_PERFORMANCE_MAX_CYCLES_PER_SQRT 140 diff --git a/components/esp_hw_support/test_apps/esp_hw_support_unity_tests/include/hw_support_performance_esp32c3.h b/components/esp_hw_support/test_apps/esp_hw_support_unity_tests/include/hw_support_performance_esp32c3.h new file mode 100644 index 0000000000..4ebc01ecb2 --- /dev/null +++ b/components/esp_hw_support/test_apps/esp_hw_support_unity_tests/include/hw_support_performance_esp32c3.h @@ -0,0 +1,9 @@ +/* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +// floating point instructions per divide and per sqrt (configured for worst-case with PSRAM workaround) +#define IDF_PERFORMANCE_MAX_CYCLES_PER_DIV 70 +#define IDF_PERFORMANCE_MAX_CYCLES_PER_SQRT 140 diff --git a/components/esp_hw_support/test_apps/esp_hw_support_unity_tests/include/hw_support_performance_esp32h2.h b/components/esp_hw_support/test_apps/esp_hw_support_unity_tests/include/hw_support_performance_esp32h2.h new file mode 100644 index 0000000000..4ebc01ecb2 --- /dev/null +++ b/components/esp_hw_support/test_apps/esp_hw_support_unity_tests/include/hw_support_performance_esp32h2.h @@ -0,0 +1,9 @@ +/* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +// floating point instructions per divide and per sqrt (configured for worst-case with PSRAM workaround) +#define IDF_PERFORMANCE_MAX_CYCLES_PER_DIV 70 +#define IDF_PERFORMANCE_MAX_CYCLES_PER_SQRT 140 diff --git a/components/esp_hw_support/test_apps/esp_hw_support_unity_tests/include/hw_support_performance_esp32s3.h b/components/esp_hw_support/test_apps/esp_hw_support_unity_tests/include/hw_support_performance_esp32s3.h new file mode 100644 index 0000000000..066b1c348f --- /dev/null +++ b/components/esp_hw_support/test_apps/esp_hw_support_unity_tests/include/hw_support_performance_esp32s3.h @@ -0,0 +1,8 @@ +/* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#define IDF_PERFORMANCE_MAX_CYCLES_PER_DIV 70 +#define IDF_PERFORMANCE_MAX_CYCLES_PER_SQRT 140 diff --git a/components/esp_hw_support/test_apps/esp_hw_support_unity_tests/main/test_fp.c b/components/esp_hw_support/test_apps/esp_hw_support_unity_tests/main/test_fp.c index 217d94ce9d..8c2de075bb 100644 --- a/components/esp_hw_support/test_apps/esp_hw_support_unity_tests/main/test_fp.c +++ b/components/esp_hw_support/test_apps/esp_hw_support_unity_tests/main/test_fp.c @@ -14,6 +14,7 @@ #include "freertos/semphr.h" #include "unity.h" #include "test_utils.h" +#include "hw_support_performance.h" /* Note: these functions are included here for unit test purposes. They are not needed for writing * normal code. If writing standard C floating point code, libgcc should correctly include implementations diff --git a/components/esp_timer/test_apps/include/esp_timer_performance.h b/components/esp_timer/test_apps/include/esp_timer_performance.h new file mode 100644 index 0000000000..3a024c6cd2 --- /dev/null +++ b/components/esp_timer/test_apps/include/esp_timer_performance.h @@ -0,0 +1,21 @@ +/* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#if __has_include("esp_timer_performance_esp32c2.h") +#include "esp_timer_performance_esp32c2.h" +#elif __has_include("esp_timer_performance_esp32c5.h") +#include "esp_timer_performance_esp32c5.h" +#elif __has_include("esp_timer_performance_esp32c6.h") +#include "esp_timer_performance_esp32c6.h" +#elif __has_include("esp_timer_performance_esp32c61.h") +#include "esp_timer_performance_esp32c61.h" +#elif __has_include("esp_timer_performance_esp32h2.h") +#include "esp_timer_performance_esp32h2.h" +#elif __has_include("esp_timer_performance_esp32h21.h") +#include "esp_timer_performance_esp32h21.h" +#endif + +#ifndef IDF_PERFORMANCE_MAX_ESP_TIMER_GET_TIME_PER_CALL +#define IDF_PERFORMANCE_MAX_ESP_TIMER_GET_TIME_PER_CALL 1000 +#endif diff --git a/components/esp_timer/test_apps/include/esp_timer_performance_esp32c2.h b/components/esp_timer/test_apps/include/esp_timer_performance_esp32c2.h new file mode 100644 index 0000000000..05bbc31a8c --- /dev/null +++ b/components/esp_timer/test_apps/include/esp_timer_performance_esp32c2.h @@ -0,0 +1,13 @@ +/* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#include "sdkconfig.h" + +#ifdef CONFIG_XTAL_FREQ_26 +#define IDF_PERFORMANCE_MAX_ESP_TIMER_GET_TIME_PER_CALL 1900 +#else +#define IDF_PERFORMANCE_MAX_ESP_TIMER_GET_TIME_PER_CALL 1200 +#endif diff --git a/components/esp_timer/test_apps/include/esp_timer_performance_esp32c5.h b/components/esp_timer/test_apps/include/esp_timer_performance_esp32c5.h new file mode 100644 index 0000000000..7cd9d272e2 --- /dev/null +++ b/components/esp_timer/test_apps/include/esp_timer_performance_esp32c5.h @@ -0,0 +1,7 @@ +/* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#define IDF_PERFORMANCE_MAX_ESP_TIMER_GET_TIME_PER_CALL 1200 diff --git a/components/esp_timer/test_apps/include/esp_timer_performance_esp32c6.h b/components/esp_timer/test_apps/include/esp_timer_performance_esp32c6.h new file mode 100644 index 0000000000..7cd9d272e2 --- /dev/null +++ b/components/esp_timer/test_apps/include/esp_timer_performance_esp32c6.h @@ -0,0 +1,7 @@ +/* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#define IDF_PERFORMANCE_MAX_ESP_TIMER_GET_TIME_PER_CALL 1200 diff --git a/components/esp_timer/test_apps/include/esp_timer_performance_esp32c61.h b/components/esp_timer/test_apps/include/esp_timer_performance_esp32c61.h new file mode 100644 index 0000000000..11de4e3963 --- /dev/null +++ b/components/esp_timer/test_apps/include/esp_timer_performance_esp32c61.h @@ -0,0 +1,7 @@ +/* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#define IDF_PERFORMANCE_MAX_ESP_TIMER_GET_TIME_PER_CALL 1300 diff --git a/components/idf_test/include/esp32h21/idf_performance_target.h b/components/esp_timer/test_apps/include/esp_timer_performance_esp32h2.h similarity index 68% rename from components/idf_test/include/esp32h21/idf_performance_target.h rename to components/esp_timer/test_apps/include/esp_timer_performance_esp32h2.h index 6645df7496..416625ee5e 100644 --- a/components/idf_test/include/esp32h21/idf_performance_target.h +++ b/components/esp_timer/test_apps/include/esp_timer_performance_esp32h2.h @@ -1,9 +1,7 @@ -/* - * SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD +/* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ - #pragma once #define IDF_PERFORMANCE_MAX_ESP_TIMER_GET_TIME_PER_CALL 1900 diff --git a/components/esp_timer/test_apps/include/esp_timer_performance_esp32h21.h b/components/esp_timer/test_apps/include/esp_timer_performance_esp32h21.h new file mode 100644 index 0000000000..27cf757382 --- /dev/null +++ b/components/esp_timer/test_apps/include/esp_timer_performance_esp32h21.h @@ -0,0 +1,7 @@ +/* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#define IDF_PERFORMANCE_MAX_ESP_TIMER_GET_TIME_PER_CALL 1900 diff --git a/components/esp_timer/test_apps/main/test_esp_timer.c b/components/esp_timer/test_apps/main/test_esp_timer.c index eb35f2ff6f..5b4e2a8880 100644 --- a/components/esp_timer/test_apps/main/test_esp_timer.c +++ b/components/esp_timer/test_apps/main/test_esp_timer.c @@ -13,7 +13,7 @@ #include "esp_timer.h" #include "esp_timer_impl.h" #include "unity.h" -#include "soc/timer_group_reg.h" +#include "soc/soc_caps.h" #include "esp_heap_caps.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" @@ -21,6 +21,8 @@ #include "test_utils.h" #include "esp_freertos_hooks.h" #include "esp_rom_sys.h" +/* include performance pass standards header file */ +#include "esp_timer_performance.h" #define SEC (1000000) diff --git a/components/freertos/test_apps/freertos/include/freertos_performance.h b/components/freertos/test_apps/freertos/include/freertos_performance.h new file mode 100644 index 0000000000..f5a8ef4e15 --- /dev/null +++ b/components/freertos/test_apps/freertos/include/freertos_performance.h @@ -0,0 +1,30 @@ +/* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#if __has_include("freertos_performance_esp32p4.h") +#include "freertos_performance_esp32p4.h" +#endif + +#ifndef IDF_PERFORMANCE_MAX_FREERTOS_SPINLOCK_CYCLES_PER_OP +#define IDF_PERFORMANCE_MAX_FREERTOS_SPINLOCK_CYCLES_PER_OP 215 +#endif +#ifndef IDF_PERFORMANCE_MAX_FREERTOS_SPINLOCK_CYCLES_PER_OP_PSRAM +#define IDF_PERFORMANCE_MAX_FREERTOS_SPINLOCK_CYCLES_PER_OP_PSRAM 300 +#endif +#ifndef IDF_PERFORMANCE_MAX_FREERTOS_SPINLOCK_CYCLES_PER_OP_UNICORE +#define IDF_PERFORMANCE_MAX_FREERTOS_SPINLOCK_CYCLES_PER_OP_UNICORE 130 +#endif + +#ifndef IDF_PERFORMANCE_MAX_ISR_ENTER_CYCLES +#define IDF_PERFORMANCE_MAX_ISR_ENTER_CYCLES 290 +#endif +#ifndef IDF_PERFORMANCE_MAX_ISR_EXIT_CYCLES +#define IDF_PERFORMANCE_MAX_ISR_EXIT_CYCLES 565 +#endif + +#ifndef IDF_PERFORMANCE_MAX_SCHEDULING_TIME +#define IDF_PERFORMANCE_MAX_SCHEDULING_TIME 2000 +#endif diff --git a/components/freertos/test_apps/freertos/include/freertos_performance_esp32p4.h b/components/freertos/test_apps/freertos/include/freertos_performance_esp32p4.h new file mode 100644 index 0000000000..1c31a2200a --- /dev/null +++ b/components/freertos/test_apps/freertos/include/freertos_performance_esp32p4.h @@ -0,0 +1,12 @@ +/* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +/* Spinlock performance on esp32p4 is slower. */ +#define IDF_PERFORMANCE_MAX_FREERTOS_SPINLOCK_CYCLES_PER_OP 400 +#define IDF_PERFORMANCE_MAX_FREERTOS_SPINLOCK_CYCLES_PER_OP_UNICORE 150 + +/* Solicited yields (portYIELD() or taskYIELD()) take longer on esp32p4. TODO: IDF-2809 */ +#define IDF_PERFORMANCE_MAX_SCHEDULING_TIME 3200 diff --git a/components/freertos/test_apps/freertos/performance/test_freertos_scheduling_time.c b/components/freertos/test_apps/freertos/performance/test_freertos_scheduling_time.c index dc79986fe0..54b2f7397e 100644 --- a/components/freertos/test_apps/freertos/performance/test_freertos_scheduling_time.c +++ b/components/freertos/test_apps/freertos/performance/test_freertos_scheduling_time.c @@ -15,6 +15,7 @@ #include "esp_cpu.h" #include "unity.h" #include "test_utils.h" +#include "freertos_performance.h" #define NUMBER_OF_ITERATIONS 1023 diff --git a/components/freertos/test_apps/freertos/performance/test_isr_latency.c b/components/freertos/test_apps/freertos/performance/test_isr_latency.c index 314a7d6263..b0ad6f9b17 100644 --- a/components/freertos/test_apps/freertos/performance/test_isr_latency.c +++ b/components/freertos/test_apps/freertos/performance/test_isr_latency.c @@ -16,6 +16,8 @@ #include "esp_cpu.h" #include "unity.h" #include "test_utils.h" +#include "freertos_performance.h" + #if CONFIG_IDF_TARGET_ARCH_XTENSA #include "xtensa/hal.h" #include "xtensa_api.h" // Replace with interrupt allocator API (IDF-3891) diff --git a/components/freertos/test_apps/freertos/port/test_spinlocks.c b/components/freertos/test_apps/freertos/port/test_spinlocks.c index ab2a3e53eb..9ad339a78d 100644 --- a/components/freertos/test_apps/freertos/port/test_spinlocks.c +++ b/components/freertos/test_apps/freertos/port/test_spinlocks.c @@ -20,6 +20,7 @@ #include "esp_cpu.h" #include "test_utils.h" +#include "freertos_performance.h" #if !CONFIG_FREERTOS_SMP // Known issue in Amazon SMP FreeRTOS port IDF-6204 diff --git a/components/heap/test_apps/include/heap_performance.h b/components/heap/test_apps/include/heap_performance.h new file mode 100644 index 0000000000..ed3d96ad59 --- /dev/null +++ b/components/heap/test_apps/include/heap_performance.h @@ -0,0 +1,14 @@ +/* + * SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#ifndef IDF_PERFORMANCE_MAX_MALLOC_DEFAULT_AVERAGE_TIME +#define IDF_PERFORMANCE_MAX_MALLOC_DEFAULT_AVERAGE_TIME 2600 +#endif + +#ifndef IDF_PERFORMANCE_MAX_FREE_DEFAULT_AVERAGE_TIME +#define IDF_PERFORMANCE_MAX_FREE_DEFAULT_AVERAGE_TIME 950 +#endif diff --git a/components/idf_test/CMakeLists.txt b/components/idf_test/CMakeLists.txt deleted file mode 100644 index 9c216570e4..0000000000 --- a/components/idf_test/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -idf_build_get_property(target IDF_TARGET) - -if(${target} STREQUAL "linux") - return() # This component is not supported by the POSIX/Linux simulator -endif() - -idf_component_register(INCLUDE_DIRS "include" "include/${target}") diff --git a/components/idf_test/README.md b/components/idf_test/README.md deleted file mode 100644 index 1d0c4cfbd1..0000000000 --- a/components/idf_test/README.md +++ /dev/null @@ -1,4 +0,0 @@ - -# Note: The test cases in this folder are for Espressif internal use. - -# Goto internal project wiki Testing page for detail about this folder. diff --git a/components/idf_test/include/esp32/idf_performance_target.h b/components/idf_test/include/esp32/idf_performance_target.h deleted file mode 100644 index b8836d5e92..0000000000 --- a/components/idf_test/include/esp32/idf_performance_target.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#pragma once - -#include "sdkconfig.h" - -// AES-CBC hardware throughput (accounts for worst-case performance with PSRAM workaround) -#define IDF_PERFORMANCE_MIN_AES_CBC_THROUGHPUT_MBSEC 8.2 - -// SHA256 hardware throughput at 240MHz, threshold set lower than worst case -#if CONFIG_FREERTOS_SMP // IDF-5826 -#define IDF_PERFORMANCE_MIN_SHA256_THROUGHPUT_MBSEC 6.0 -#else -#define IDF_PERFORMANCE_MIN_SHA256_THROUGHPUT_MBSEC 8.0 -#endif -// esp_sha() time to process 32KB of input data from RAM -#define IDF_PERFORMANCE_MAX_TIME_SHA1_32KB 5000 -#define IDF_PERFORMANCE_MAX_TIME_SHA512_32KB 4500 - -#define IDF_PERFORMANCE_MAX_RSA_2048KEY_PUBLIC_OP 19000 -#define IDF_PERFORMANCE_MAX_RSA_2048KEY_PRIVATE_OP 750000 -#define IDF_PERFORMANCE_MAX_RSA_3072KEY_PUBLIC_OP 33000 -#define IDF_PERFORMANCE_MAX_RSA_3072KEY_PRIVATE_OP 950000 -#define IDF_PERFORMANCE_MAX_RSA_4096KEY_PUBLIC_OP 90000 -#define IDF_PERFORMANCE_MAX_RSA_4096KEY_PRIVATE_OP 3000000 - -// floating point instructions per divide and per sqrt (configured for worst-case with PSRAM workaround) -#define IDF_PERFORMANCE_MAX_CYCLES_PER_DIV 70 -#define IDF_PERFORMANCE_MAX_CYCLES_PER_SQRT 140 - -#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_NO_FILTER 3 -#define IDF_PERFORMANCE_MAX_ADC_ONESHOT_STD_ATTEN3 3 - -//SDIO -#ifndef IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_TOHOST_4BIT -#define IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_TOHOST_4BIT 12200 -#endif - -#if !CONFIG_FREERTOS_SMP // IDF-5826 -#ifndef IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_FRHOST_4BIT -#define IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_FRHOST_4BIT 11000 -#endif -#else -#ifndef IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_FRHOST_4BIT -#define IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_FRHOST_4BIT 12200 -#endif -#endif - -#ifndef IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_TOHOST_1BIT -#define IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_TOHOST_1BIT 4000 -#endif -#ifndef IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_FRHOST_1BIT -#define IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_FRHOST_1BIT 4000 -#endif -#ifndef IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_TOHOST_SPI -#define IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_TOHOST_SPI 1000 -#endif -#ifndef IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_FRHOST_SPI -#define IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_FRHOST_SPI 1000 -#endif diff --git a/components/idf_test/include/esp32c3/idf_performance_target.h b/components/idf_test/include/esp32c3/idf_performance_target.h deleted file mode 100644 index f7b04ca663..0000000000 --- a/components/idf_test/include/esp32c3/idf_performance_target.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#pragma once - -#include "sdkconfig.h" - -#define IDF_PERFORMANCE_MIN_AES_CBC_THROUGHPUT_MBSEC 43 - -// SHA256 hardware throughput at 160 MHz, threshold set lower than worst case -#define IDF_PERFORMANCE_MIN_SHA256_THROUGHPUT_MBSEC 90 -// esp_sha() time to process 32KB of input data from RAM -#define IDF_PERFORMANCE_MAX_TIME_SHA1_32KB 560 - -#define IDF_PERFORMANCE_MAX_RSA_2048KEY_PUBLIC_OP 19000 -#define IDF_PERFORMANCE_MAX_RSA_2048KEY_PRIVATE_OP 210000 -#define IDF_PERFORMANCE_MAX_RSA_3072KEY_PUBLIC_OP 45000 -#define IDF_PERFORMANCE_MAX_RSA_3072KEY_PRIVATE_OP 670000 - -// floating point instructions per divide and per sqrt (configured for worst-case with PSRAM workaround) -#define IDF_PERFORMANCE_MAX_CYCLES_PER_DIV 70 -#define IDF_PERFORMANCE_MAX_CYCLES_PER_SQRT 140 - -#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_NO_FILTER 5 -#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_2 5 -#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_4 5 -#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_8 5 -#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_16 5 -#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_64 5 -#define IDF_PERFORMANCE_MAX_ADC_ONESHOT_STD_ATTEN3 5 diff --git a/components/idf_test/include/esp32c6/idf_performance_target.h b/components/idf_test/include/esp32c6/idf_performance_target.h deleted file mode 100644 index 5ca63dcaa4..0000000000 --- a/components/idf_test/include/esp32c6/idf_performance_target.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#pragma once - -#define IDF_PERFORMANCE_MAX_ESP_TIMER_GET_TIME_PER_CALL 1200 - -// ECC peripheral output at 160MHz -#define IDF_PERFORMANCE_MAX_ECP_P192_POINT_MULTIPLY_OP 5000 -#define IDF_PERFORMANCE_MAX_ECP_P192_POINT_VERIFY_OP 60 -#define IDF_PERFORMANCE_MAX_ECP_P256_POINT_MULTIPLY_OP 8400 -#define IDF_PERFORMANCE_MAX_ECP_P256_POINT_VERIFY_OP 70 - -#define IDF_PERFORMANCE_MAX_ECDSA_P192_VERIFY_OP 18000 -#define IDF_PERFORMANCE_MAX_ECDSA_P256_VERIFY_OP 27000 - -#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_NO_FILTER 10 -#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_2 10 -#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_4 10 -#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_8 10 -#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_16 10 -#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_64 10 -#define IDF_PERFORMANCE_MAX_ADC_ONESHOT_STD_ATTEN3 10 - -//SDIO -#ifndef IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_TOHOST_4BIT -#define IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_TOHOST_4BIT 9000 -#endif -#ifndef IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_FRHOST_4BIT -#define IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_FRHOST_4BIT 10000 -#endif -#ifndef IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_TOHOST_1BIT -#define IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_TOHOST_1BIT 4000 -#endif -#ifndef IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_FRHOST_1BIT -#define IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_FRHOST_1BIT 4000 -#endif -#ifndef IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_TOHOST_SPI -#define IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_TOHOST_SPI 1000 -#endif -#ifndef IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_FRHOST_SPI -#define IDF_PERFORMANCE_MIN_SDIO_THROUGHPUT_KBSEC_FRHOST_SPI 1000 -#endif diff --git a/components/idf_test/include/esp32h4/idf_performance_target.h b/components/idf_test/include/esp32h4/idf_performance_target.h deleted file mode 100644 index 1cfa7a9fcb..0000000000 --- a/components/idf_test/include/esp32h4/idf_performance_target.h +++ /dev/null @@ -1,5 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ diff --git a/components/idf_test/include/esp32s3/idf_performance_target.h b/components/idf_test/include/esp32s3/idf_performance_target.h deleted file mode 100644 index 071f0db403..0000000000 --- a/components/idf_test/include/esp32s3/idf_performance_target.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#pragma once - -#define IDF_PERFORMANCE_MIN_AES_CBC_THROUGHPUT_MBSEC 43 - -// SHA256 hardware throughput at 240MHz, threshold set lower than worst case -#define IDF_PERFORMANCE_MIN_SHA256_THROUGHPUT_MBSEC 90 -// esp_sha() time to process 32KB of input data from RAM -#define IDF_PERFORMANCE_MAX_TIME_SHA1_32KB 1000 -#define IDF_PERFORMANCE_MAX_TIME_SHA512_32KB 900 - -#define IDF_PERFORMANCE_MAX_RSA_2048KEY_PUBLIC_OP 23000 -#define IDF_PERFORMANCE_MAX_RSA_2048KEY_PRIVATE_OP 700000 -#define IDF_PERFORMANCE_MAX_RSA_3072KEY_PUBLIC_OP 45000 -#define IDF_PERFORMANCE_MAX_RSA_3072KEY_PRIVATE_OP 1300000 -#define IDF_PERFORMANCE_MAX_RSA_4096KEY_PUBLIC_OP 80000 -#define IDF_PERFORMANCE_MAX_RSA_4096KEY_PRIVATE_OP 3500000 - -// floating point instructions per divide and per sqrt (configured for worst-case with PSRAM workaround) -#define IDF_PERFORMANCE_MAX_CYCLES_PER_DIV 70 -#define IDF_PERFORMANCE_MAX_CYCLES_PER_SQRT 140 - -#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_NO_FILTER 4 -#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_2 4 -#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_4 4 -#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_8 4 -#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_16 4 -#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_64 4 -#define IDF_PERFORMANCE_MAX_ADC_ONESHOT_STD_ATTEN3 4 diff --git a/components/idf_test/include/idf_performance.h b/components/idf_test/include/idf_performance.h deleted file mode 100644 index 743d5cb99e..0000000000 --- a/components/idf_test/include/idf_performance.h +++ /dev/null @@ -1,132 +0,0 @@ -#pragma once - -#include "sdkconfig.h" - -/* put target-specific macros into include/target/idf_performance_target.h */ -#include "idf_performance_target.h" - -/* Define default values in this file with #ifndef if the value could been overwritten in the target-specific headers - * above. Forgetting this will produce compile-time warnings. - */ - -#ifndef IDF_PERFORMANCE_MAX_FREERTOS_SPINLOCK_CYCLES_PER_OP -#define IDF_PERFORMANCE_MAX_FREERTOS_SPINLOCK_CYCLES_PER_OP 215 -#endif -#ifndef IDF_PERFORMANCE_MAX_FREERTOS_SPINLOCK_CYCLES_PER_OP_PSRAM -#define IDF_PERFORMANCE_MAX_FREERTOS_SPINLOCK_CYCLES_PER_OP_PSRAM 300 -#endif -#ifndef IDF_PERFORMANCE_MAX_FREERTOS_SPINLOCK_CYCLES_PER_OP_UNICORE -#define IDF_PERFORMANCE_MAX_FREERTOS_SPINLOCK_CYCLES_PER_OP_UNICORE 130 -#endif -#ifndef IDF_PERFORMANCE_MAX_ESP_TIMER_GET_TIME_PER_CALL -#define IDF_PERFORMANCE_MAX_ESP_TIMER_GET_TIME_PER_CALL 1000 -#endif - -/* Due to code size & linker layout differences interacting with cache, VFS - microbenchmark currently runs slower with PSRAM enabled. */ -#if !CONFIG_FREERTOS_SMP // IDF-5826 -#ifndef IDF_PERFORMANCE_MAX_VFS_OPEN_WRITE_CLOSE_TIME -#define IDF_PERFORMANCE_MAX_VFS_OPEN_WRITE_CLOSE_TIME 20000 -#endif -#ifndef IDF_PERFORMANCE_MAX_VFS_OPEN_WRITE_CLOSE_TIME_PSRAM -#define IDF_PERFORMANCE_MAX_VFS_OPEN_WRITE_CLOSE_TIME_PSRAM 25000 -#endif -#else -#ifndef IDF_PERFORMANCE_MAX_VFS_OPEN_WRITE_CLOSE_TIME -#define IDF_PERFORMANCE_MAX_VFS_OPEN_WRITE_CLOSE_TIME 62000 -#endif -#ifndef IDF_PERFORMANCE_MAX_VFS_OPEN_WRITE_CLOSE_TIME_PSRAM -#define IDF_PERFORMANCE_MAX_VFS_OPEN_WRITE_CLOSE_TIME_PSRAM 66000 -#endif -#endif - -// throughput performance by iperf -#ifndef IDF_PERFORMANCE_MIN_TCP_RX_THROUGHPUT -#define IDF_PERFORMANCE_MIN_TCP_RX_THROUGHPUT 45 -#endif -#ifndef IDF_PERFORMANCE_MIN_TCP_TX_THROUGHPUT -#define IDF_PERFORMANCE_MIN_TCP_TX_THROUGHPUT 40 -#endif -#ifndef IDF_PERFORMANCE_MIN_UDP_RX_THROUGHPUT -#define IDF_PERFORMANCE_MIN_UDP_RX_THROUGHPUT 64 -#endif -#ifndef IDF_PERFORMANCE_MIN_UDP_TX_THROUGHPUT -#define IDF_PERFORMANCE_MIN_UDP_TX_THROUGHPUT 50 -#endif - -// throughput performance by ethernet iperf -#ifndef IDF_PERFORMANCE_MIN_TCP_RX_ETH_THROUGHPUT -#define IDF_PERFORMANCE_MIN_TCP_RX_ETH_THROUGHPUT 20 -#endif -#ifndef IDF_PERFORMANCE_MIN_TCP_TX_ETH_THROUGHPUT -#define IDF_PERFORMANCE_MIN_TCP_TX_ETH_THROUGHPUT 30 -#endif -#ifndef IDF_PERFORMANCE_MIN_UDP_RX_ETH_THROUGHPUT -#define IDF_PERFORMANCE_MIN_UDP_RX_ETH_THROUGHPUT 50 -#endif -#ifndef IDF_PERFORMANCE_MIN_UDP_TX_ETH_THROUGHPUT -#define IDF_PERFORMANCE_MIN_UDP_TX_ETH_THROUGHPUT 70 -#endif - -#ifndef IDF_PERFORMANCE_MIN_TCP_RX_ETH_THROUGHPUT_SPI_ETH -#define IDF_PERFORMANCE_MIN_TCP_RX_ETH_THROUGHPUT_SPI_ETH 6 -#endif -#ifndef IDF_PERFORMANCE_MIN_TCP_TX_ETH_THROUGHPUT_SPI_ETH -#define IDF_PERFORMANCE_MIN_TCP_TX_ETH_THROUGHPUT_SPI_ETH 8 -#endif -#ifndef IDF_PERFORMANCE_MIN_UDP_RX_ETH_THROUGHPUT_SPI_ETH -#define IDF_PERFORMANCE_MIN_UDP_RX_ETH_THROUGHPUT_SPI_ETH 8 -#endif -#ifndef IDF_PERFORMANCE_MIN_UDP_TX_ETH_THROUGHPUT_SPI_ETH -#define IDF_PERFORMANCE_MIN_UDP_TX_ETH_THROUGHPUT_SPI_ETH 10 -#endif - - -// events dispatched per second by event loop library -#if !CONFIG_FREERTOS_SMP // IDF-5826 -#if CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ < 100 // Allowing lesser event dispatch performance for slower CPU frequency chips -#ifndef IDF_PERFORMANCE_MIN_EVENT_DISPATCH -#define IDF_PERFORMANCE_MIN_EVENT_DISPATCH 11000 -#endif -#ifndef IDF_PERFORMANCE_MIN_EVENT_DISPATCH_PSRAM -#define IDF_PERFORMANCE_MIN_EVENT_DISPATCH_PSRAM 9000 -#endif -#else -#ifndef IDF_PERFORMANCE_MIN_EVENT_DISPATCH -#define IDF_PERFORMANCE_MIN_EVENT_DISPATCH 25000 -#endif -#ifndef IDF_PERFORMANCE_MIN_EVENT_DISPATCH_PSRAM -#define IDF_PERFORMANCE_MIN_EVENT_DISPATCH_PSRAM 21000 -#endif -#endif -#else -#ifndef IDF_PERFORMANCE_MIN_EVENT_DISPATCH -#define IDF_PERFORMANCE_MIN_EVENT_DISPATCH 18000 -#endif -#ifndef IDF_PERFORMANCE_MIN_EVENT_DISPATCH_PSRAM -#define IDF_PERFORMANCE_MIN_EVENT_DISPATCH_PSRAM 14000 -#endif -#endif - -#ifndef IDF_PERFORMANCE_MAX_SPILL_REG_CYCLES -#define IDF_PERFORMANCE_MAX_SPILL_REG_CYCLES 150 -#endif -#ifndef IDF_PERFORMANCE_MAX_ISR_ENTER_CYCLES -#define IDF_PERFORMANCE_MAX_ISR_ENTER_CYCLES 290 -#endif -#ifndef IDF_PERFORMANCE_MAX_ISR_EXIT_CYCLES -#define IDF_PERFORMANCE_MAX_ISR_EXIT_CYCLES 565 -#endif - -//time to perform the task selection plus context switch (from task) -#ifndef IDF_PERFORMANCE_MAX_SCHEDULING_TIME -#define IDF_PERFORMANCE_MAX_SCHEDULING_TIME 2000 -#endif - -#ifndef IDF_PERFORMANCE_MAX_MALLOC_DEFAULT_AVERAGE_TIME -#define IDF_PERFORMANCE_MAX_MALLOC_DEFAULT_AVERAGE_TIME 2600 -#endif - -#ifndef IDF_PERFORMANCE_MAX_FREE_DEFAULT_AVERAGE_TIME -#define IDF_PERFORMANCE_MAX_FREE_DEFAULT_AVERAGE_TIME 950 -#endif diff --git a/components/mbedtls/test_apps/include/crypto_performance.h b/components/mbedtls/test_apps/include/crypto_performance.h new file mode 100644 index 0000000000..5358a82f83 --- /dev/null +++ b/components/mbedtls/test_apps/include/crypto_performance.h @@ -0,0 +1,22 @@ +/* + * SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#if __has_include("crypto_performance_esp32.h") +#include "crypto_performance_esp32.h" +#elif __has_include("crypto_performance_esp32s2.h") +#include "crypto_performance_esp32s2.h" +#elif __has_include("crypto_performance_esp32s3.h") +#include "crypto_performance_esp32s3.h" +#elif __has_include("crypto_performance_esp32c2.h") +#include "crypto_performance_esp32c2.h" +#elif __has_include("crypto_performance_esp32c3.h") +#include "crypto_performance_esp32c3.h" +#elif __has_include("crypto_performance_esp32c6.h") +#include "crypto_performance_esp32c6.h" +#elif __has_include("crypto_performance_esp32h2.h") +#include "crypto_performance_esp32h2.h" +#endif diff --git a/components/mbedtls/test_apps/include/crypto_performance_esp32.h b/components/mbedtls/test_apps/include/crypto_performance_esp32.h new file mode 100644 index 0000000000..d357636188 --- /dev/null +++ b/components/mbedtls/test_apps/include/crypto_performance_esp32.h @@ -0,0 +1,29 @@ +/* + * SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#include "sdkconfig.h" + + +// AES-CBC hardware throughput (accounts for worst-case performance with PSRAM workaround) +#define IDF_PERFORMANCE_MIN_AES_CBC_THROUGHPUT_MBSEC 8.2 + +// SHA256 hardware throughput at 240MHz, threshold set lower than worst case +#if CONFIG_FREERTOS_SMP // IDF-5826 +#define IDF_PERFORMANCE_MIN_SHA256_THROUGHPUT_MBSEC 6.0 +#else +#define IDF_PERFORMANCE_MIN_SHA256_THROUGHPUT_MBSEC 8.0 +#endif + +#define IDF_PERFORMANCE_MAX_TIME_SHA1_32KB 5000 +#define IDF_PERFORMANCE_MAX_TIME_SHA512_32KB 4500 + +#define IDF_PERFORMANCE_MAX_RSA_2048KEY_PUBLIC_OP 19000 +#define IDF_PERFORMANCE_MAX_RSA_2048KEY_PRIVATE_OP 750000 +#define IDF_PERFORMANCE_MAX_RSA_3072KEY_PUBLIC_OP 33000 +#define IDF_PERFORMANCE_MAX_RSA_3072KEY_PRIVATE_OP 950000 +#define IDF_PERFORMANCE_MAX_RSA_4096KEY_PUBLIC_OP 90000 +#define IDF_PERFORMANCE_MAX_RSA_4096KEY_PRIVATE_OP 3000000 diff --git a/components/idf_test/include/esp32c2/idf_performance_target.h b/components/mbedtls/test_apps/include/crypto_performance_esp32c2.h similarity index 56% rename from components/idf_test/include/esp32c2/idf_performance_target.h rename to components/mbedtls/test_apps/include/crypto_performance_esp32c2.h index ecf20664e8..234fc1dc28 100644 --- a/components/idf_test/include/esp32c2/idf_performance_target.h +++ b/components/mbedtls/test_apps/include/crypto_performance_esp32c2.h @@ -1,19 +1,10 @@ /* - * SPDX-FileCopyrightText: 2020-2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ - #pragma once -#include "sdkconfig.h" - -#ifdef CONFIG_XTAL_FREQ_26 -#define IDF_PERFORMANCE_MAX_ESP_TIMER_GET_TIME_PER_CALL 1900 -#else -#define IDF_PERFORMANCE_MAX_ESP_TIMER_GET_TIME_PER_CALL 1200 -#endif - // SHA256 hardware throughput at 160 MHz, threshold set lower than worst case #define IDF_PERFORMANCE_MIN_SHA256_THROUGHPUT_MBSEC 14 // esp_sha() time to process 32KB of input data from RAM @@ -26,9 +17,3 @@ #define IDF_PERFORMANCE_MAX_ECDSA_P192_VERIFY_OP 32000 #define IDF_PERFORMANCE_MAX_ECDSA_P256_VERIFY_OP 49000 - -// floating point instructions per divide and per sqrt (configured for worst-case with PSRAM workaround) -#define IDF_PERFORMANCE_MAX_CYCLES_PER_DIV 70 -#define IDF_PERFORMANCE_MAX_CYCLES_PER_SQRT 140 - -#define IDF_PERFORMANCE_MAX_ADC_ONESHOT_STD_ATTEN3 3 diff --git a/components/mbedtls/test_apps/include/crypto_performance_esp32c3.h b/components/mbedtls/test_apps/include/crypto_performance_esp32c3.h new file mode 100644 index 0000000000..06eeded282 --- /dev/null +++ b/components/mbedtls/test_apps/include/crypto_performance_esp32c3.h @@ -0,0 +1,18 @@ +/* + * SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#define IDF_PERFORMANCE_MIN_AES_CBC_THROUGHPUT_MBSEC 43 + +// SHA256 hardware throughput at 160 MHz, threshold set lower than worst case +#define IDF_PERFORMANCE_MIN_SHA256_THROUGHPUT_MBSEC 90 +// esp_sha() time to process 32KB of input data from RAM +#define IDF_PERFORMANCE_MAX_TIME_SHA1_32KB 560 + +#define IDF_PERFORMANCE_MAX_RSA_2048KEY_PUBLIC_OP 19000 +#define IDF_PERFORMANCE_MAX_RSA_2048KEY_PRIVATE_OP 210000 +#define IDF_PERFORMANCE_MAX_RSA_3072KEY_PUBLIC_OP 45000 +#define IDF_PERFORMANCE_MAX_RSA_3072KEY_PRIVATE_OP 670000 diff --git a/components/mbedtls/test_apps/include/crypto_performance_esp32c6.h b/components/mbedtls/test_apps/include/crypto_performance_esp32c6.h new file mode 100644 index 0000000000..da4177e70d --- /dev/null +++ b/components/mbedtls/test_apps/include/crypto_performance_esp32c6.h @@ -0,0 +1,14 @@ +/* + * SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#define IDF_PERFORMANCE_MAX_ECP_P192_POINT_MULTIPLY_OP 5000 +#define IDF_PERFORMANCE_MAX_ECP_P192_POINT_VERIFY_OP 60 +#define IDF_PERFORMANCE_MAX_ECP_P256_POINT_MULTIPLY_OP 8400 +#define IDF_PERFORMANCE_MAX_ECP_P256_POINT_VERIFY_OP 70 + +#define IDF_PERFORMANCE_MAX_ECDSA_P192_VERIFY_OP 18000 +#define IDF_PERFORMANCE_MAX_ECDSA_P256_VERIFY_OP 27000 diff --git a/components/idf_test/include/esp32h2/idf_performance_target.h b/components/mbedtls/test_apps/include/crypto_performance_esp32h2.h similarity index 56% rename from components/idf_test/include/esp32h2/idf_performance_target.h rename to components/mbedtls/test_apps/include/crypto_performance_esp32h2.h index 0351794760..b0400a3069 100644 --- a/components/idf_test/include/esp32h2/idf_performance_target.h +++ b/components/mbedtls/test_apps/include/crypto_performance_esp32h2.h @@ -1,13 +1,10 @@ /* - * SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ - #pragma once -#define IDF_PERFORMANCE_MAX_ESP_TIMER_GET_TIME_PER_CALL 1900 - #define IDF_PERFORMANCE_MIN_AES_CBC_THROUGHPUT_MBSEC 43 // SHA256 hardware throughput at 160 MHz, threshold set lower than worst case @@ -27,15 +24,3 @@ #define IDF_PERFORMANCE_MAX_ECDSA_P192_VERIFY_OP 44000 #define IDF_PERFORMANCE_MAX_ECDSA_P256_VERIFY_OP 67000 - -// floating point instructions per divide and per sqrt (configured for worst-case with PSRAM workaround) -#define IDF_PERFORMANCE_MAX_CYCLES_PER_DIV 70 -#define IDF_PERFORMANCE_MAX_CYCLES_PER_SQRT 140 - -#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_NO_FILTER 10 -#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_2 10 -#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_4 10 -#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_8 10 -#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_16 10 -#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_64 10 -#define IDF_PERFORMANCE_MAX_ADC_ONESHOT_STD_ATTEN3 10 diff --git a/components/idf_test/include/esp32s2/idf_performance_target.h b/components/mbedtls/test_apps/include/crypto_performance_esp32s2.h similarity index 65% rename from components/idf_test/include/esp32s2/idf_performance_target.h rename to components/mbedtls/test_apps/include/crypto_performance_esp32s2.h index 1ef64601a7..ca1704fc5b 100644 --- a/components/idf_test/include/esp32s2/idf_performance_target.h +++ b/components/mbedtls/test_apps/include/crypto_performance_esp32s2.h @@ -1,9 +1,8 @@ /* - * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ - #pragma once #define IDF_PERFORMANCE_MIN_AES_CBC_THROUGHPUT_MBSEC 43.0 @@ -22,11 +21,3 @@ #define IDF_PERFORMANCE_MAX_RSA_3072KEY_PRIVATE_OP 960000 #define IDF_PERFORMANCE_MAX_RSA_4096KEY_PUBLIC_OP 62000 #define IDF_PERFORMANCE_MAX_RSA_4096KEY_PRIVATE_OP 2850000 - -#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_NO_FILTER 3 -#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_2 3 -#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_4 3 -#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_8 3 -#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_16 3 -#define IDF_PERFORMANCE_MAX_ADC_CONTINUOUS_STD_ATTEN3_FILTER_64 3 -#define IDF_PERFORMANCE_MAX_ADC_ONESHOT_STD_ATTEN3 6 diff --git a/components/mbedtls/test_apps/include/crypto_performance_esp32s3.h b/components/mbedtls/test_apps/include/crypto_performance_esp32s3.h new file mode 100644 index 0000000000..b17c3a7af9 --- /dev/null +++ b/components/mbedtls/test_apps/include/crypto_performance_esp32s3.h @@ -0,0 +1,19 @@ +/* + * SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#define IDF_PERFORMANCE_MIN_AES_CBC_THROUGHPUT_MBSEC 43 + +#define IDF_PERFORMANCE_MIN_SHA256_THROUGHPUT_MBSEC 90 +#define IDF_PERFORMANCE_MAX_TIME_SHA1_32KB 1000 +#define IDF_PERFORMANCE_MAX_TIME_SHA512_32KB 900 + +#define IDF_PERFORMANCE_MAX_RSA_2048KEY_PUBLIC_OP 23000 +#define IDF_PERFORMANCE_MAX_RSA_2048KEY_PRIVATE_OP 700000 +#define IDF_PERFORMANCE_MAX_RSA_3072KEY_PUBLIC_OP 45000 +#define IDF_PERFORMANCE_MAX_RSA_3072KEY_PRIVATE_OP 1300000 +#define IDF_PERFORMANCE_MAX_RSA_4096KEY_PUBLIC_OP 80000 +#define IDF_PERFORMANCE_MAX_RSA_4096KEY_PRIVATE_OP 3500000 diff --git a/components/mbedtls/test_apps/main/test_aes_perf.c b/components/mbedtls/test_apps/main/test_aes_perf.c index 9e4508bd30..3949ec9a57 100644 --- a/components/mbedtls/test_apps/main/test_aes_perf.c +++ b/components/mbedtls/test_apps/main/test_aes_perf.c @@ -16,6 +16,7 @@ #include "esp_heap_caps.h" #include "test_utils.h" #include "ccomp_timer.h" +#include "crypto_performance.h" #if CONFIG_MBEDTLS_HARDWARE_AES TEST_CASE("mbedtls AES performance", "[aes][timeout=60]") diff --git a/components/mbedtls/test_apps/main/test_ecp.c b/components/mbedtls/test_apps/main/test_ecp.c index dc514efcdd..e227671710 100644 --- a/components/mbedtls/test_apps/main/test_ecp.c +++ b/components/mbedtls/test_apps/main/test_ecp.c @@ -22,6 +22,8 @@ #include "test_utils.h" #include "ccomp_timer.h" #include "unity.h" +#include "crypto_performance.h" + #if CONFIG_MBEDTLS_HARDWARE_ECC #include "hal/ecc_ll.h" #endif diff --git a/components/mbedtls/test_apps/main/test_mbedtls_ecdsa.c b/components/mbedtls/test_apps/main/test_mbedtls_ecdsa.c index 8ecca659dd..ba7df72bde 100644 --- a/components/mbedtls/test_apps/main/test_mbedtls_ecdsa.c +++ b/components/mbedtls/test_apps/main/test_mbedtls_ecdsa.c @@ -24,6 +24,7 @@ #include "ccomp_timer.h" #include "unity.h" #include "esp_heap_caps.h" +#include "crypto_performance.h" #include "ecdsa/ecdsa_alt.h" #if SOC_KEY_MANAGER_SUPPORTED diff --git a/components/mbedtls/test_apps/main/test_psa_rsa.c b/components/mbedtls/test_apps/main/test_psa_rsa.c index 6cc9e1c5f9..b9db2df261 100644 --- a/components/mbedtls/test_apps/main/test_psa_rsa.c +++ b/components/mbedtls/test_apps/main/test_psa_rsa.c @@ -16,6 +16,7 @@ #include "unity.h" #include "ccomp_timer.h" #include "test_utils.h" +#include "crypto_performance.h" typedef enum { PSA_RSA_KEY_SIZE_2048, diff --git a/components/mbedtls/test_apps/main/test_sha.c b/components/mbedtls/test_apps/main/test_sha.c index 5303d3b3cc..c9ee78b085 100644 --- a/components/mbedtls/test_apps/main/test_sha.c +++ b/components/mbedtls/test_apps/main/test_sha.c @@ -11,7 +11,7 @@ #include "esp_log.h" #include "ccomp_timer.h" #include "esp_heap_caps.h" -#include "idf_performance.h" +#include "crypto_performance.h" #include "esp_private/esp_clk.h" #include "spi_flash_mmap.h" diff --git a/components/mbedtls/test_apps/main/test_sha_perf.c b/components/mbedtls/test_apps/main/test_sha_perf.c index ced1b8fcab..7d70c6e05f 100644 --- a/components/mbedtls/test_apps/main/test_sha_perf.c +++ b/components/mbedtls/test_apps/main/test_sha_perf.c @@ -16,7 +16,7 @@ #include "test_utils.h" #include "ccomp_timer.h" #include "test_mbedtls_utils.h" -#include "psa/crypto.h" +#include "crypto_performance.h" #include "psa/crypto.h" diff --git a/components/vfs/test_apps/include/vfs_performance.h b/components/vfs/test_apps/include/vfs_performance.h new file mode 100644 index 0000000000..452ee3c9da --- /dev/null +++ b/components/vfs/test_apps/include/vfs_performance.h @@ -0,0 +1,26 @@ +/* + * SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#include "sdkconfig.h" + +/* Due to code size & linker layout differences interacting with cache, VFS + microbenchmark currently runs slower with PSRAM enabled. */ +#if !CONFIG_FREERTOS_SMP // IDF-5826 +#ifndef IDF_PERFORMANCE_MAX_VFS_OPEN_WRITE_CLOSE_TIME +#define IDF_PERFORMANCE_MAX_VFS_OPEN_WRITE_CLOSE_TIME 20000 +#endif +#ifndef IDF_PERFORMANCE_MAX_VFS_OPEN_WRITE_CLOSE_TIME_PSRAM +#define IDF_PERFORMANCE_MAX_VFS_OPEN_WRITE_CLOSE_TIME_PSRAM 25000 +#endif +#else +#ifndef IDF_PERFORMANCE_MAX_VFS_OPEN_WRITE_CLOSE_TIME +#define IDF_PERFORMANCE_MAX_VFS_OPEN_WRITE_CLOSE_TIME 62000 +#endif +#ifndef IDF_PERFORMANCE_MAX_VFS_OPEN_WRITE_CLOSE_TIME_PSRAM +#define IDF_PERFORMANCE_MAX_VFS_OPEN_WRITE_CLOSE_TIME_PSRAM 66000 +#endif +#endif diff --git a/components/vfs/test_apps/main/test_vfs_fd.c b/components/vfs/test_apps/main/test_vfs_fd.c index a8c6932dcc..26648d32f3 100644 --- a/components/vfs/test_apps/main/test_vfs_fd.c +++ b/components/vfs/test_apps/main/test_vfs_fd.c @@ -20,6 +20,7 @@ #include "esp_log.h" #include "test_utils.h" #include "ccomp_timer.h" +#include "vfs_performance.h" #include "driver/uart.h" #include "driver/uart_vfs.h" #include "lwip/sockets.h" diff --git a/components/xtensa/test_apps/include/xtensa_performance.h b/components/xtensa/test_apps/include/xtensa_performance.h new file mode 100644 index 0000000000..3dae73095a --- /dev/null +++ b/components/xtensa/test_apps/include/xtensa_performance.h @@ -0,0 +1,10 @@ +/* + * SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#ifndef IDF_PERFORMANCE_MAX_SPILL_REG_CYCLES +#define IDF_PERFORMANCE_MAX_SPILL_REG_CYCLES 150 +#endif diff --git a/conftest.py b/conftest.py index de6cc5b43b..1797992b00 100644 --- a/conftest.py +++ b/conftest.py @@ -418,61 +418,6 @@ def log_performance(record_property: t.Callable[[str, object], None]) -> t.Calla return real_func -@pytest.fixture -def check_performance(idf_path: str) -> t.Callable[[str, float, str], None]: - """ - check if the given performance item meets the passing standard or not - """ - - def real_func(item: str, value: float, target: str) -> None: - """ - :param item: performance item name - :param value: performance item value - :param target: target chip - :raise: AssertionError: if check fails - """ - - def _find_perf_item(operator: str, path: str) -> float: - with open(path, encoding='utf-8') as f: - data = f.read() - match = re.search(rf'#define\s+IDF_PERFORMANCE_{operator}_{item.upper()}\s+([\d.]+)', data) - return float(match.group(1)) # type: ignore - - def _check_perf(operator: str, standard_value: float) -> None: - if operator == 'MAX': - ret = value <= standard_value - else: - ret = value >= standard_value - if not ret: - raise AssertionError( - f"[Performance] {item} value is {value}, doesn't meet pass standard {standard_value}" - ) - - path_prefix = os.path.join(idf_path, 'components', 'idf_test', 'include') - performance_files = ( - os.path.join(path_prefix, target, 'idf_performance_target.h'), - os.path.join(path_prefix, 'idf_performance.h'), - ) - - found_item = False - for op in ['MIN', 'MAX']: - for performance_file in performance_files: - try: - standard = _find_perf_item(op, performance_file) - except (OSError, AttributeError): - # performance file doesn't exist or match is not found in it - continue - - _check_perf(op, standard) - found_item = True - break - - if not found_item: - raise AssertionError(f'Failed to get performance standard for {item}') - - return real_func - - @pytest.fixture def log_minimum_free_heap_size(dut: IdfDut, config: str, idf_path: str) -> t.Callable[..., None]: def real_func() -> None: diff --git a/docs/en/contribute/esp-idf-tests-with-pytest.rst b/docs/en/contribute/esp-idf-tests-with-pytest.rst index 1f2927e564..1cf10e2f5d 100644 --- a/docs/en/contribute/esp-idf-tests-with-pytest.rst +++ b/docs/en/contribute/esp-idf-tests-with-pytest.rst @@ -708,7 +708,7 @@ We provide C macros ``TEST_PERFORMANCE_LESS_THAN`` and ``TEST_PERFORMANCE_GREATE check_performance('RSA_2048KEY_PUBLIC_OP', 123, 'esp32') check_performance('RSA_2048KEY_PUBLIC_OP', 19001, 'esp32') -The above example would first get the threshold values of the performance item ``RSA_2048KEY_PUBLIC_OP`` from :idf_file:`components/idf_test/include/idf_performance.h` and the target-specific one :idf_file:`components/idf_test/include/esp32/idf_performance_target.h`, then check if the value reached the minimum limit or exceeded the maximum limit. +The above example would first get the threshold values of the performance item ``RSA_2048KEY_PUBLIC_OP`` from the component-specific performance header files (e.g., :idf_file:`components/esp_adc/test_apps/adc/include/adc_performance.h` for ADC performance tests), then check if the value reached the minimum limit or exceeded the maximum limit. Let us assume the value of ``IDF_PERFORMANCE_MAX_RSA_2048KEY_PUBLIC_OP`` is 19000. so the first ``check_performance`` line would pass and the second one would fail with warning: ``[Performance] RSA_2048KEY_PUBLIC_OP value is 19001, doesn\'t meet pass standard 19000.0``. diff --git a/docs/zh_CN/contribute/esp-idf-tests-with-pytest.rst b/docs/zh_CN/contribute/esp-idf-tests-with-pytest.rst index 2ab7812746..fdbc8d8dbc 100644 --- a/docs/zh_CN/contribute/esp-idf-tests-with-pytest.rst +++ b/docs/zh_CN/contribute/esp-idf-tests-with-pytest.rst @@ -708,7 +708,7 @@ Pytest 使用技巧 check_performance('RSA_2048KEY_PUBLIC_OP', 123, 'esp32') check_performance('RSA_2048KEY_PUBLIC_OP', 19001, 'esp32') -以上示例会首先从 :idf_file:`components/idf_test/include/idf_performance.h` 和指定目标芯片的 :idf_file:`components/idf_test/include/esp32/idf_performance_target.h` 头文件中获取性能项 ``RSA_2048KEY_PUBLIC_OP`` 的阈值,然后检查该值是否达到了最小值或超过了最大值。 +以上示例会首先从组件特定的性能头文件中获取性能项 ``RSA_2048KEY_PUBLIC_OP`` 的阈值(例如,ADC 性能测试使用 :idf_file:`components/esp_adc/test_apps/adc/include/adc_performance.h`),然后检查该值是否达到了最小值或超过了最大值。 例如,假设 ``IDF_PERFORMANCE_MAX_RSA_2048KEY_PUBLIC_OP`` 的值为 19000,则上例中第一行 ``check_performance`` 会通过测试,第二行会失败并警告:``[Performance] RSA_2048KEY_PUBLIC_OP value is 19001, doesn\'t meet pass standard 19000.0``。 diff --git a/examples/ethernet/iperf/include/eth_iperf_performance.h b/examples/ethernet/iperf/include/eth_iperf_performance.h new file mode 100644 index 0000000000..3e38c5bdce --- /dev/null +++ b/examples/ethernet/iperf/include/eth_iperf_performance.h @@ -0,0 +1,33 @@ +/* + * SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +// throughput performance by ethernet iperf +#ifndef IDF_PERFORMANCE_MIN_TCP_RX_ETH_THROUGHPUT +#define IDF_PERFORMANCE_MIN_TCP_RX_ETH_THROUGHPUT 20 +#endif +#ifndef IDF_PERFORMANCE_MIN_TCP_TX_ETH_THROUGHPUT +#define IDF_PERFORMANCE_MIN_TCP_TX_ETH_THROUGHPUT 30 +#endif +#ifndef IDF_PERFORMANCE_MIN_UDP_RX_ETH_THROUGHPUT +#define IDF_PERFORMANCE_MIN_UDP_RX_ETH_THROUGHPUT 50 +#endif +#ifndef IDF_PERFORMANCE_MIN_UDP_TX_ETH_THROUGHPUT +#define IDF_PERFORMANCE_MIN_UDP_TX_ETH_THROUGHPUT 70 +#endif + +#ifndef IDF_PERFORMANCE_MIN_TCP_RX_ETH_THROUGHPUT_SPI_ETH +#define IDF_PERFORMANCE_MIN_TCP_RX_ETH_THROUGHPUT_SPI_ETH 6 +#endif +#ifndef IDF_PERFORMANCE_MIN_TCP_TX_ETH_THROUGHPUT_SPI_ETH +#define IDF_PERFORMANCE_MIN_TCP_TX_ETH_THROUGHPUT_SPI_ETH 8 +#endif +#ifndef IDF_PERFORMANCE_MIN_UDP_RX_ETH_THROUGHPUT_SPI_ETH +#define IDF_PERFORMANCE_MIN_UDP_RX_ETH_THROUGHPUT_SPI_ETH 8 +#endif +#ifndef IDF_PERFORMANCE_MIN_UDP_TX_ETH_THROUGHPUT_SPI_ETH +#define IDF_PERFORMANCE_MIN_UDP_TX_ETH_THROUGHPUT_SPI_ETH 10 +#endif diff --git a/examples/ethernet/iperf/pytest_eth_iperf.py b/examples/ethernet/iperf/pytest_eth_iperf.py index 39e22d0459..5e5b07ad35 100644 --- a/examples/ethernet/iperf/pytest_eth_iperf.py +++ b/examples/ethernet/iperf/pytest_eth_iperf.py @@ -61,10 +61,25 @@ class IperfTestUtilityEth(IperfUtility.IperfTestUtility): return dut_ip, rssi +# Performance thresholds (Mbps) +ETH_IPERF_THRESHOLDS = { + 'tcp_tx_eth_throughput': 30, + 'tcp_rx_eth_throughput': 20, + 'udp_tx_eth_throughput': 70, + 'udp_rx_eth_throughput': 50, +} + +ETH_IPERF_THRESHOLDS_SPI_ETH = { + 'tcp_tx_eth_throughput_spi_eth': 8, + 'tcp_rx_eth_throughput_spi_eth': 6, + 'udp_tx_eth_throughput_spi_eth': 10, + 'udp_rx_eth_throughput_spi_eth': 8, +} + + def test_esp_eth_iperf( dut: Dut, log_performance: Callable[[str, object], None], - check_performance: Callable[[str, float, str], None], udp_tx_bw_lim: int | None = NO_BANDWIDTH_LIMIT, udp_rx_bw_lim: int | None = NO_BANDWIDTH_LIMIT, spi_eth: bool | None = False, @@ -96,26 +111,27 @@ def test_esp_eth_iperf( test_utility.run_test('udp', 'rx', 0, udp_rx_bw_lim) # 4. log performance and compare with pass standard + thresholds = ETH_IPERF_THRESHOLDS_SPI_ETH if spi_eth else ETH_IPERF_THRESHOLDS for throughput_type in test_result: + throughput_value = test_result[throughput_type].get_best_throughput() log_performance( f'{throughput_type}_throughput', - f'{test_result[throughput_type].get_best_throughput():.02f} Mbps', + f'{throughput_value:.02f} Mbps', ) # do check after logging, otherwise test will exit immediately if check fail, some performance can't be logged. for throughput_type in test_result: if spi_eth: - check_performance( - f'{throughput_type}_eth_throughput_spi_eth', - test_result[throughput_type].get_best_throughput(), - dut.target, - ) + threshold_key = f'{throughput_type}_eth_throughput_spi_eth' else: - check_performance( - f'{throughput_type}_eth_throughput', - test_result[throughput_type].get_best_throughput(), - dut.target, - ) + threshold_key = f'{throughput_type}_eth_throughput' + threshold_value = thresholds.get(threshold_key) + if threshold_value is None: + raise ValueError(f'No threshold defined for {threshold_key}') + throughput_value = test_result[throughput_type].get_best_throughput() + assert throughput_value >= threshold_value, ( + f"[Performance] {threshold_key} value is {throughput_value}, doesn't meet pass standard {threshold_value}" + ) @pytest.mark.eth_ip101 @@ -130,9 +146,8 @@ def test_esp_eth_iperf( def test_esp_eth_iperf_ip101( dut: Dut, log_performance: Callable[[str, object], None], - check_performance: Callable[[str, float, str], None], ) -> None: - test_esp_eth_iperf(dut, log_performance, check_performance, udp_tx_bw_lim=90) + test_esp_eth_iperf(dut, log_performance, udp_tx_bw_lim=90) @pytest.mark.parametrize( @@ -146,9 +161,8 @@ def test_esp_eth_iperf_ip101( def test_esp_eth_iperf_ip101_esp32p4( dut: Dut, log_performance: Callable[[str, object], None], - check_performance: Callable[[str, float, str], None], ) -> None: - test_esp_eth_iperf(dut, log_performance, check_performance, udp_tx_bw_lim=96) + test_esp_eth_iperf(dut, log_performance, udp_tx_bw_lim=96) @pytest.mark.eth_lan8720 @@ -163,9 +177,8 @@ def test_esp_eth_iperf_ip101_esp32p4( def test_esp_eth_iperf_lan8720( dut: Dut, log_performance: Callable[[str, object], None], - check_performance: Callable[[str, float, str], None], ) -> None: - test_esp_eth_iperf(dut, log_performance, check_performance, udp_tx_bw_lim=90) + test_esp_eth_iperf(dut, log_performance, udp_tx_bw_lim=90) @pytest.mark.eth_rtl8201 @@ -180,9 +193,8 @@ def test_esp_eth_iperf_lan8720( def test_esp_eth_iperf_rtl8201( dut: Dut, log_performance: Callable[[str, object], None], - check_performance: Callable[[str, float, str], None], ) -> None: - test_esp_eth_iperf(dut, log_performance, check_performance, udp_tx_bw_lim=90) + test_esp_eth_iperf(dut, log_performance, udp_tx_bw_lim=90) @pytest.mark.eth_dp83848 @@ -197,9 +209,8 @@ def test_esp_eth_iperf_rtl8201( def test_esp_eth_iperf_dp83848( dut: Dut, log_performance: Callable[[str, object], None], - check_performance: Callable[[str, float, str], None], ) -> None: - test_esp_eth_iperf(dut, log_performance, check_performance, udp_tx_bw_lim=90) + test_esp_eth_iperf(dut, log_performance, udp_tx_bw_lim=90) @pytest.mark.eth_ksz8041 @@ -214,9 +225,8 @@ def test_esp_eth_iperf_dp83848( def test_esp_eth_iperf_ksz8041( dut: Dut, log_performance: Callable[[str, object], None], - check_performance: Callable[[str, float, str], None], ) -> None: - test_esp_eth_iperf(dut, log_performance, check_performance, udp_tx_bw_lim=90) + test_esp_eth_iperf(dut, log_performance, udp_tx_bw_lim=90) @pytest.mark.eth_dm9051 @@ -231,9 +241,8 @@ def test_esp_eth_iperf_ksz8041( def test_esp_eth_iperf_dm9051( dut: Dut, log_performance: Callable[[str, object], None], - check_performance: Callable[[str, float, str], None], ) -> None: - test_esp_eth_iperf(dut, log_performance, check_performance, spi_eth=True, udp_rx_bw_lim=10) + test_esp_eth_iperf(dut, log_performance, spi_eth=True, udp_rx_bw_lim=10) @pytest.mark.eth_w5500 @@ -248,9 +257,8 @@ def test_esp_eth_iperf_dm9051( def test_esp_eth_iperf_w5500( dut: Dut, log_performance: Callable[[str, object], None], - check_performance: Callable[[str, float, str], None], ) -> None: - test_esp_eth_iperf(dut, log_performance, check_performance, spi_eth=True, udp_rx_bw_lim=10) + test_esp_eth_iperf(dut, log_performance, spi_eth=True, udp_rx_bw_lim=10) @pytest.mark.eth_ksz8851snl @@ -265,6 +273,5 @@ def test_esp_eth_iperf_w5500( def test_esp_eth_iperf_ksz8851snl( dut: Dut, log_performance: Callable[[str, object], None], - check_performance: Callable[[str, float, str], None], ) -> None: - test_esp_eth_iperf(dut, log_performance, check_performance, spi_eth=True, udp_rx_bw_lim=10) + test_esp_eth_iperf(dut, log_performance, spi_eth=True, udp_rx_bw_lim=10) diff --git a/examples/wifi/iperf/include/wifi_iperf_performance.h b/examples/wifi/iperf/include/wifi_iperf_performance.h new file mode 100644 index 0000000000..af4f189d43 --- /dev/null +++ b/examples/wifi/iperf/include/wifi_iperf_performance.h @@ -0,0 +1,20 @@ +/* + * SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +// throughput performance by iperf +#ifndef IDF_PERFORMANCE_MIN_TCP_RX_THROUGHPUT +#define IDF_PERFORMANCE_MIN_TCP_RX_THROUGHPUT 45 +#endif +#ifndef IDF_PERFORMANCE_MIN_TCP_TX_THROUGHPUT +#define IDF_PERFORMANCE_MIN_TCP_TX_THROUGHPUT 40 +#endif +#ifndef IDF_PERFORMANCE_MIN_UDP_RX_THROUGHPUT +#define IDF_PERFORMANCE_MIN_UDP_RX_THROUGHPUT 64 +#endif +#ifndef IDF_PERFORMANCE_MIN_UDP_TX_THROUGHPUT +#define IDF_PERFORMANCE_MIN_UDP_TX_THROUGHPUT 50 +#endif diff --git a/examples/wifi/iperf/pytest_iperf.py b/examples/wifi/iperf/pytest_iperf.py index 5858a4af22..f7a8cdb122 100644 --- a/examples/wifi/iperf/pytest_iperf.py +++ b/examples/wifi/iperf/pytest_iperf.py @@ -1,7 +1,5 @@ # SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: Unlicense OR CC0-1.0 -from pytest_embedded_idf.utils import idf_parametrize - """ Test case for iperf example. @@ -17,14 +15,16 @@ The test env wifi_iperf do need the following config:: pc_nic: "eth1" """ + import os -from typing import Callable +from collections.abc import Callable import pytest from common_test_methods import get_env_config_variable from common_test_methods import get_host_ip_by_interface from idf_iperf_test_util import IperfUtility from pytest_embedded import Dut +from pytest_embedded_idf.utils import idf_parametrize # configurations RETRY_COUNT_FOR_BEST_PERFORMANCE = 2 @@ -34,6 +34,15 @@ NO_BANDWIDTH_LIMIT = -1 # iperf send bandwidth is not limited BEST_PERFORMANCE_CONFIG = '99' +# Performance thresholds (Mbps) +WIFI_IPERF_THRESHOLDS = { + 'tcp_tx_throughput': 40, + 'tcp_rx_throughput': 45, + 'udp_tx_throughput': 50, + 'udp_rx_throughput': 64, +} + + @pytest.mark.temp_skip_ci(targets=['esp32s2', 'esp32c3', 'esp32s3'], reason='lack of runners (run only for ESP32)') @pytest.mark.timeout(1200) @pytest.mark.wifi_iperf @@ -42,7 +51,6 @@ BEST_PERFORMANCE_CONFIG = '99' def test_wifi_throughput_basic( dut: Dut, log_performance: Callable[[str, str], None], - check_performance: Callable[[str, float, str], None], ) -> None: """ steps: | @@ -79,13 +87,19 @@ def test_wifi_throughput_basic( # 4. log performance and compare with pass standard for throughput_type in test_result: + throughput_value = test_result[throughput_type].get_best_throughput() log_performance( - '{}_throughput'.format(throughput_type), - '{:.02f} Mbps'.format(test_result[throughput_type].get_best_throughput()), + f'{throughput_type}_throughput', + f'{throughput_value:.02f} Mbps', ) # do check after logging, otherwise test will exit immediately if check fail, some performance can't be logged. for throughput_type in test_result: - check_performance( - '{}_throughput'.format(throughput_type), test_result[throughput_type].get_best_throughput(), dut.target + threshold_key = f'{throughput_type}_throughput' + threshold_value = WIFI_IPERF_THRESHOLDS.get(threshold_key) + if threshold_value is None: + raise ValueError(f'No threshold defined for {threshold_key}') + throughput_value = test_result[throughput_type].get_best_throughput() + assert throughput_value >= threshold_value, ( + f"[Performance] {threshold_key} value is {throughput_value}, doesn't meet pass standard {threshold_value}" ) diff --git a/tools/ci/check_copyright_ignore.txt b/tools/ci/check_copyright_ignore.txt index 4e42c7b4be..0d6101edfb 100644 --- a/tools/ci/check_copyright_ignore.txt +++ b/tools/ci/check_copyright_ignore.txt @@ -460,7 +460,6 @@ components/fatfs/src/ff.h components/fatfs/src/ffconf.h components/fatfs/src/ffsystem.c components/fatfs/src/ffunicode.c -components/idf_test/include/idf_performance.h components/log/host_test/log_test/main/log_test.cpp components/mbedtls/esp_crt_bundle/test_gen_crt_bundle/test_gen_crt_bundle.py components/mbedtls/port/aes/esp_aes_xts.c diff --git a/tools/ci/check_public_headers_exceptions.txt b/tools/ci/check_public_headers_exceptions.txt index 2d510902fd..cb0ac51d4a 100644 --- a/tools/ci/check_public_headers_exceptions.txt +++ b/tools/ci/check_public_headers_exceptions.txt @@ -52,7 +52,6 @@ components/protocomm/proto-c/ components/fatfs/vfs/vfs_fat_internal.h components/fatfs/src/ffconf.h -components/idf_test/include/idf_performance.h components/spiffs/include/spiffs_config.h diff --git a/tools/test_apps/components/test_utils/CMakeLists.txt b/tools/test_apps/components/test_utils/CMakeLists.txt index 5b2ba8900f..5a56bbf3b5 100644 --- a/tools/test_apps/components/test_utils/CMakeLists.txt +++ b/tools/test_apps/components/test_utils/CMakeLists.txt @@ -23,6 +23,6 @@ endif() idf_component_register(SRCS ${srcs} INCLUDE_DIRS include - REQUIRES esp_partition idf_test cmock + REQUIRES esp_partition cmock PRIV_REQUIRES "${priv_requires}") target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") diff --git a/tools/test_apps/components/test_utils/include/test_utils.h b/tools/test_apps/components/test_utils/include/test_utils.h index 6526c88d1b..19fec822e5 100644 --- a/tools/test_apps/components/test_utils/include/test_utils.h +++ b/tools/test_apps/components/test_utils/include/test_utils.h @@ -13,9 +13,6 @@ #include "sdkconfig.h" #include "unity.h" #include "soc/soc_caps.h" -/* include performance pass standards header file */ -#include "idf_performance.h" -#include "idf_performance_target.h" #ifdef __cplusplus extern "C" {