fix(esp_timer): place esp_timer_get_time test to IRAM

This commit is contained in:
Alexey Lapshin 2024-07-24 01:02:37 +07:00
parent 29b028076a
commit 1370511dff

View File

@ -389,7 +389,7 @@ TEST_CASE("esp_timer for very short intervals", "[esp_timer]")
} }
#if !CONFIG_IDF_TARGET_ESP32C61 // TODO: IDF-10955, test fail #if !CONFIG_IDF_TARGET_ESP32C61 // TODO: IDF-10955, test fail
TEST_CASE("esp_timer_get_time call takes less than 1us", "[esp_timer]") static void IRAM_ATTR test_esp_timer_get_time_performance(void)
{ {
int64_t begin = esp_timer_get_time(); int64_t begin = esp_timer_get_time();
volatile int64_t end; volatile int64_t end;
@ -400,6 +400,11 @@ TEST_CASE("esp_timer_get_time call takes less than 1us", "[esp_timer]")
int ns_per_call = (int)((end - begin) * 1000 / iter_count); int ns_per_call = (int)((end - begin) * 1000 / iter_count);
TEST_PERFORMANCE_LESS_THAN(ESP_TIMER_GET_TIME_PER_CALL, "%dns", ns_per_call); TEST_PERFORMANCE_LESS_THAN(ESP_TIMER_GET_TIME_PER_CALL, "%dns", ns_per_call);
} }
TEST_CASE("esp_timer_get_time call takes less than 1us", "[esp_timer]")
{
test_esp_timer_get_time_performance();
}
#endif #endif
static int64_t IRAM_ATTR __attribute__((noinline)) get_clock_diff(void) static int64_t IRAM_ATTR __attribute__((noinline)) get_clock_diff(void)