summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Nehls <nehls@mi.fu-berlin.de>2011-05-21 16:48:49 +0200
committerRobin Nehls <nehls@mi.fu-berlin.de>2011-05-21 16:48:49 +0200
commit8e310fdf6917bf16d7dc4d07a29a803ae4e1d4ce (patch)
treeecb1a690fe4dbde1989cd27ad8b2954a4f78eb52
parentfea56ab1c923a9f642b867470664f2bc2e855a61 (diff)
downloadmanycore-8e310fdf6917bf16d7dc4d07a29a803ae4e1d4ce.tar.gz
manycore-8e310fdf6917bf16d7dc4d07a29a803ae4e1d4ce.tar.bz2
manycore-8e310fdf6917bf16d7dc4d07a29a803ae4e1d4ce.zip
added my version of cacheRows, gives some results
-rw-r--r--cacheRows2.c49
1 files changed, 32 insertions, 17 deletions
diff --git a/cacheRows2.c b/cacheRows2.c
index 08b8142..e6295f6 100644
--- a/cacheRows2.c
+++ b/cacheRows2.c
@@ -1,32 +1,47 @@
#include <stdio.h>
-#include "inlineasm.h"
#include <stdlib.h>
+#include "inlineasm.h"
-#define MEASURE_METHOD optmemmeasure
-#define FIELD_SIZE 20000
+#define FIELD_SIZE 5000
+#define MIN_TIME 120
+#define MAX_TIME 1000
-int main(int argc, char* argv[]) {
-
- char *field = malloc(FIELD_SIZE);
- int i,j;
- uint64_t time=0;
+int main(int argc, char* argv[])
+{
+ char *field1 = malloc(FIELD_SIZE);
+ char *field2 = malloc(FIELD_SIZE);
+ char *current = field1;
+ unsigned long i,j;
+ unsigned long time=0;
+ FILE *f=stdout;
- // fill array with crap
+ // fill arrays with crap
for (i=0;i < FIELD_SIZE; ++i) {
- field[i]=(i+2342) % 255;
+ field1[i]=(i+2342) % 255;
+ field2[i]=(i+4223) % 255;
}
+ // print table reader
+ if (argc == 1) {
+ f=fopen("output.dat","w");
+ fprintf(f,"Offset Ticks\n");
+ }
+
for(i=0; i<FIELD_SIZE; ++i) {
- time=optmemmeasure(field,i);
- if (time < 1000)
- fprintf(stdout,"%d %lld\n",i,time);
+ time=memmeasure(current,i);
+ if (time < MAX_TIME && time > MIN_TIME )
+ fprintf(f,"%lu %lu\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;
+ if (current == field1) {
+ current = field2;
+ }
+ else {
+ current = field1;
+ }
+
}
+ fclose(f);
return 0;
}