add benchmark to app. TODO: test benchmark.

This commit is contained in:
TXuian 2022-12-07 16:27:33 +08:00
parent e3e27d9de9
commit fed2304578
1 changed files with 8 additions and 8 deletions

View File

@ -52,13 +52,13 @@ BenchmarkPair bmh_list[] = {
// {.handle = &primecount_handle, .name = "primecount", .time = 0}, // // {.handle = &primecount_handle, .name = "primecount", .time = 0}, //
// {.handle = &qrtest_handle, .name = "qrtest", .time = 0}, // // {.handle = &qrtest_handle, .name = "qrtest", .time = 0}, //
// {.handle = &combined_handle, .name = "combined", .time = 0}, // // {.handle = &combined_handle, .name = "combined", .time = 0}, //
// {.handle = &slre_handle, .name = "slre", .time = 0}, // {.handle = &slre_handle, .name = "slre", .time = 0}, //
// {.handle = &libst_handle, .name = "libst", .time = 0}, // {.handle = &libst_handle, .name = "libst", .time = 0}, //
// {.handle = &statemate_handle, .name = "statemate", .time = 0}, // {.handle = &statemate_handle, .name = "statemate", .time = 0}, //
// {.handle = &tarfind_handle, .name = "tarfind", .time = 0}, // {.handle = &tarfind_handle, .name = "tarfind", .time = 0}, //
// {.handle = &libud_handle, .name = "libud", .time = 0}, // {.handle = &libud_handle, .name = "libud", .time = 0}, //
// {.handle = &libwikisort_handle, .name = "libwikisort", .time = 0}, // {.handle = &libwikisort_handle, .name = "libwikisort", .time = 0}, //
{.handle = NULL, .name = "", .time = 0}, // {.handle = NULL, .name = "", .time = 0}, //
}; };
float benchmark_time[25]; float benchmark_time[25];
@ -66,7 +66,6 @@ float benchmark_time[25];
extern benchmark_handle *get_benchmark_list(); extern benchmark_handle *get_benchmark_list();
extern void add_benchmark_handle(benchmark_handle *head, benchmark_handle *); extern void add_benchmark_handle(benchmark_handle *head, benchmark_handle *);
int store_idx = 0;
float tmp_diff = 0.0; float tmp_diff = 0.0;
float global_diff = 0.0; float global_diff = 0.0;
@ -79,6 +78,7 @@ void init_benchmark_runset(benchmark_handle *head) {
while (bmh_list[i].handle != NULL) { while (bmh_list[i].handle != NULL) {
add_benchmark_handle(head, bmh_list[i++].handle); add_benchmark_handle(head, bmh_list[i++].handle);
} }
global_diff = 0;
} }
void organize_result(const benchmark_handle *handle) { void organize_result(const benchmark_handle *handle) {
tmp_diff = (float)(end_time - start_time) / TICK_PER_SECOND; tmp_diff = (float)(end_time - start_time) / TICK_PER_SECOND;