Add Benchmark to App. TODO: Test Benchmark at other kernels.

This commit is contained in:
TXuian 2022-12-08 15:18:41 +08:00
parent cfa923decf
commit da410c8529
1 changed files with 4 additions and 2 deletions

View File

@ -139,7 +139,7 @@ void *run_benchmark(void *args) {
init_benchmark_runset(&head); init_benchmark_runset(&head);
printf("[BENCHMARK] Start Benchmark running.\n"); printf("[BENCHMARK] Start Benchmark running.\n");
case_attr.schedparam.sched_priority = 25; case_attr.schedparam.sched_priority = 30;
case_attr.stacksize = 16384; case_attr.stacksize = 16384;
PrivSemaphoreCreate(&syn_sem, 0, -20); PrivSemaphoreCreate(&syn_sem, 0, -20);
PrivMutexCreate(&case_mu, 0); PrivMutexCreate(&case_mu, 0);
@ -153,7 +153,9 @@ void *run_benchmark(void *args) {
cur_handle = cur_handle->next; cur_handle = cur_handle->next;
} }
PrivSemaphoreObtainWait(&syn_sem, NULL); struct timespec abstime;
abstime.tv_sec = 10;
PrivSemaphoreObtainWait(&syn_sem, &abstime);
print_result(); print_result();
printf("[BENCHMARK] Global Time Diff: %f, Done: %d\n", global_diff, done_cnt); printf("[BENCHMARK] Global Time Diff: %f, Done: %d\n", global_diff, done_cnt);
return NULL; return NULL;