/* Micro-Benchmark - benchmark using RDTSC Compare writing doubles to an array vs the sin() of that value */ #include #include /* select mode */ #define WRITE_DOUBLE #undef COMPUTE_SIN /* My machine runs at 3.2 GHz */ #define PROCESSOR_FREQ 3200E6 #include "rdtsc.h" /* how many repetitions to measure */ #define REPS 1000 /* size of the array */ #define ARRAY_SIZE 100 /* Set MODE variables */ #if defined WRITE_DOUBLE #define MODE "write double" #elif defined COMPUTE_SIN #define MODE "compute sin()" #else #error MODE undefined #endif /* sadly not defined in VisualStudio.NET 2003 */ #ifndef MIN #define MIN(a,b) ((a) < (b) ? (a) : (b)) #endif void main(void) { double src[ARRAY_SIZE], dst[ARRAY_SIZE]; tsc_counter t0, t1, t_min; int i, j; /* init */ for (i=0; i