mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/scheduling_time_test_overflow' into 'master'
bugfix/freertos: Fix accumulator overflow on scheduling time test See merge request espressif/esp-idf!8261
This commit is contained in:
commit
5c1d317766
@ -11,6 +11,8 @@
|
||||
#include "soc/cpu.h"
|
||||
#include "test_utils.h"
|
||||
|
||||
#define NUMBER_OF_ITERATIONS 10
|
||||
|
||||
typedef struct {
|
||||
SemaphoreHandle_t end_sema;
|
||||
uint32_t before_sched;
|
||||
@ -31,14 +33,18 @@ static void test_task_1(void *arg) {
|
||||
|
||||
static void test_task_2(void *arg) {
|
||||
test_context_t *context = (test_context_t *)arg;
|
||||
uint32_t accumulator = 0;
|
||||
uint64_t accumulator = 0;
|
||||
|
||||
for(int i = 0; i < 10000; i++) {
|
||||
vTaskPrioritySet(NULL, CONFIG_UNITY_FREERTOS_PRIORITY + 1);
|
||||
vTaskPrioritySet(context->t1_handle, CONFIG_UNITY_FREERTOS_PRIORITY + 1);
|
||||
vPortYield();
|
||||
|
||||
for(int i = 0; i < NUMBER_OF_ITERATIONS; i++) {
|
||||
accumulator += (portGET_RUN_TIME_COUNTER_VALUE() - context->before_sched);
|
||||
vPortYield();
|
||||
}
|
||||
|
||||
context->cycles_to_sched = accumulator / 10000;
|
||||
context->cycles_to_sched = accumulator / NUMBER_OF_ITERATIONS;
|
||||
vTaskDelete(context->t1_handle);
|
||||
xSemaphoreGive(context->end_sema);
|
||||
vTaskDelete(NULL);
|
||||
@ -55,8 +61,8 @@ TEST_CASE("scheduling time test", "[freertos]")
|
||||
xTaskCreatePinnedToCore(test_task_1, "test1" , 4096, &context, 1, &context.t1_handle,1);
|
||||
xTaskCreatePinnedToCore(test_task_2, "test2" , 4096, &context, 1, NULL,1);
|
||||
#else
|
||||
xTaskCreatePinnedToCore(test_task_1, "test1" , 4096, &context, 1, &context.t1_handle,0);
|
||||
xTaskCreatePinnedToCore(test_task_2, "test2" , 4096, &context, 1, NULL,0);
|
||||
xTaskCreatePinnedToCore(test_task_1, "test1" , 4096, &context, CONFIG_UNITY_FREERTOS_PRIORITY - 1, &context.t1_handle,0);
|
||||
xTaskCreatePinnedToCore(test_task_2, "test2" , 4096, &context, CONFIG_UNITY_FREERTOS_PRIORITY - 1, NULL,0);
|
||||
#endif
|
||||
|
||||
BaseType_t result = xSemaphoreTake(context.end_sema, portMAX_DELAY);
|
||||
|
@ -92,5 +92,5 @@
|
||||
|
||||
//time to perform the task selection plus context switch (from task)
|
||||
#ifndef IDF_PERFORMANCE_MAX_SCHEDULING_TIME
|
||||
#define IDF_PERFORMANCE_MAX_SCHEDULING_TIME 1500
|
||||
#define IDF_PERFORMANCE_MAX_SCHEDULING_TIME 2000
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user