summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoshua Bakita <bakitajoshua@gmail.com>2020-05-26 21:38:52 -0400
committerJoshua Bakita <bakitajoshua@gmail.com>2020-05-26 21:51:16 -0400
commitb0a383d5bd705e9e38b38e6a3ec00eb53166f1b6 (patch)
treec6a574719690eb62d5a85d5db72d10d3d047dd16
parent4f1aa00f177646b5129304a7d587658aad949946 (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
-rw-r--r--baseline/Makefile63
-rwxr-xr-xbaseline/run_baseline.sh7
-rw-r--r--baseline/source/extra.h55
-rwxr-xr-x[-rw-r--r--]dis/original/Makefile18
4 files changed, 88 insertions, 55 deletions
diff --git a/baseline/Makefile b/baseline/Makefile
index 53f53f4..ef39b7d 100644
--- a/baseline/Makefile
+++ b/baseline/Makefile
@@ -1,55 +1,70 @@
1CC = gcc 1LIBLITMUS ?= /media/speedy/litmus/liblitmus
2CC ?= gcc
2CFLAGS = -pthread -O2 3CFLAGS = -pthread -O2
3LDFLAGS = -lrt 4LDFLAGS = -lrt
5COMMON = ./source/extra.h
6
7# Handle cases where we're also profiling with the MMDC on the i.MX6Q
8ifneq ($(shell grep "define MMDC 1" source/extra.h),)
9 COMMON += /media/speedy/litmus/tools/mmdc/mmdc.c
10endif
11
12# Include all the LITMUS^RT headers if we're using it
13ifneq ($(shell grep "define LITMUS 1" source/extra.h),)
14 CFLAGS += -I${LIBLITMUS}/include -I${LIBLITMUS}/arch/arm/include
15 LDFLAGS += -L${LIBLITMUS} -llitmus
16endif
17
4all: bin/cjpeg_wrbmp bin/huff_enc bin/gsm_enc bin/dijkstra bin/h264_dec bin/susan bin/adpcm_enc bin/rijndael_dec bin/huff_dec bin/rijndael_enc bin/gsm_dec bin/anagram bin/epic bin/ammunition bin/g723_enc bin/ndes bin/petrinet bin/statemate bin/cjpeg_transupp bin/mpeg2 bin/fmref bin/audiobeam bin/adpcm_dec 18all: bin/cjpeg_wrbmp bin/huff_enc bin/gsm_enc bin/dijkstra bin/h264_dec bin/susan bin/adpcm_enc bin/rijndael_dec bin/huff_dec bin/rijndael_enc bin/gsm_dec bin/anagram bin/epic bin/ammunition bin/g723_enc bin/ndes bin/petrinet bin/statemate bin/cjpeg_transupp bin/mpeg2 bin/fmref bin/audiobeam bin/adpcm_dec
5 19
6.PHONY: clean 20.PHONY: clean
7clean: 21clean:
8 rm bin/cjpeg_wrbmp bin/huff_enc bin/gsm_enc bin/dijkstra bin/h264_dec bin/susan bin/adpcm_enc bin/rijndael_dec bin/huff_dec bin/rijndael_enc bin/gsm_dec bin/anagram bin/epic bin/ammunition bin/g723_enc bin/ndes bin/petrinet bin/statemate bin/cjpeg_transupp bin/mpeg2 bin/fmref bin/audiobeam bin/adpcm_dec 22 rm bin/cjpeg_wrbmp bin/huff_enc bin/gsm_enc bin/dijkstra bin/h264_dec bin/susan bin/adpcm_enc bin/rijndael_dec bin/huff_dec bin/rijndael_enc bin/gsm_dec bin/anagram bin/epic bin/ammunition bin/g723_enc bin/ndes bin/petrinet bin/statemate bin/cjpeg_transupp bin/mpeg2 bin/fmref bin/audiobeam bin/adpcm_dec
9 23
10bin/cjpeg_wrbmp: ./source/extra.h ./source/cjpeg_wrbmp/cjpeg_wrbmp.c ./source/cjpeg_wrbmp/input.c 24bin/cjpeg_wrbmp: ${COMMON} ./source/cjpeg_wrbmp/cjpeg_wrbmp.c ./source/cjpeg_wrbmp/input.c
11 $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) 25 $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
12bin/huff_enc: ./source/extra.h ./source/huff_enc/huff_enc.c 26bin/huff_enc: ${COMMON} ./source/huff_enc/huff_enc.c
13 $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) 27 $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
14bin/gsm_enc: ./source/extra.h ./source/gsm_enc/gsm_enc.c 28bin/gsm_enc: ${COMMON} ./source/gsm_enc/gsm_enc.c
15 $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) 29 $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
16bin/dijkstra: ./source/extra.h ./source/dijkstra/dijkstra.c ./source/dijkstra/input.c 30bin/dijkstra: ${COMMON} ./source/dijkstra/dijkstra.c ./source/dijkstra/input.c
17 $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) 31 $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
18bin/h264_dec: ./source/extra.h ./source/h264_dec/h264_dec.c ./source/h264_dec/h264_decinput.c 32bin/h264_dec: ${COMMON} ./source/h264_dec/h264_dec.c ./source/h264_dec/h264_decinput.c
19 $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) 33 $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
20bin/susan: ./source/extra.h ./source/susan/input.c ./source/susan/susan.c ./source/susan/wccfile.c ./source/susan/wcclibm.c ./source/susan/wccmalloc.c 34bin/susan: ${COMMON} ./source/susan/input.c ./source/susan/susan.c ./source/susan/wccfile.c ./source/susan/wcclibm.c ./source/susan/wccmalloc.c
21 $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) 35 $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
22bin/adpcm_enc: ./source/extra.h ./source/adpcm_enc/adpcm_enc.c 36bin/adpcm_enc: ${COMMON} ./source/adpcm_enc/adpcm_enc.c
23 $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) 37 $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
24bin/rijndael_dec: ./source/extra.h ./source/rijndael_dec/aes.c ./source/rijndael_dec/input_small_enc.c ./source/rijndael_dec/rijndael_dec.c ./source/rijndael_dec/rijndael_dec_libc.c 38bin/rijndael_dec: ${COMMON} ./source/rijndael_dec/aes.c ./source/rijndael_dec/input_small_enc.c ./source/rijndael_dec/rijndael_dec.c ./source/rijndael_dec/rijndael_dec_libc.c
25 $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) 39 $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
26bin/huff_dec: ./source/extra.h ./source/huff_dec/huff_dec.c 40bin/huff_dec: ${COMMON} ./source/huff_dec/huff_dec.c
27 $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) 41 $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
28bin/rijndael_enc: ./source/extra.h ./source/rijndael_enc/aes.c ./source/rijndael_enc/input_small.c ./source/rijndael_enc/rijndael_enc.c ./source/rijndael_enc/rijndael_enc_libc.c 42bin/rijndael_enc: ${COMMON} ./source/rijndael_enc/aes.c ./source/rijndael_enc/input_small.c ./source/rijndael_enc/rijndael_enc.c ./source/rijndael_enc/rijndael_enc_libc.c
29 $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) 43 $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
30bin/gsm_dec: ./source/extra.h ./source/gsm_dec/gsm_dec.c 44bin/gsm_dec: ${COMMON} ./source/gsm_dec/gsm_dec.c
31 $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) 45 $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
32bin/anagram: ./source/extra.h ./source/anagram/anagram.c ./source/anagram/anagram_input.c ./source/anagram/anagram_stdlib.c 46bin/anagram: ${COMMON} ./source/anagram/anagram.c ./source/anagram/anagram_input.c ./source/anagram/anagram_stdlib.c
33 $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) 47 $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
34bin/epic: ./source/extra.h ./source/epic/epic.c 48bin/epic: ${COMMON} ./source/epic/epic.c
35 $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) 49 $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
36bin/ammunition: ./source/extra.h ./source/ammunition/ammunition.c ./source/ammunition/ammunition_libc.c ./source/ammunition/arithm.c ./source/ammunition/bits.c 50bin/ammunition: ${COMMON} ./source/ammunition/ammunition.c ./source/ammunition/ammunition_libc.c ./source/ammunition/arithm.c ./source/ammunition/bits.c
37 $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) 51 $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
38bin/g723_enc: ./source/extra.h ./source/g723_enc/g723_enc.c 52bin/g723_enc: ${COMMON} ./source/g723_enc/g723_enc.c
39 $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) 53 $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
40bin/ndes: ./source/extra.h ./source/ndes/ndes.c 54bin/ndes: ${COMMON} ./source/ndes/ndes.c
41 $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) 55 $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
42bin/petrinet: ./source/extra.h ./source/petrinet/petrinet.c 56bin/petrinet: ${COMMON} ./source/petrinet/petrinet.c
43 $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) 57 $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
44bin/statemate: ./source/extra.h ./source/statemate/statemate.c 58bin/statemate: ${COMMON} ./source/statemate/statemate.c
45 $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) 59 $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
46bin/cjpeg_transupp: ./source/extra.h ./source/cjpeg_transupp/cjpeg_transupp.c 60bin/cjpeg_transupp: ${COMMON} ./source/cjpeg_transupp/cjpeg_transupp.c
47 $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) 61 $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
48bin/mpeg2: ./source/extra.h ./source/mpeg2/mpeg2.c 62bin/mpeg2: ${COMMON} ./source/mpeg2/mpeg2.c
49 $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) 63 $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
50bin/fmref: ./source/extra.h ./source/fmref/fmref.c ./source/fmref/wcclibm.c 64bin/fmref: ${COMMON} ./source/fmref/fmref.c ./source/fmref/wcclibm.c
51 $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) 65 $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
52bin/audiobeam: ./source/extra.h ./source/audiobeam/audiobeam.c ./source/audiobeam/audiobeaminput.c ./source/audiobeam/audiobeamlibmalloc.c ./source/audiobeam/audiobeamlibm.c 66bin/audiobeam: ${COMMON} ./source/audiobeam/audiobeam.c ./source/audiobeam/audiobeaminput.c ./source/audiobeam/audiobeamlibmalloc.c ./source/audiobeam/audiobeamlibm.c
53 $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) 67 $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
54bin/adpcm_dec: ./source/extra.h ./source/adpcm_dec/adpcm_dec.c 68bin/adpcm_dec: ${COMMON} ./source/adpcm_dec/adpcm_dec.c
55 $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) 69 $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
70
diff --git a/baseline/run_baseline.sh b/baseline/run_baseline.sh
index 7fdc2aa..f7a98fa 100755
--- a/baseline/run_baseline.sh
+++ b/baseline/run_baseline.sh
@@ -49,7 +49,12 @@ done < $tacleNames
49num_tests=$(wc -l < $tacleNames) 49num_tests=$(wc -l < $tacleNames)
50for (( i = 0; i < $num_tests ; i++ )) 50for (( i = 0; i < $num_tests ; i++ ))
51do 51do
52 chrt -r 97 taskset -c $core ./bin/${tacleProg[$i]} ${tacleProg[$i]} $maxJobs $core none none $runID 1 none 52 # Check if we're using LITMUS^RT or not
53 if grep -q "#define LITMUS 1" source/extra.h; then
54 ./bin/${tacleProg[$i]} ${tacleProg[$i]} $maxJobs $core $runID 1
55 else
56 chrt -r 97 taskset -c $core ./bin/${tacleProg[$i]} ${tacleProg[$i]} $maxJobs $core $runID 1
57 fi
53 echo COMPLETE: ${tacleProg[$i]} 58 echo COMPLETE: ${tacleProg[$i]}
54done 59done
55 60
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
260SET_UP 263SET_UP
261notice that STOP LOOP negates the ++ if outout=0 264notice that STOP LOOP negates the ++ if outout=0
262for (jobsComplete=-1; jobsComplete<maxJobs; jobsComplete++){ 265for (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}
270WRITE_TO_FILE 271WRITE_TO_FILE
271tacleReturn 272tacleReturn
diff --git a/dis/original/Makefile b/dis/original/Makefile
index 98634ac..7ff5e2a 100644..100755
--- a/dis/original/Makefile
+++ b/dis/original/Makefile
@@ -1,8 +1,20 @@
1LIBLITMUS ?= /media/speedy/litmus/liblitmus 1LIBLITMUS ?= /media/speedy/litmus/liblitmus
2CC ?= gcc 2CC ?= gcc
3CFLAGS = -pthread -O2 -I${LIBLITMUS}/include -I${LIBLITMUS}/arch/arm/include -I/playpen/jbakita/HRTSMT-RTSS19/FinalBenchmarkSetup/baseline/source 3CFLAGS = -pthread -O2 -g -I../../baseline/source
4LDFLAGS = -lrt -lm -L${LIBLITMUS} -llitmus 4LDFLAGS = -lrt -lm
5COMMON = /playpen/jbakita/HRTSMT-RTSS19/FinalBenchmarkSetup/baseline/source/extra.h /media/speedy/litmus/tools/mmdc/mmdc.c 5COMMON = ../../baseline/source/extra.h
6
7# Handle cases where we're also profiling with the MMDC on the i.MX6Q
8ifneq ($(shell grep "define MMDC 1" ../../baseline/source/extra.h),)
9»···COMMON += /media/speedy/litmus/tools/mmdc/mmdc.c
10endif
11
12# Include all the LITMUS^RT headers if we're using it
13ifneq ($(shell grep "define LITMUS 1" ../../baseline/source/extra.h),)
14 CFLAGS += -I${LIBLITMUS}/include -I${LIBLITMUS}/arch/arm/include
15 LDFLAGS += -L${LIBLITMUS} -llitmus
16endif
17
6 18
7all: field matrix neighborhood pointer transitive update 19all: field matrix neighborhood pointer transitive update
8 20