Add Benchmark Sequential

This commit is contained in:
TXuian 2022-12-09 20:54:04 +08:00
parent 2978604f54
commit 0672a44fd2
2 changed files with 7 additions and 2 deletions

View File

@ -2,6 +2,7 @@
#define _BENCHMARK_H_ #define _BENCHMARK_H_
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <support.h> #include <support.h>
#include <time.h> #include <time.h>
#include <transform.h> #include <transform.h>
@ -132,12 +133,14 @@ void *run_benchmark_parallel(void *args) {
done_cnt = 0; done_cnt = 0;
volatile int result; volatile int result;
int correct; int correct;
// CPU_MHZ = *(int *)args;
benchmark_handle head = { benchmark_handle head = {
.handle.magic_number = MAGIC_NUMBER, .handle.magic_number = MAGIC_NUMBER,
.next = NULL, .next = NULL,
}; };
init_benchmark_runset(&head); init_benchmark_runset(&head);
print_result();
printf("[BENCHMARK] Start Benchmark running parallel.\n"); printf("[BENCHMARK] Start Benchmark running parallel.\n");
case_attr.schedparam.sched_priority = 30; case_attr.schedparam.sched_priority = 30;
@ -171,6 +174,7 @@ void *run_benchmark_sequential(void *args) {
.next = NULL, .next = NULL,
}; };
init_benchmark_runset(&head); init_benchmark_runset(&head);
print_result();
printf("[BENCHMARK] Start Benchmark running sequential.\n"); printf("[BENCHMARK] Start Benchmark running sequential.\n");
benchmark_handle *cur_handle = head.next; benchmark_handle *cur_handle = head.next;
while (NULL != cur_handle) { while (NULL != cur_handle) {
@ -195,7 +199,7 @@ void *run_benchmark_sequential(void *args) {
printf("[BENCHMARK] Global Time Diff: %f\n", global_diff); printf("[BENCHMARK] Global Time Diff: %f\n", global_diff);
} }
static int embenchmark_parallel(void) { static int embenchmark_parallel(int argc, char *argv[]) {
run_benchmark_parallel(NULL); run_benchmark_parallel(NULL);
return 0; return 0;
} }

View File

@ -29,7 +29,8 @@
#include <stddef.h> #include <stddef.h>
#include <transform.h> #include <transform.h>
#define CPU_MHZ 500 #define CPU_MHZ 10
// int CPU_MHZ = 500;
/* Benchmarks must implement verify_benchmark, which must return -1 if no /* Benchmarks must implement verify_benchmark, which must return -1 if no
verification is done. */ verification is done. */