diff options
author | Robin Nehls <nehls@mi.fu-berlin.de> | 2011-05-21 14:50:13 +0200 |
---|---|---|
committer | Robin Nehls <nehls@mi.fu-berlin.de> | 2011-05-21 14:50:13 +0200 |
commit | 4d877a521588edf342c36c41c1437158c6617621 (patch) | |
tree | a5126a9ba5a9b2e2fd1fafef6b0e61f1b833b1b5 /cacheRows.c | |
parent | 2c650b096b7040abb50ac3fb85b4c68a57a4b1e5 (diff) | |
download | manycore-4d877a521588edf342c36c41c1437158c6617621.tar.gz manycore-4d877a521588edf342c36c41c1437158c6617621.tar.bz2 manycore-4d877a521588edf342c36c41c1437158c6617621.zip |
experiemts
Diffstat (limited to 'cacheRows.c')
-rw-r--r-- | cacheRows.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/cacheRows.c b/cacheRows.c index b784ee3..08b8142 100644 --- a/cacheRows.c +++ b/cacheRows.c @@ -3,31 +3,31 @@ #include <stdlib.h> #define MEASURE_METHOD optmemmeasure -#define RUNS 1000 -#define MIN_OFFSET 1 -#define MAX_OFFSET 128 -#define OFFSETS = MAX_OFFSET - MIN_OFFSET -#define FIELD_TYPE uint32_t +#define FIELD_SIZE 20000 int main(int argc, char* argv[]) { - - //uint64_t *results = malloc(sizeof(uint64_t)*RUNS*OFFSETS); - FIELD_TYPE *field = malloc(sizeof(FIELD_TYPE)*RUNS*OFFSETS); - int i=0; - - for(i=0;i <= RUNS;i++){ - measure(i*OFFSETS,field); - } - - - return 0; + + char *field = malloc(FIELD_SIZE); + int i,j; + uint64_t time=0; + + // fill array with crap + for (i=0;i < FIELD_SIZE; ++i) { + field[i]=(i+2342) % 255; + } + + for(i=0; i<FIELD_SIZE; ++i) { + time=optmemmeasure(field,i); + if (time < 1000) + fprintf(stdout,"%d %lld\n",i,time); + + // scrambeled eggs + for (j=0;j<FIELD_SIZE-1;++j) { + field[i]=(field[i]*field[i+1]) % 255; + } + field[FIELD_SIZE-1] = (field[FIELD_SIZE-1]*field[0]) % 255; + } + + return 0; } -void measure(int offset,FIELD_TYPE *field){ - int lowerAddress = field + sizeof(FIELD_TYPE)*offset; - - for(i=MIN_OFFSET;i <= MAX_OFFSET;i++){ - unit64_t time = MEASURE_METHOD((void*)lowerAddress,i*sizeof(FIELD_TYPE)); - fprintf(stdout,"%d %lld",i,time); - } -} |