Add Benchmark Sequential
This commit is contained in:
parent
753490f880
commit
9112466dce
|
@ -64,8 +64,8 @@ BenchmarkPair bmh_list[] = {
|
|||
|
||||
float benchmark_time[25];
|
||||
|
||||
extern benchmark_handle *get_benchmark_list();
|
||||
extern void add_benchmark_handle(benchmark_handle *head, benchmark_handle *);
|
||||
// extern benchmark_handle *get_benchmark_list();
|
||||
extern void add_benchmark_handle(benchmark_handle *, benchmark_handle *);
|
||||
|
||||
float tmp_diff = 0.0;
|
||||
float global_diff = 0.0;
|
||||
|
@ -82,7 +82,7 @@ void init_benchmark_runset(benchmark_handle *head) {
|
|||
}
|
||||
void organize_result(const benchmark_handle *handle, clock_t start_time,
|
||||
clock_t end_time) {
|
||||
tmp_diff = (float)(end_time - start_time) / TICK_PER_SECOND;
|
||||
tmp_diff = (float)(end_time - start_time) / (10 * TICK_PER_SECOND);
|
||||
global_diff += tmp_diff;
|
||||
int i = 0;
|
||||
while (bmh_list[i].handle != NULL) {
|
||||
|
@ -183,10 +183,12 @@ void *run_benchmark_sequential(void *args) {
|
|||
volatile int result = cur_handle->handle.benchmark_func->benchmark();
|
||||
stop_trigger(&end_time);
|
||||
|
||||
printf("[Benchmark] End current task\n");
|
||||
int correct = cur_handle->handle.benchmark_func->verify_benchmark(result);
|
||||
if (!correct) {
|
||||
printf("[EmBench] Wrong result!.\n");
|
||||
}
|
||||
|
||||
organize_result(cur_handle, start_time, end_time);
|
||||
|
||||
cur_handle = cur_handle->next;
|
||||
|
@ -199,8 +201,13 @@ static int embenchmark_parallel(void) {
|
|||
run_benchmark_parallel(NULL);
|
||||
return 0;
|
||||
}
|
||||
pthread_t sequential_thread;
|
||||
static int embenchmark_sequential(void) {
|
||||
run_benchmark_sequential(NULL);
|
||||
case_attr.schedparam.sched_priority = 30;
|
||||
case_attr.stacksize = 16384;
|
||||
PrivTaskCreate(&sequential_thread, &case_attr, run_benchmark_sequential,
|
||||
NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
PRIV_SHELL_CMD_FUNCTION(embenchmark_parallel, run benchmark in parallel,
|
||||
|
|
Loading…
Reference in New Issue