add benchmark to app. TODO: test benchmark.
This commit is contained in:
parent
07b1f5da5b
commit
fbc7d384f0
|
@ -1,5 +1,5 @@
|
|||
# SRC_FILES := beebsc.c benchmark.c
|
||||
SRC_FILES := $(wildcard src/*/*.c)
|
||||
SRC_FILES += $(wildcard *.c)
|
||||
|
||||
# include $(APPDIR)/Application.mk
|
||||
include $(KERNEL_ROOT)/compiler.mk
|
|
@ -12,7 +12,9 @@
|
|||
#ifndef BEEBSC_H
|
||||
#define BEEBSC_H
|
||||
|
||||
#include <assert.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* BEEBS fixes RAND_MAX to its lowest permitted value, 2^15-1 */
|
||||
|
||||
|
@ -36,10 +38,13 @@
|
|||
|
||||
This function just*/
|
||||
|
||||
// #define assert_beebs(expr) \
|
||||
// { \
|
||||
// if (!(expr)) exit(1); \
|
||||
// }
|
||||
|
||||
#define assert_beebs(expr) \
|
||||
{ \
|
||||
if (!(expr)) exit(1); \
|
||||
}
|
||||
{ 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)
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <stdio.h>
|
||||
#include <support.h>
|
||||
#include <time.h>
|
||||
#include <transform.h>
|
||||
|
||||
extern benchmark_handle mont64_handle;
|
||||
extern benchmark_handle crc32_handle;
|
||||
|
@ -70,8 +71,8 @@ float tmp_diff = 0.0;
|
|||
|
||||
float global_diff = 0.0;
|
||||
clock_t start_time = 0, end_time = 0;
|
||||
void start_trigger(void) { start_time = clock(); }
|
||||
void stop_trigger(void) { end_time = clock(); }
|
||||
void start_trigger(void) { start_time = PrivGetTickTime(); }
|
||||
void stop_trigger(void) { end_time = PrivGetTickTime(); }
|
||||
|
||||
void init_benchmark_runset() {
|
||||
int i = 0;
|
||||
|
@ -80,7 +81,7 @@ void init_benchmark_runset() {
|
|||
}
|
||||
}
|
||||
void organize_result(const benchmark_handle *handle) {
|
||||
tmp_diff = (float)(end_time - start_time) / CLOCKS_PER_SEC;
|
||||
tmp_diff = (float)(end_time - start_time) / TICK_PER_SECOND;
|
||||
global_diff += tmp_diff;
|
||||
int i = 0;
|
||||
while (bmh_list[i].handle != NULL) {
|
||||
|
@ -132,11 +133,11 @@ int run_benchmark() {
|
|||
return (!correct);
|
||||
}
|
||||
|
||||
int embenchmark() {
|
||||
static int embenchmark(void) {
|
||||
run_benchmark();
|
||||
printf("[BENCHMARK] Global Time Diff: %f\n", global_diff);
|
||||
return 0;
|
||||
}
|
||||
PRIV_SHELL_CMD_FUNCTION(embenchmark, run embenchmark, PRIV_SHELL_CMD_MAIN_ATTR);
|
||||
PRIV_SHELL_CMD_FUNCTION(embenchmark, benchmark, PRIV_SHELL_CMD_MAIN_ATTR);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -497,7 +497,7 @@ endif
|
|||
|
||||
endif
|
||||
|
||||
# ifeq ($(CONFIG_BENCHMARK), y)
|
||||
ifeq ($(CONFIG_APP_BENCHMARK), y)
|
||||
KERNELPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Applications/benchmark/support
|
||||
KERNELPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Applications/benchmark/src/cubic \
|
||||
-I$(KERNEL_ROOT)/../../APP_Framework/Applications/benchmark/src/picojpeg \
|
||||
|
@ -505,7 +505,7 @@ KERNELPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Applications/benchmark/src/c
|
|||
-I$(KERNEL_ROOT)/../../APP_Framework/Applications/benchmark/src/sglib-combined \
|
||||
-I$(KERNEL_ROOT)/../../APP_Framework/Applications/benchmark/src/slre \
|
||||
-lm
|
||||
# endif
|
||||
endif
|
||||
|
||||
|
||||
ifeq ($(CONFIG_TOOL_SHELL), y)
|
||||
|
|
Loading…
Reference in New Issue