From b0a383d5bd705e9e38b38e6a3ec00eb53166f1b6 Mon Sep 17 00:00:00 2001 From: Joshua Bakita Date: Tue, 26 May 2020 21:38:52 -0400 Subject: 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 --- baseline/source/extra.h | 55 +++++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 27 deletions(-) (limited to 'baseline/source/extra.h') 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 @@ #endif #define LOAD_PARAMS_ITRL \ - if (argc < 9) { \ - printf("Usage: %s <\?\?\?>", argv[0]);\ + if (argc < 6) { \ + printf("Usage: %s \n", argv[0]);\ exit(1);\ }\ char *thisProgram=argv[1];\ int maxJobs=atoi(argv[2]);\ char *thisCore=argv[3];\ - char *otherCore=argv[4];\ - char *otherProgram=argv[5];\ - char *runID=argv[6];\ - int output=atoi(argv[7]);\ + char *runID=argv[4];\ + int output=atoi(argv[5]);\ pid_t killMe;\ struct timespec start, end;\ int jobsComplete;\ int jobs_complete = -1;\ - long progTime[maxJobs*output];\ - memset(progTime, 0, sizeof(long)*maxJobs*output);\ + float progTime[maxJobs*output];\ + memset(progTime, 0, sizeof(float)*maxJobs*output);\ char fileName[50];\ char *bigArray;\ int wasteCount;\ - unsigned long mmdc_read[maxJobs];\ - unsigned long mmdc_write[maxJobs];\ - memset(mmdc_read, 0, sizeof(unsigned long)*maxJobs);\ - memset(mmdc_write, 0, sizeof(unsigned long)*maxJobs);\ + float mmdc_read[maxJobs];\ + float mmdc_write[maxJobs];\ + memset(mmdc_read, 0, sizeof(float)*maxJobs);\ + memset(mmdc_write, 0, sizeof(float)*maxJobs);\ strcpy(fileName, runID);\ strcat(fileName, ".txt");\ mlockall(MCL_CURRENT || MCL_FUTURE); @@ -102,10 +100,10 @@ res.cpu = cpu; \ res.priority = LITMUS_HIGHEST_PRIORITY; \ /* we take over half the CPU time (these are ns) */ \ - res.polling_params.budget = ms2ns(999); \ - res.polling_params.period = ms2ns(1000); \ + res.polling_params.budget = ms2ns(3000); \ + res.polling_params.period = ms2ns(3000); \ res.polling_params.offset = 0; \ - res.polling_params.relative_deadline = ms2ns(999); \ + res.polling_params.relative_deadline = ms2ns(3000); \ /* Not 100% sure that we should use periodic polling */ \ if (reservation_create(PERIODIC_POLLING, &res) < 0) { \ perror("Unable to create reservation"); \ @@ -163,14 +161,19 @@ #if MMDC_PROF #define SAVE_RESULTS \ if(jobs_complete>-1) {\ - progTime[jobs_complete]=(end.tv_nsec-start.tv_nsec)+(1000000000*(end.tv_sec-start.tv_sec));\ + progTime[jobs_complete] = end.tv_sec - start.tv_sec;\ + progTime[jobs_complete] *= 1000000000;\ + progTime[jobs_complete] += end.tv_nsec - start.tv_nsec;\ mmdc_read[jobs_complete] = mmdc_res.read_bytes;\ mmdc_write[jobs_complete] = mmdc_res.write_bytes;\ } #else #define SAVE_RESULTS \ - if(jobs_complete>-1)\ - progTime[jobs_complete]=(end.tv_nsec-start.tv_nsec)+(1000000000*(end.tv_sec-start.tv_sec)); + if(jobs_complete>-1) {\ + progTime[jobs_complete] = end.tv_sec - start.tv_sec;\ + progTime[jobs_complete] *= 1000000000;\ + progTime[jobs_complete] += end.tv_nsec - start.tv_nsec;\ + } #endif @@ -188,8 +191,8 @@ exit(1);\ }\ for(int i = 0; i <= jobs_complete; i++){\ - fprintf(fp, "%s %s %s %s %d %ld %s %d %lu %lu \n",\ - thisProgram, otherProgram, thisCore, otherCore, maxJobs,\ + fprintf(fp, "%s none %s none %d %.f %s %d %.f %.f \n",\ + thisProgram, thisCore, maxJobs,\ progTime[i], runID, i, mmdc_read[i], mmdc_write[i]);\ }\ fclose(fp);\ @@ -250,7 +253,7 @@ #define START_LOOP FLUSH_CACHES START_TIMER #endif -#define STOP_LOOP STOP_TIMER SAVE_RESULTS jobs_complete++; +#define STOP_LOOP STOP_TIMER jobs_complete++; SAVE_RESULTS /* @@ -260,12 +263,10 @@ main SET_UP notice that STOP LOOP negates the ++ if outout=0 for (jobsComplete=-1; jobsComplete