add benchmark to app. TODO: test benchmark.
This commit is contained in:
parent
02ff38a344
commit
222fc55b08
|
@ -68,7 +68,6 @@ extern benchmark_handle *get_benchmark_list();
|
|||
extern void add_benchmark_handle(benchmark_handle *head, benchmark_handle *);
|
||||
|
||||
float tmp_diff = 0.0;
|
||||
|
||||
float global_diff = 0.0;
|
||||
void start_trigger(clock_t *start_time) { *start_time = PrivGetTickTime(); }
|
||||
void stop_trigger(clock_t *end_time) { *end_time = PrivGetTickTime(); }
|
||||
|
@ -103,6 +102,7 @@ void print_result() {
|
|||
}
|
||||
};
|
||||
|
||||
pthread_mutex_t case_mu;
|
||||
sem_t syn_sem;
|
||||
void *run_one_example(void *arg) {
|
||||
const benchmark_handle *handle = arg;
|
||||
|
@ -118,7 +118,9 @@ void *run_one_example(void *arg) {
|
|||
if (!correct) {
|
||||
printf("[EmBench] Wrong result!.\n");
|
||||
}
|
||||
PrivMutexObtain(&case_mu);
|
||||
organize_result(handle, start_time, end_time);
|
||||
PrivMutexAbandon(&case_mu);
|
||||
PrivSemaphoreAbandon(&syn_sem);
|
||||
}
|
||||
|
||||
|
@ -138,6 +140,7 @@ void *run_benchmark(void *args) {
|
|||
case_attr.schedparam.sched_priority = 30;
|
||||
case_attr.stacksize = 16384;
|
||||
PrivSemaphoreCreate(&syn_sem, 0, -21);
|
||||
PrivMutexCreate(&case_mu, 0);
|
||||
|
||||
benchmark_handle *cur_handle = head.next;
|
||||
while (NULL != cur_handle) {
|
||||
|
|
Loading…
Reference in New Issue