00001
00002
00003
00004
00005
00006
00007
00008 #include <stdio.h>
00009 #include <stdlib.h>
00010 #include "coremark.h"
00011
00012 #if VALIDATION_RUN
00013 volatile ee_s32 seed1_volatile=0x3415;
00014 volatile ee_s32 seed2_volatile=0x3415;
00015 volatile ee_s32 seed3_volatile=0x66;
00016 #endif
00017 #if PERFORMANCE_RUN
00018 volatile ee_s32 seed1_volatile=0x0;
00019 volatile ee_s32 seed2_volatile=0x0;
00020 volatile ee_s32 seed3_volatile=0x66;
00021 #endif
00022 #if PROFILE_RUN
00023 volatile ee_s32 seed1_volatile=0x8;
00024 volatile ee_s32 seed2_volatile=0x8;
00025 volatile ee_s32 seed3_volatile=0x8;
00026 #endif
00027 volatile ee_s32 seed4_volatile=ITERATIONS;
00028 volatile ee_s32 seed5_volatile=0;
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 #define NSECS_PER_SEC CLOCKS_PER_SEC
00041 #define CORETIMETYPE clock_t
00042 #define GETMYTIME(_t) (*_t=clock())
00043 #define MYTIMEDIFF(fin,ini) ((fin)-(ini))
00044 #define TIMER_RES_DIVIDER 1
00045 #define SAMPLE_TIME_IMPLEMENTATION 1
00046 #define EE_TICKS_PER_SEC (NSECS_PER_SEC / TIMER_RES_DIVIDER)
00047
00048
00049 static CORETIMETYPE start_time_val, stop_time_val;
00050
00051
00052
00053
00054
00055
00056
00057 void start_time(void) {
00058 GETMYTIME(&start_time_val );
00059 }
00060
00061
00062
00063
00064
00065
00066 void stop_time(void) {
00067 GETMYTIME(&stop_time_val );
00068 }
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078 CORE_TICKS get_time(void) {
00079 CORE_TICKS elapsed=(CORE_TICKS)(MYTIMEDIFF(stop_time_val, start_time_val));
00080 return elapsed;
00081 }
00082
00083
00084
00085
00086
00087
00088 secs_ret time_in_secs(CORE_TICKS ticks) {
00089 secs_ret retval=((secs_ret)ticks) / (secs_ret)EE_TICKS_PER_SEC;
00090 return retval;
00091 }
00092
00093 ee_u32 default_num_contexts=1;
00094
00095
00096
00097
00098
00099 void portable_init(core_portable *p, int *argc, char *argv[])
00100 {
00101 if (sizeof(ee_ptr_int) != sizeof(ee_u8 *)) {
00102 ee_printf("ERROR! Please define ee_ptr_int to a type that holds a pointer!\n");
00103 }
00104 if (sizeof(ee_u32) != 4) {
00105 ee_printf("ERROR! Please define ee_u32 to a 32b unsigned type!\n");
00106 }
00107 p->portable_id=1;
00108 }
00109
00110
00111
00112 void portable_fini(core_portable *p)
00113 {
00114 p->portable_id=0;
00115 }
00116
00117