diff options
Diffstat (limited to 'baseline/source/litmusStuff.h')
| -rw-r--r-- | baseline/source/litmusStuff.h | 80 |
1 files changed, 0 insertions, 80 deletions
diff --git a/baseline/source/litmusStuff.h b/baseline/source/litmusStuff.h deleted file mode 100644 index dca2360..0000000 --- a/baseline/source/litmusStuff.h +++ /dev/null | |||
| @@ -1,80 +0,0 @@ | |||
| 1 | #include <time.h> | ||
| 2 | #include <sys/mman.h> | ||
| 3 | #include <stdlib.h> | ||
| 4 | #include <stdio.h> | ||
| 5 | #include <string.h> | ||
| 6 | #include <signal.h> | ||
| 7 | #include <limits.h> | ||
| 8 | #include <../litmus.h> | ||
| 9 | |||
| 10 | #define L3_CACHE_SIZE (11264*1024) | ||
| 11 | |||
| 12 | #define SAVE_RESULTS if(jobsComplete>-1) progTime[jobsComplete]=(end.tv_nsec-start.tv_nsec)+(1000000000*(end.tv_sec-start.tv_sec)); | ||
| 13 | |||
| 14 | |||
| 15 | #define SET_UP char *thisProgram=argv[1];\ | ||
| 16 | int maxJobs=atoi(argv[2]);\ | ||
| 17 | char *thisCore=argv[3];\ | ||
| 18 | char *otherCore=argv[4];\ | ||
| 19 | char *otherProgram=argv[5];\ | ||
| 20 | char *runID=argv[6];\ | ||
| 21 | int output=atoi(argv[7]);\ | ||
| 22 | struct timespec start, end;\ | ||
| 23 | int jobsComplete;\ | ||
| 24 | long progTime[maxJobs*output];\ | ||
| 25 | char fileName[50];\ | ||
| 26 | char *bigArray;\ | ||
| 27 | strcpy(fileName, runID);\ | ||
| 28 | strcat(fileName, ".txt");\ | ||
| 29 | mlockall(MCL_CURRENT || MCL_FUTURE); | ||
| 30 | |||
| 31 | #define WRITE_TO_FILE if (output){\ | ||
| 32 | munlockall();\ | ||
| 33 | FILE *fp=fopen(fileName, "a");\ | ||
| 34 | for(jobsComplete=0; jobsComplete<maxJobs; jobsComplete++){\ | ||
| 35 | fprintf(fp, "%s %s %s %s %d %ld %s %d \n",\ | ||
| 36 | thisProgram, otherProgram, thisCore, otherCore, maxJobs,\ | ||
| 37 | progTime[jobsComplete], runID, jobsComplete);\ | ||
| 38 | }\ | ||
| 39 | fclose(fp);\ | ||
| 40 | } | ||
| 41 | |||
| 42 | #define KILL_CACHE bigArray=(char *)malloc(L3_CACHE_SIZE);\ | ||
| 43 | if (bigArray==NULL) perror("Malloc failed.\n");\ | ||
| 44 | memset(bigArray, 1, L3_CACHE_SIZE);\ | ||
| 45 | munlock(bigArray, L3_CACHE_SIZE);\ | ||
| 46 | free(bigArray);\ | ||
| 47 | bigArray=NULL; | ||
| 48 | |||
| 49 | |||
| 50 | |||
| 51 | //invoke start timer twice, stop timer to make sure timer and vars are in cache | ||
| 52 | #define START_TIMER clock_gettime(CLOCK_MONOTONIC, &start);\ | ||
| 53 | clock_gettime(CLOCK_MONOTONIC, &end);\ | ||
| 54 | clock_gettime(CLOCK_MONOTONIC, &start);\ | ||
| 55 | |||
| 56 | #define STOP_TIMER clock_gettime(CLOCK_MONOTONIC, &end); | ||
| 57 | |||
| 58 | |||
| 59 | #define START_LOOP START_TIMER | ||
| 60 | |||
| 61 | #define STOP_LOOP if (output) {STOP_TIMER SAVE_RESULTS} sleep_next_period(); | ||
| 62 | |||
| 63 | |||
| 64 | /* | ||
| 65 | Intended structure | ||
| 66 | |||
| 67 | main | ||
| 68 | SET_UP | ||
| 69 | notice that STOP LOOP negates the ++ if outout=0 | ||
| 70 | for (jobsComplete=-1; jobsComplete<maxJobs; jobsComplete++){ | ||
| 71 | KILL_CACHE | ||
| 72 | START_TIMER | ||
| 73 | tacleInit(); | ||
| 74 | tacleMain(); | ||
| 75 | STOP_TIMER | ||
| 76 | SAVE_RESULTS | ||
| 77 | } | ||
| 78 | WRITE_TO_FILE | ||
| 79 | tacleReturn | ||
| 80 | */ | ||
