diff options
| author | Joshua Bakita <bakitajoshua@gmail.com> | 2020-05-26 21:38:52 -0400 |
|---|---|---|
| committer | Joshua Bakita <bakitajoshua@gmail.com> | 2020-05-26 21:51:16 -0400 |
| commit | b0a383d5bd705e9e38b38e6a3ec00eb53166f1b6 (patch) | |
| tree | c6a574719690eb62d5a85d5db72d10d3d047dd16 /baseline/source | |
| parent | 4f1aa00f177646b5129304a7d587658aad949946 (diff) | |
Code cleanup and bugfixes for infrastructure code
- Remove unused parameters to extra.h
- Use floats to avoid integer overflow when timing long loops
- Only include litmus headers and/or MMDC headers if the appropriate
define is set in extra.h
- Update job parameters to match those used in my PRP experiments
Diffstat (limited to 'baseline/source')
| -rw-r--r-- | baseline/source/extra.h | 55 |
1 files changed, 28 insertions, 27 deletions
diff --git a/baseline/source/extra.h b/baseline/source/extra.h index df8164f..81ec146 100644 --- a/baseline/source/extra.h +++ b/baseline/source/extra.h | |||
| @@ -46,30 +46,28 @@ | |||
| 46 | #endif | 46 | #endif |
| 47 | 47 | ||
| 48 | #define LOAD_PARAMS_ITRL \ | 48 | #define LOAD_PARAMS_ITRL \ |
| 49 | if (argc < 9) { \ | 49 | if (argc < 6) { \ |
| 50 | printf("Usage: %s <name> <loops> <my core> <unused> <unused> <runID> <\?\?\?>", argv[0]);\ | 50 | printf("Usage: %s <name> <loops> <my core> <runID> <save results?>\n", argv[0]);\ |
| 51 | exit(1);\ | 51 | exit(1);\ |
| 52 | }\ | 52 | }\ |
| 53 | char *thisProgram=argv[1];\ | 53 | char *thisProgram=argv[1];\ |
| 54 | int maxJobs=atoi(argv[2]);\ | 54 | int maxJobs=atoi(argv[2]);\ |
| 55 | char *thisCore=argv[3];\ | 55 | char *thisCore=argv[3];\ |
| 56 | char *otherCore=argv[4];\ | 56 | char *runID=argv[4];\ |
| 57 | char *otherProgram=argv[5];\ | 57 | int output=atoi(argv[5]);\ |
| 58 | char *runID=argv[6];\ | ||
| 59 | int output=atoi(argv[7]);\ | ||
| 60 | pid_t killMe;\ | 58 | pid_t killMe;\ |
| 61 | struct timespec start, end;\ | 59 | struct timespec start, end;\ |
| 62 | int jobsComplete;\ | 60 | int jobsComplete;\ |
| 63 | int jobs_complete = -1;\ | 61 | int jobs_complete = -1;\ |
| 64 | long progTime[maxJobs*output];\ | 62 | float progTime[maxJobs*output];\ |
| 65 | memset(progTime, 0, sizeof(long)*maxJobs*output);\ | 63 | memset(progTime, 0, sizeof(float)*maxJobs*output);\ |
| 66 | char fileName[50];\ | 64 | char fileName[50];\ |
| 67 | char *bigArray;\ | 65 | char *bigArray;\ |
| 68 | int wasteCount;\ | 66 | int wasteCount;\ |
| 69 | unsigned long mmdc_read[maxJobs];\ | 67 | float mmdc_read[maxJobs];\ |
| 70 | unsigned long mmdc_write[maxJobs];\ | 68 | float mmdc_write[maxJobs];\ |
| 71 | memset(mmdc_read, 0, sizeof(unsigned long)*maxJobs);\ | 69 | memset(mmdc_read, 0, sizeof(float)*maxJobs);\ |
| 72 | memset(mmdc_write, 0, sizeof(unsigned long)*maxJobs);\ | 70 | memset(mmdc_write, 0, sizeof(float)*maxJobs);\ |
| 73 | strcpy(fileName, runID);\ | 71 | strcpy(fileName, runID);\ |
| 74 | strcat(fileName, ".txt");\ | 72 | strcat(fileName, ".txt");\ |
| 75 | mlockall(MCL_CURRENT || MCL_FUTURE); | 73 | mlockall(MCL_CURRENT || MCL_FUTURE); |
| @@ -102,10 +100,10 @@ | |||
| 102 | res.cpu = cpu; \ | 100 | res.cpu = cpu; \ |
| 103 | res.priority = LITMUS_HIGHEST_PRIORITY; \ | 101 | res.priority = LITMUS_HIGHEST_PRIORITY; \ |
| 104 | /* we take over half the CPU time (these are ns) */ \ | 102 | /* we take over half the CPU time (these are ns) */ \ |
| 105 | res.polling_params.budget = ms2ns(999); \ | 103 | res.polling_params.budget = ms2ns(3000); \ |
| 106 | res.polling_params.period = ms2ns(1000); \ | 104 | res.polling_params.period = ms2ns(3000); \ |
| 107 | res.polling_params.offset = 0; \ | 105 | res.polling_params.offset = 0; \ |
| 108 | res.polling_params.relative_deadline = ms2ns(999); \ | 106 | res.polling_params.relative_deadline = ms2ns(3000); \ |
| 109 | /* Not 100% sure that we should use periodic polling */ \ | 107 | /* Not 100% sure that we should use periodic polling */ \ |
| 110 | if (reservation_create(PERIODIC_POLLING, &res) < 0) { \ | 108 | if (reservation_create(PERIODIC_POLLING, &res) < 0) { \ |
| 111 | perror("Unable to create reservation"); \ | 109 | perror("Unable to create reservation"); \ |
| @@ -163,14 +161,19 @@ | |||
| 163 | #if MMDC_PROF | 161 | #if MMDC_PROF |
| 164 | #define SAVE_RESULTS \ | 162 | #define SAVE_RESULTS \ |
| 165 | if(jobs_complete>-1) {\ | 163 | if(jobs_complete>-1) {\ |
| 166 | progTime[jobs_complete]=(end.tv_nsec-start.tv_nsec)+(1000000000*(end.tv_sec-start.tv_sec));\ | 164 | progTime[jobs_complete] = end.tv_sec - start.tv_sec;\ |
| 165 | progTime[jobs_complete] *= 1000000000;\ | ||
| 166 | progTime[jobs_complete] += end.tv_nsec - start.tv_nsec;\ | ||
| 167 | mmdc_read[jobs_complete] = mmdc_res.read_bytes;\ | 167 | mmdc_read[jobs_complete] = mmdc_res.read_bytes;\ |
| 168 | mmdc_write[jobs_complete] = mmdc_res.write_bytes;\ | 168 | mmdc_write[jobs_complete] = mmdc_res.write_bytes;\ |
| 169 | } | 169 | } |
| 170 | #else | 170 | #else |
| 171 | #define SAVE_RESULTS \ | 171 | #define SAVE_RESULTS \ |
| 172 | if(jobs_complete>-1)\ | 172 | if(jobs_complete>-1) {\ |
| 173 | progTime[jobs_complete]=(end.tv_nsec-start.tv_nsec)+(1000000000*(end.tv_sec-start.tv_sec)); | 173 | progTime[jobs_complete] = end.tv_sec - start.tv_sec;\ |
| 174 | progTime[jobs_complete] *= 1000000000;\ | ||
| 175 | progTime[jobs_complete] += end.tv_nsec - start.tv_nsec;\ | ||
| 176 | } | ||
| 174 | #endif | 177 | #endif |
| 175 | 178 | ||
| 176 | 179 | ||
| @@ -188,8 +191,8 @@ | |||
| 188 | exit(1);\ | 191 | exit(1);\ |
| 189 | }\ | 192 | }\ |
| 190 | for(int i = 0; i <= jobs_complete; i++){\ | 193 | for(int i = 0; i <= jobs_complete; i++){\ |
| 191 | fprintf(fp, "%s %s %s %s %d %ld %s %d %lu %lu \n",\ | 194 | fprintf(fp, "%s none %s none %d %.f %s %d %.f %.f \n",\ |
| 192 | thisProgram, otherProgram, thisCore, otherCore, maxJobs,\ | 195 | thisProgram, thisCore, maxJobs,\ |
| 193 | progTime[i], runID, i, mmdc_read[i], mmdc_write[i]);\ | 196 | progTime[i], runID, i, mmdc_read[i], mmdc_write[i]);\ |
| 194 | }\ | 197 | }\ |
| 195 | fclose(fp);\ | 198 | fclose(fp);\ |
| @@ -250,7 +253,7 @@ | |||
| 250 | #define START_LOOP FLUSH_CACHES START_TIMER | 253 | #define START_LOOP FLUSH_CACHES START_TIMER |
| 251 | #endif | 254 | #endif |
| 252 | 255 | ||
| 253 | #define STOP_LOOP STOP_TIMER SAVE_RESULTS jobs_complete++; | 256 | #define STOP_LOOP STOP_TIMER jobs_complete++; SAVE_RESULTS |
| 254 | 257 | ||
| 255 | 258 | ||
| 256 | /* | 259 | /* |
| @@ -260,12 +263,10 @@ main | |||
| 260 | SET_UP | 263 | SET_UP |
| 261 | notice that STOP LOOP negates the ++ if outout=0 | 264 | notice that STOP LOOP negates the ++ if outout=0 |
| 262 | for (jobsComplete=-1; jobsComplete<maxJobs; jobsComplete++){ | 265 | for (jobsComplete=-1; jobsComplete<maxJobs; jobsComplete++){ |
| 263 | KILL_CACHE | 266 | START_LOOP |
| 264 | START_TIMER | 267 | tacleInit(); |
| 265 | tacleInit(); | 268 | tacleMain(); |
| 266 | tacleMain(); | 269 | STOP_LOOP |
| 267 | STOP_TIMER | ||
| 268 | SAVE_RESULTS | ||
| 269 | } | 270 | } |
| 270 | WRITE_TO_FILE | 271 | WRITE_TO_FILE |
| 271 | tacleReturn | 272 | tacleReturn |
