diff options
author | Robin Nehls <nehls@mi.fu-berlin.de> | 2011-05-21 14:53:01 +0200 |
---|---|---|
committer | Robin Nehls <nehls@mi.fu-berlin.de> | 2011-05-21 14:53:01 +0200 |
commit | ef62382005c5f9c97bc472b73cd13e87778b7adf (patch) | |
tree | f5db2bb4a6c3aa1afbde7d518829224271e96cff /cacheRows2.c | |
parent | 4d877a521588edf342c36c41c1437158c6617621 (diff) | |
parent | c630a1b07403339ab3ce74cc10798cd0353230ad (diff) | |
download | manycore-ef62382005c5f9c97bc472b73cd13e87778b7adf.tar.gz manycore-ef62382005c5f9c97bc472b73cd13e87778b7adf.tar.bz2 manycore-ef62382005c5f9c97bc472b73cd13e87778b7adf.zip |
merged cacheRows and added my own version
Diffstat (limited to 'cacheRows2.c')
-rw-r--r-- | cacheRows2.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/cacheRows2.c b/cacheRows2.c new file mode 100644 index 0000000..08b8142 --- /dev/null +++ b/cacheRows2.c @@ -0,0 +1,33 @@ +#include <stdio.h> +#include "inlineasm.h" +#include <stdlib.h> + +#define MEASURE_METHOD optmemmeasure +#define FIELD_SIZE 20000 + +int main(int argc, char* argv[]) { + + 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; +} + |