add benchmark to app. TODO: test benchmark.
This commit is contained in:
parent
958d8e26df
commit
846743982b
|
@ -43,13 +43,8 @@
|
|||
// if (!(expr)) exit(1); \
|
||||
// }
|
||||
|
||||
// #define assert_beebs(expr) \
|
||||
// { assert(expr); }
|
||||
|
||||
#define assert_beebs(expr) \
|
||||
{ \
|
||||
if (!(expr)) return; \
|
||||
}
|
||||
{ assert(expr); }
|
||||
|
||||
#define float_eq_beebs(exp, actual) (fabsf(exp - actual) < VERIFY_FLOAT_EPS)
|
||||
#define float_neq_beebs(exp, actual) !float_eq_beebs(exp, actual)
|
||||
|
|
|
@ -104,7 +104,7 @@ void print_result() {
|
|||
}
|
||||
};
|
||||
|
||||
int run_benchmark() {
|
||||
void *run_benchmark(void *args) {
|
||||
int i = 0;
|
||||
volatile int result;
|
||||
int correct;
|
||||
|
@ -137,12 +137,17 @@ int run_benchmark() {
|
|||
}
|
||||
|
||||
// print_result();
|
||||
return (!correct);
|
||||
printf("[BENCHMARK] Global Time Diff: %f\n", global_diff);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pthread_t benchmark_task;
|
||||
static int embenchmark(void) {
|
||||
run_benchmark();
|
||||
printf("[BENCHMARK] Global Time Diff: %f\n", global_diff);
|
||||
pthread_attr_t attr;
|
||||
attr.schedparam.sched_priority = 25;
|
||||
attr.stacksize = 4096;
|
||||
|
||||
PrivTaskCreate(&benchmark_task, &attr, run_benchmark, NULL);
|
||||
return 0;
|
||||
}
|
||||
PRIV_SHELL_CMD_FUNCTION(embenchmark, benchmark, PRIV_SHELL_CMD_MAIN_ATTR);
|
||||
|
|
Loading…
Reference in New Issue