Created
May 2, 2022 11:33
-
-
Save tuanpmt/4356641e6804db6093e288d644df87d7 to your computer and use it in GitHub Desktop.
fib_task
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void core1_task(void *ptr) | |
{ | |
int i = ((thread_args *) ptr)->input; | |
((thread_args *) ptr)->output = fib(i); | |
xSemaphoreGive(xSemaphore); | |
vTaskDelete(NULL); | |
} | |
int test_dual_core(int num) | |
{ | |
thread_args args; | |
int start, end, f; | |
start = xTaskGetTickCount(); | |
args.input = num - 1; | |
xTaskCreatePinnedToCore(core1_task, "core1", 10*1024, &args, 10, NULL, 1); | |
f = fib(num - 2); | |
xSemaphoreTake(xSemaphore, portMAX_DELAY); | |
f += args.output; | |
end = xTaskGetTickCount(); | |
return end - start; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment