Add Benchmark Sequential
This commit is contained in:
parent
ecc577117b
commit
c66bcee6f5
|
@ -96,13 +96,15 @@ void organize_result(const benchmark_handle *handle, clock_t start_time,
|
|||
}
|
||||
}
|
||||
|
||||
void print_result() {
|
||||
void print_result(void *g_time_diff) {
|
||||
int i = 0;
|
||||
while (bmh_list[i].handle != NULL) {
|
||||
printf("[BENCHMARK] Time Cost: %-15s %.4f\n", bmh_list[i].name,
|
||||
bmh_list[i].time);
|
||||
i++;
|
||||
}
|
||||
printf("[BENCHMARK] Global Time Diff: %f\n",
|
||||
(float)(*(clock_t *)g_time_diff / (10 * TICK_PER_SECOND)));
|
||||
};
|
||||
|
||||
int done_cnt = 0;
|
||||
|
@ -131,6 +133,7 @@ void *run_one_example(void *arg) {
|
|||
}
|
||||
|
||||
pthread_attr_t case_attr;
|
||||
pthread_t res_thread;
|
||||
void *run_benchmark_parallel(void *args) {
|
||||
done_cnt = 0;
|
||||
volatile int result;
|
||||
|
@ -159,15 +162,12 @@ void *run_benchmark_parallel(void *args) {
|
|||
|
||||
cur_handle = cur_handle->next;
|
||||
}
|
||||
struct timespec abstime;
|
||||
abstime.tv_sec = 60;
|
||||
PrivSemaphoreObtainWait(&syn_sem, &abstime);
|
||||
|
||||
stop_trigger(&g_stop_time);
|
||||
|
||||
print_result();
|
||||
printf("[BENCHMARK] Global Time Diff: %f\n",
|
||||
(float)((g_stop_time - g_start_time) / (10 * TICK_PER_SECOND)));
|
||||
clock_t g_time_diff = g_stop_time - g_start_time;
|
||||
case_attr.schedparam.sched_priority = 23;
|
||||
case_attr.stacksize = 4096;
|
||||
PrivTaskCreate(&res_thread, &case_attr, print_result, &g_time_diff);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -205,7 +205,8 @@ void *run_benchmark_sequential(void *args) {
|
|||
}
|
||||
stop_trigger(&g_stop_time);
|
||||
|
||||
print_result();
|
||||
clock_t g_time_diff = g_stop_time - g_start_time;
|
||||
print_result(&g_time_diff);
|
||||
printf("[BENCHMARK] Global Time Diff: %f\n",
|
||||
(float)((g_stop_time - g_start_time) / (10 * TICK_PER_SECOND)));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue