diff options
Diffstat (limited to 'all_pairs')
27 files changed, 69 insertions, 270 deletions
diff --git a/all_pairs/Makefile b/all_pairs/Makefile index 36cf55a..0042372 100644 --- a/all_pairs/Makefile +++ b/all_pairs/Makefile | |||
@@ -1,57 +1,73 @@ | |||
1 | CC = gcc | 1 | LIBLITMUS ?= /media/speedy/litmus/liblitmus |
2 | CFLAGS = -pthread -O2 | 2 | CC ?= gcc |
3 | CFLAGS = -pthread -O2 -I.. -DPAIRED | ||
3 | LDFLAGS = -lrt | 4 | LDFLAGS = -lrt |
4 | all: 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 bin/cleanupSemaphores | 5 | COMMON = ../extra.h |
6 | |||
7 | # Handle cases where we're also profiling with the MMDC on the i.MX6Q | ||
8 | ifneq ($(shell grep "define MMDC 1" ../extra.h),) | ||
9 | COMMON += /media/speedy/litmus/tools/mmdc/mmdc.c | ||
10 | endif | ||
11 | |||
12 | # Include all the LITMUS^RT headers if we're using it | ||
13 | ifneq ($(shell grep "define LITMUS 1" ../extra.h),) | ||
14 | CFLAGS += -I${LIBLITMUS}/include -I${LIBLITMUS}/arch/arm/include | ||
15 | LDFLAGS += -L${LIBLITMUS} -llitmus | ||
16 | endif | ||
17 | |||
18 | all: 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 | ||
19 | |||
20 | debug: all | ||
21 | debug: CFLAGS += -ggdb3 | ||
5 | 22 | ||
6 | .PHONY: clean | 23 | .PHONY: clean |
7 | clean: | 24 | clean: |
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 bin/cleanupSemaphores | 25 | rm -f 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 | 26 | ||
10 | bin/cleanupSemaphores: ./source/extra.h ./source/cleanupSemaphores.c | 27 | bin/cjpeg_wrbmp: ${COMMON} ./source/cjpeg_wrbmp/cjpeg_wrbmp.c ./source/cjpeg_wrbmp/input.c |
11 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | ||
12 | bin/cjpeg_wrbmp: ./source/extra.h ./source/cjpeg_wrbmp/cjpeg_wrbmp.c ./source/cjpeg_wrbmp/input.c | ||
13 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 28 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
14 | bin/huff_enc: ./source/extra.h ./source/huff_enc/huff_enc.c | 29 | bin/huff_enc: ${COMMON} ./source/huff_enc/huff_enc.c |
15 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 30 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
16 | bin/gsm_enc: ./source/extra.h ./source/gsm_enc/gsm_enc.c | 31 | bin/gsm_enc: ${COMMON} ./source/gsm_enc/gsm_enc.c |
17 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 32 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
18 | bin/dijkstra: ./source/extra.h ./source/dijkstra/dijkstra.c ./source/dijkstra/input.c | 33 | bin/dijkstra: ${COMMON} ./source/dijkstra/dijkstra.c ./source/dijkstra/input.c |
19 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 34 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
20 | bin/h264_dec: ./source/extra.h ./source/h264_dec/h264_dec.c ./source/h264_dec/h264_decinput.c | 35 | bin/h264_dec: ${COMMON} ./source/h264_dec/h264_dec.c ./source/h264_dec/h264_decinput.c |
21 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 36 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
22 | bin/susan: ./source/extra.h ./source/susan/input.c ./source/susan/susan.c ./source/susan/wccfile.c ./source/susan/wcclibm.c ./source/susan/wccmalloc.c | 37 | bin/susan: ${COMMON} ./source/susan/input.c ./source/susan/susan.c ./source/susan/wccfile.c ./source/susan/wcclibm.c ./source/susan/wccmalloc.c |
23 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 38 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
24 | bin/adpcm_enc: ./source/extra.h ./source/adpcm_enc/adpcm_enc.c | 39 | bin/adpcm_enc: ${COMMON} ./source/adpcm_enc/adpcm_enc.c |
25 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 40 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
26 | bin/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 | 41 | bin/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 |
27 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 42 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
28 | bin/huff_dec: ./source/extra.h ./source/huff_dec/huff_dec.c | 43 | bin/huff_dec: ${COMMON} ./source/huff_dec/huff_dec.c |
29 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 44 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
30 | bin/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 | 45 | bin/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 |
31 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 46 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
32 | bin/gsm_dec: ./source/extra.h ./source/gsm_dec/gsm_dec.c | 47 | bin/gsm_dec: ${COMMON} ./source/gsm_dec/gsm_dec.c |
33 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 48 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
34 | bin/anagram: ./source/extra.h ./source/anagram/anagram.c ./source/anagram/anagram_input.c ./source/anagram/anagram_stdlib.c | 49 | bin/anagram: ${COMMON} ./source/anagram/anagram.c ./source/anagram/anagram_input.c ./source/anagram/anagram_stdlib.c |
35 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 50 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
36 | bin/epic: ./source/extra.h ./source/epic/epic.c | 51 | bin/epic: ${COMMON} ./source/epic/epic.c |
37 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 52 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
38 | bin/ammunition: ./source/extra.h ./source/ammunition/ammunition.c ./source/ammunition/ammunition_libc.c ./source/ammunition/arithm.c ./source/ammunition/bits.c | 53 | bin/ammunition: ${COMMON} ./source/ammunition/ammunition.c ./source/ammunition/ammunition_libc.c ./source/ammunition/arithm.c ./source/ammunition/bits.c |
39 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 54 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
40 | bin/g723_enc: ./source/extra.h ./source/g723_enc/g723_enc.c | 55 | bin/g723_enc: ${COMMON} ./source/g723_enc/g723_enc.c |
41 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 56 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
42 | bin/ndes: ./source/extra.h ./source/ndes/ndes.c | 57 | bin/ndes: ${COMMON} ./source/ndes/ndes.c |
43 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 58 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
44 | bin/petrinet: ./source/extra.h ./source/petrinet/petrinet.c | 59 | bin/petrinet: ${COMMON} ./source/petrinet/petrinet.c |
45 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 60 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
46 | bin/statemate: ./source/extra.h ./source/statemate/statemate.c | 61 | bin/statemate: ${COMMON} ./source/statemate/statemate.c |
47 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 62 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
48 | bin/cjpeg_transupp: ./source/extra.h ./source/cjpeg_transupp/cjpeg_transupp.c | 63 | bin/cjpeg_transupp: ${COMMON} ./source/cjpeg_transupp/cjpeg_transupp.c |
49 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 64 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
50 | bin/mpeg2: ./source/extra.h ./source/mpeg2/mpeg2.c | 65 | bin/mpeg2: ${COMMON} ./source/mpeg2/mpeg2.c |
51 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 66 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
52 | bin/fmref: ./source/extra.h ./source/fmref/fmref.c ./source/fmref/wcclibm.c | 67 | bin/fmref: ${COMMON} ./source/fmref/fmref.c ./source/fmref/wcclibm.c |
53 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 68 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
54 | bin/audiobeam: ./source/extra.h ./source/audiobeam/audiobeam.c ./source/audiobeam/audiobeaminput.c ./source/audiobeam/audiobeamlibmalloc.c ./source/audiobeam/audiobeamlibm.c | 69 | bin/audiobeam: ${COMMON} ./source/audiobeam/audiobeam.c ./source/audiobeam/audiobeaminput.c ./source/audiobeam/audiobeamlibmalloc.c ./source/audiobeam/audiobeamlibm.c |
55 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 70 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
56 | bin/adpcm_dec: ./source/extra.h ./source/adpcm_dec/adpcm_dec.c | 71 | bin/adpcm_dec: ${COMMON} ./source/adpcm_dec/adpcm_dec.c |
57 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) | 72 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) |
73 | |||
diff --git a/all_pairs/source/adpcm_dec/adpcm_dec.c b/all_pairs/source/adpcm_dec/adpcm_dec.c index 04a5746..368e98d 100644 --- a/all_pairs/source/adpcm_dec/adpcm_dec.c +++ b/all_pairs/source/adpcm_dec/adpcm_dec.c | |||
@@ -35,7 +35,7 @@ | |||
35 | Forward declaration of functions | 35 | Forward declaration of functions |
36 | */ | 36 | */ |
37 | 37 | ||
38 | #include "../extra.h" | 38 | #include "extra.h" |
39 | 39 | ||
40 | void adpcm_dec_decode( int ); | 40 | void adpcm_dec_decode( int ); |
41 | int adpcm_dec_filtez( int *bpl, int *dlt ); | 41 | int adpcm_dec_filtez( int *bpl, int *dlt ); |
diff --git a/all_pairs/source/adpcm_enc/adpcm_enc.c b/all_pairs/source/adpcm_enc/adpcm_enc.c index 464768f..777aaf5 100644 --- a/all_pairs/source/adpcm_enc/adpcm_enc.c +++ b/all_pairs/source/adpcm_enc/adpcm_enc.c | |||
@@ -29,7 +29,7 @@ | |||
29 | 29 | ||
30 | /* common sampling rate for sound cards on IBM/PC */ | 30 | /* common sampling rate for sound cards on IBM/PC */ |
31 | 31 | ||
32 | #include "../extra.h" | 32 | #include "extra.h" |
33 | #define SAMPLE_RATE 11025 | 33 | #define SAMPLE_RATE 11025 |
34 | 34 | ||
35 | #define PI 3141 | 35 | #define PI 3141 |
diff --git a/all_pairs/source/ammunition/ammunition.c b/all_pairs/source/ammunition/ammunition.c index 269f4c0..052520e 100644 --- a/all_pairs/source/ammunition/ammunition.c +++ b/all_pairs/source/ammunition/ammunition.c | |||
@@ -24,7 +24,7 @@ | |||
24 | 24 | ||
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include "../extra.h" | 27 | #include "extra.h" |
28 | #include "bits.h" | 28 | #include "bits.h" |
29 | #include "arithm.h" | 29 | #include "arithm.h" |
30 | #include "ammunition_stdlib.h" | 30 | #include "ammunition_stdlib.h" |
diff --git a/all_pairs/source/anagram/anagram.c b/all_pairs/source/anagram/anagram.c index b458fd2..5c1f29a 100644 --- a/all_pairs/source/anagram/anagram.c +++ b/all_pairs/source/anagram/anagram.c | |||
@@ -157,7 +157,7 @@ | |||
157 | steps to FindAnagram. | 157 | steps to FindAnagram. |
158 | */ | 158 | */ |
159 | 159 | ||
160 | #include "../extra.h" | 160 | #include "extra.h" |
161 | #include "anagram_ctype.h" | 161 | #include "anagram_ctype.h" |
162 | #include "anagram_stdlib.h" | 162 | #include "anagram_stdlib.h" |
163 | #include "anagram_strings.h" | 163 | #include "anagram_strings.h" |
diff --git a/all_pairs/source/audiobeam/audiobeam.c b/all_pairs/source/audiobeam/audiobeam.c index 208de80..50ebfff 100644 --- a/all_pairs/source/audiobeam/audiobeam.c +++ b/all_pairs/source/audiobeam/audiobeam.c | |||
@@ -23,7 +23,7 @@ | |||
23 | Include section | 23 | Include section |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include "../extra.h" | 26 | #include "extra.h" |
27 | #include "audiobeamlibm.h" | 27 | #include "audiobeamlibm.h" |
28 | #include "audiobeamlibmalloc.h" | 28 | #include "audiobeamlibmalloc.h" |
29 | #include "audiobeam.h" | 29 | #include "audiobeam.h" |
diff --git a/all_pairs/source/cjpeg_transupp/cjpeg_transupp.c b/all_pairs/source/cjpeg_transupp/cjpeg_transupp.c index 3f48539..5ec7e5e 100644 --- a/all_pairs/source/cjpeg_transupp/cjpeg_transupp.c +++ b/all_pairs/source/cjpeg_transupp/cjpeg_transupp.c | |||
@@ -29,7 +29,7 @@ | |||
29 | Include section | 29 | Include section |
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include "../extra.h" | 32 | #include "extra.h" |
33 | #include "jpeglib.h" | 33 | #include "jpeglib.h" |
34 | 34 | ||
35 | 35 | ||
diff --git a/all_pairs/source/cjpeg_wrbmp/cjpeg_wrbmp.c b/all_pairs/source/cjpeg_wrbmp/cjpeg_wrbmp.c index 278725c..3c8d7ec 100644 --- a/all_pairs/source/cjpeg_wrbmp/cjpeg_wrbmp.c +++ b/all_pairs/source/cjpeg_wrbmp/cjpeg_wrbmp.c | |||
@@ -24,7 +24,7 @@ | |||
24 | 24 | ||
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include "../extra.h" | 27 | #include "extra.h" |
28 | #include "cdjpeg.h" | 28 | #include "cdjpeg.h" |
29 | 29 | ||
30 | #ifdef CJPEG_WRBMP_BMP_SUPPORTED | 30 | #ifdef CJPEG_WRBMP_BMP_SUPPORTED |
diff --git a/all_pairs/source/cleanupSemaphores.c b/all_pairs/source/cleanupSemaphores.c deleted file mode 100644 index dde2bb3..0000000 --- a/all_pairs/source/cleanupSemaphores.c +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | #include <semaphore.h> | ||
2 | |||
3 | int main(){ | ||
4 | sem_unlink("/firstTacleSem"); | ||
5 | sem_unlink("/secondTacleSem"); | ||
6 | } | ||
diff --git a/all_pairs/source/dijkstra/dijkstra.c b/all_pairs/source/dijkstra/dijkstra.c index 1b6a52f..333fd43 100644 --- a/all_pairs/source/dijkstra/dijkstra.c +++ b/all_pairs/source/dijkstra/dijkstra.c | |||
@@ -17,7 +17,7 @@ | |||
17 | 17 | ||
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include "../extra.h" | 20 | #include "extra.h" |
21 | #include "input.h" | 21 | #include "input.h" |
22 | 22 | ||
23 | /* | 23 | /* |
diff --git a/all_pairs/source/empty.c b/all_pairs/source/empty.c index c7c5f5d..6681ba7 100644 --- a/all_pairs/source/empty.c +++ b/all_pairs/source/empty.c | |||
@@ -1,4 +1,4 @@ | |||
1 | #include "../extra.h" | 1 | #include "extra.h" |
2 | 2 | ||
3 | int main(int argc, char **argv) | 3 | int main(int argc, char **argv) |
4 | { | 4 | { |
diff --git a/all_pairs/source/epic/epic.c b/all_pairs/source/epic/epic.c index e258a4a..a1e344c 100644 --- a/all_pairs/source/epic/epic.c +++ b/all_pairs/source/epic/epic.c | |||
@@ -35,7 +35,7 @@ | |||
35 | */ | 35 | */ |
36 | 36 | ||
37 | 37 | ||
38 | #include "../extra.h" | 38 | #include "extra.h" |
39 | #include "epic.h" | 39 | #include "epic.h" |
40 | 40 | ||
41 | #define X_SIZE 64 | 41 | #define X_SIZE 64 |
diff --git a/all_pairs/source/extra.h b/all_pairs/source/extra.h deleted file mode 100644 index 0681250..0000000 --- a/all_pairs/source/extra.h +++ /dev/null | |||
@@ -1,211 +0,0 @@ | |||
1 | /** | ||
2 | * Copyright 2019 Sims Hill Osborne and Joshua Bakita | ||
3 | * | ||
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
5 | * of this software and associated documentation files (the "Software"), to deal | ||
6 | * in the Software without restriction, including without limitation the rights | ||
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
8 | * copies of the Software, and to permit persons to whom the Software is | ||
9 | * furnished to do so, subject to the following conditions: | ||
10 | * | ||
11 | * The above copyright notice and this permission notice shall be included in | ||
12 | * all copies or substantial portions of the Software. | ||
13 | * | ||
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
20 | * SOFTWARE. | ||
21 | **/ | ||
22 | #define _GNU_SOURCE | ||
23 | #include <fcntl.h> | ||
24 | #include <limits.h> | ||
25 | #include <semaphore.h> | ||
26 | #include <signal.h> | ||
27 | #include <stdlib.h> | ||
28 | #include <stdio.h> | ||
29 | #include <string.h> | ||
30 | #include <sys/mman.h> | ||
31 | #include <sys/stat.h> | ||
32 | #include <time.h> | ||
33 | #include <unistd.h> | ||
34 | #include <sched.h> | ||
35 | |||
36 | // This is only visible if _GNU_SOURCE is defined, and that define does not | ||
37 | // come along to places where this file is included. Address this by manually | ||
38 | // forcing it into the global namespace. | ||
39 | extern int sched_getcpu(); | ||
40 | |||
41 | // Benchmarks use SET_UP, START_LOOP, STOP_LOOP, and WRITE_TO_FILE | ||
42 | // These are macros so that we can declare and maintain additional state inside | ||
43 | // the benchmark. | ||
44 | #define SET_UP if (argc != 8) {\ | ||
45 | printf("Usage: %s <name> <runs> <my core> <other core> <other program> <runID> <lockID>", argv[0]);\ | ||
46 | exit(1);\ | ||
47 | }\ | ||
48 | char * thisProgram = argv[1];\ | ||
49 | int maxJobs = atoi(argv[2]);\ | ||
50 | unsigned int thisCore = atoi(argv[3]);\ | ||
51 | unsigned int otherCore = atoi(argv[4]);\ | ||
52 | thisCore = sched_getcpu();\ | ||
53 | char * otherProgram = argv[5];\ | ||
54 | char * runID = argv[6];\ | ||
55 | int lockID = atoi(argv[7]);\ | ||
56 | struct timespec _start, _end;\ | ||
57 | int jobsComplete;\ | ||
58 | int jobs_complete = -1;\ | ||
59 | long * startS = malloc(sizeof(long) *maxJobs);\ | ||
60 | long * startN = malloc(sizeof(long) *maxJobs);\ | ||
61 | long * endS = malloc(sizeof(long) *maxJobs);\ | ||
62 | long * endN = malloc(sizeof(long) *maxJobs);\ | ||
63 | char * bigArray;\ | ||
64 | char fileName[strlen(runID) + 5];\ | ||
65 | strcpy(fileName, runID);\ | ||
66 | strcat(fileName, ".txt");\ | ||
67 | mlockall(MCL_CURRENT || MCL_FUTURE);\ | ||
68 | sem_t *firstSem=sem_open("/firstTacleSem", O_CREAT, 644, 0);\ | ||
69 | if (firstSem == SEM_FAILED) {\ | ||
70 | perror("Error opening/creating first semaphore");\ | ||
71 | exit(1);\ | ||
72 | }\ | ||
73 | sem_t *secondSem=sem_open("/secondTacleSem", O_CREAT, 644, 0);\ | ||
74 | if (secondSem == SEM_FAILED) {\ | ||
75 | perror("Error opening/creating second semaphore");\ | ||
76 | exit(1);\ | ||
77 | }\ | ||
78 | int barrier_file = shm_open("/TacleBarrier", O_CREAT | O_RDWR, 644);\ | ||
79 | if (barrier_file == -1) {\ | ||
80 | perror("Error creating shared memory");\ | ||
81 | exit(1);\ | ||
82 | }\ | ||
83 | /* This sets our shared file to be one byte of '\0'*/ \ | ||
84 | if (ftruncate(barrier_file, 1) == -1) {\ | ||
85 | perror("Error setting size of shared memory");\ | ||
86 | exit(1);\ | ||
87 | }\ | ||
88 | char * barrier = mmap(NULL, 1, PROT_WRITE, MAP_SHARED, barrier_file, 0);\ | ||
89 | if (barrier == MAP_FAILED) {\ | ||
90 | perror("Error mapping shared memory");\ | ||
91 | exit(1);\ | ||
92 | }\ | ||
93 | int val; | ||
94 | |||
95 | #define SAVE_RESULTS \ | ||
96 | if(jobs_complete >= maxJobs) {\ | ||
97 | fprintf(stderr, "Max jobs setting too small! Trying to record job #%d when we only have space for %d jobs. Exiting...\n", jobs_complete, maxJobs);\ | ||
98 | exit(1);\ | ||
99 | }\ | ||
100 | if (jobs_complete > -1){\ | ||
101 | startS[jobs_complete]=_start.tv_sec;\ | ||
102 | startN[jobs_complete]=_start.tv_nsec;\ | ||
103 | endS[jobs_complete]=_end.tv_sec;\ | ||
104 | endN[jobs_complete]=_end.tv_nsec;\ | ||
105 | } | ||
106 | |||
107 | #define WRITE_TO_FILE {\ | ||
108 | munlockall();\ | ||
109 | FILE *fp = fopen(fileName, "a");\ | ||
110 | if (fp == NULL) {\ | ||
111 | perror("Error opening file. \n");\ | ||
112 | exit(1);\ | ||
113 | }\ | ||
114 | for(int i = 0; i <= jobs_complete; i++){\ | ||
115 | fprintf(fp, "%s %s %u %u %d %ld %ld %ld %ld %s %d \n",\ | ||
116 | thisProgram, otherProgram, thisCore, otherCore, maxJobs,\ | ||
117 | startS[i], startN[i], endS[i], endN[i],\ | ||
118 | runID, i);\ | ||
119 | }\ | ||
120 | fclose(fp);\ | ||
121 | /* Clean up the barrier synchronization shared memory */\ | ||
122 | munmap(barrier, 1);\ | ||
123 | shm_unlink("/TacleBarrier");\ | ||
124 | free(startS);\ | ||
125 | free(startN);\ | ||
126 | free(endS);\ | ||
127 | free(endN);\ | ||
128 | } | ||
129 | |||
130 | // Call the wbinvld instruction (it's in a kernel module due to it being ring-0) | ||
131 | #define FLUSH_CACHES FILE *fp = fopen("/proc/wbinvd", "r");\ | ||
132 | if (fp == NULL) {\ | ||
133 | perror("Cache flush module interface cannot be opened");\ | ||
134 | exit(1);\ | ||
135 | }\ | ||
136 | char dummy;\ | ||
137 | if (fread(&dummy, 1, 1, fp) == 0) {\ | ||
138 | perror("Unable to access cache flush module interface");\ | ||
139 | exit(1);\ | ||
140 | }\ | ||
141 | fclose(fp); | ||
142 | |||
143 | // These timers should just be aliases to the hardware counters w/ some small adjustments | ||
144 | #define START_TIMER clock_gettime(CLOCK_MONOTONIC, &_start); | ||
145 | #define STOP_TIMER clock_gettime(CLOCK_MONOTONIC, &_end); | ||
146 | |||
147 | //check value of sem | ||
148 | //if sem=0, unlock | ||
149 | //if sem=1, spin | ||
150 | |||
151 | #define SLEEP nanosleep((const struct timespec[]){{0, 1000000}}, NULL); | ||
152 | |||
153 | #define FIRST_UNLOCK if (lockID == 1) {\ | ||
154 | if (sem_post(secondSem) != 0) {\ | ||
155 | perror("Unable to unlock second semaphore");\ | ||
156 | exit(1);\ | ||
157 | }\ | ||
158 | } \ | ||
159 | else {\ | ||
160 | if (sem_post(firstSem) != 0) {\ | ||
161 | perror("Unable to unlock first semaphore");\ | ||
162 | exit(1);\ | ||
163 | }\ | ||
164 | } \ | ||
165 | |||
166 | #define FIRST_LOCK if (lockID == 1) {\ | ||
167 | if (sem_wait(firstSem) != 0) {\ | ||
168 | perror("Unable to wait on first semaphore");\ | ||
169 | exit(1);\ | ||
170 | }\ | ||
171 | }\ | ||
172 | else {\ | ||
173 | if (sem_wait(secondSem) != 0) {\ | ||
174 | perror("Unable to wait on second semaphore");\ | ||
175 | exit(1);\ | ||
176 | }\ | ||
177 | } | ||
178 | |||
179 | |||
180 | #define SECOND_UNLOCK if (lockID==1){sem_post(fourthSem) ; }\ | ||
181 | else {sem_post(thirdSem) ; } | ||
182 | |||
183 | #define SECOND_LOCK if (lockID==1){sem_wait(thirdSem); }\ | ||
184 | else {sem_wait(fourthSem); } | ||
185 | |||
186 | #define BARRIER_SYNC if (__sync_bool_compare_and_swap(barrier, 0, 1)) {\ | ||
187 | while (!__sync_bool_compare_and_swap(barrier, 0, 0)) {};\ | ||
188 | }\ | ||
189 | else {\ | ||
190 | __sync_bool_compare_and_swap(barrier, 1, 0);\ | ||
191 | } | ||
192 | |||
193 | #define START_LOOP FIRST_UNLOCK FIRST_LOCK sched_yield(); FLUSH_CACHES BARRIER_SYNC START_TIMER | ||
194 | #define STOP_LOOP STOP_TIMER jobs_complete++; SAVE_RESULTS | ||
195 | |||
196 | |||
197 | /* | ||
198 | Intended structure | ||
199 | |||
200 | main | ||
201 | SET_UP | ||
202 | notice that STOP LOOP negates the ++ if outout=0 | ||
203 | for (jobsComplete=0; jobsComplete<maxJobs; jobsComplete++){ | ||
204 | START_LOOP | ||
205 | tacleInit(); | ||
206 | tacleMain(); | ||
207 | STOP_LOOP | ||
208 | } | ||
209 | WRITE_TO_FILE | ||
210 | tacleReturn | ||
211 | */ | ||
diff --git a/all_pairs/source/fmref/fmref.c b/all_pairs/source/fmref/fmref.c index bcc7ce6..e4c9aaa 100644 --- a/all_pairs/source/fmref/fmref.c +++ b/all_pairs/source/fmref/fmref.c | |||
@@ -5,7 +5,7 @@ | |||
5 | */ | 5 | */ |
6 | 6 | ||
7 | 7 | ||
8 | #include "../extra.h" | 8 | #include "extra.h" |
9 | #include "wcclibm.h" | 9 | #include "wcclibm.h" |
10 | #ifndef M_PI | 10 | #ifndef M_PI |
11 | #define M_PI 3.1415926535897932384626433832795 | 11 | #define M_PI 3.1415926535897932384626433832795 |
diff --git a/all_pairs/source/g723_enc/g723_enc.c b/all_pairs/source/g723_enc/g723_enc.c index 331c821..209e3ce 100644 --- a/all_pairs/source/g723_enc/g723_enc.c +++ b/all_pairs/source/g723_enc/g723_enc.c | |||
@@ -31,7 +31,7 @@ | |||
31 | included in this Recommendation. | 31 | included in this Recommendation. |
32 | */ | 32 | */ |
33 | 33 | ||
34 | #include "../extra.h" | 34 | #include "extra.h" |
35 | struct g723_enc_state_t { | 35 | struct g723_enc_state_t { |
36 | long yl; /* Locked or steady state step size multiplier. */ | 36 | long yl; /* Locked or steady state step size multiplier. */ |
37 | short yu; /* Unlocked or non-steady state step size multiplier. */ | 37 | short yu; /* Unlocked or non-steady state step size multiplier. */ |
diff --git a/all_pairs/source/gsm_dec/gsm_dec.c b/all_pairs/source/gsm_dec/gsm_dec.c index 06d24d5..ba9a9e9 100644 --- a/all_pairs/source/gsm_dec/gsm_dec.c +++ b/all_pairs/source/gsm_dec/gsm_dec.c | |||
@@ -21,7 +21,7 @@ | |||
21 | */ | 21 | */ |
22 | 22 | ||
23 | 23 | ||
24 | #include "../extra.h" | 24 | #include "extra.h" |
25 | #include "gsm.h" | 25 | #include "gsm.h" |
26 | #include "add.h" | 26 | #include "add.h" |
27 | #include "data.h" | 27 | #include "data.h" |
diff --git a/all_pairs/source/gsm_enc/gsm_enc.c b/all_pairs/source/gsm_enc/gsm_enc.c index 3f051ec..e8154bb 100644 --- a/all_pairs/source/gsm_enc/gsm_enc.c +++ b/all_pairs/source/gsm_enc/gsm_enc.c | |||
@@ -5,7 +5,7 @@ | |||
5 | * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. | 5 | * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include "../extra.h" | 8 | #include "extra.h" |
9 | #include "private.h" | 9 | #include "private.h" |
10 | 10 | ||
11 | /* | 11 | /* |
diff --git a/all_pairs/source/h264_dec/h264_dec.c b/all_pairs/source/h264_dec/h264_dec.c index 1fed68b..e74bec9 100644 --- a/all_pairs/source/h264_dec/h264_dec.c +++ b/all_pairs/source/h264_dec/h264_dec.c | |||
@@ -25,7 +25,7 @@ | |||
25 | Include section | 25 | Include section |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include "../extra.h" | 28 | #include "extra.h" |
29 | #include "h264_dec.h" | 29 | #include "h264_dec.h" |
30 | 30 | ||
31 | 31 | ||
diff --git a/all_pairs/source/huff_dec/huff_dec.c b/all_pairs/source/huff_dec/huff_dec.c index b83b99d..58b40d3 100644 --- a/all_pairs/source/huff_dec/huff_dec.c +++ b/all_pairs/source/huff_dec/huff_dec.c | |||
@@ -49,7 +49,7 @@ new schemes (this item is not a must) | |||
49 | */ | 49 | */ |
50 | 50 | ||
51 | 51 | ||
52 | #include "../extra.h" | 52 | #include "extra.h" |
53 | typedef struct s_tree { | 53 | typedef struct s_tree { |
54 | unsigned int byte; /* A byte has to be coded as an unsigned integer to | 54 | unsigned int byte; /* A byte has to be coded as an unsigned integer to |
55 | allow a node to have a value over 255 */ | 55 | allow a node to have a value over 255 */ |
diff --git a/all_pairs/source/huff_enc/huff_enc.c b/all_pairs/source/huff_enc/huff_enc.c index 133fe95..0d74916 100644 --- a/all_pairs/source/huff_enc/huff_enc.c +++ b/all_pairs/source/huff_enc/huff_enc.c | |||
@@ -50,7 +50,7 @@ new schemes (this item is not a must) | |||
50 | */ | 50 | */ |
51 | 51 | ||
52 | 52 | ||
53 | #include "../extra.h" | 53 | #include "extra.h" |
54 | typedef struct huff_enc_s_tree { | 54 | typedef struct huff_enc_s_tree { |
55 | unsigned int byte; /* A byte has to be coded as an unsigned integer to | 55 | unsigned int byte; /* A byte has to be coded as an unsigned integer to |
56 | allow a node to have a value over 255 */ | 56 | allow a node to have a value over 255 */ |
diff --git a/all_pairs/source/mpeg2/mpeg2.c b/all_pairs/source/mpeg2/mpeg2.c index a810744..0567225 100644 --- a/all_pairs/source/mpeg2/mpeg2.c +++ b/all_pairs/source/mpeg2/mpeg2.c | |||
@@ -48,7 +48,7 @@ | |||
48 | /* | 48 | /* |
49 | Forward declaration of data types | 49 | Forward declaration of data types |
50 | */ | 50 | */ |
51 | #include "../extra.h" | 51 | #include "extra.h" |
52 | struct mbinfo; | 52 | struct mbinfo; |
53 | 53 | ||
54 | 54 | ||
diff --git a/all_pairs/source/ndes/ndes.c b/all_pairs/source/ndes/ndes.c index b0f494c..f169c62 100644 --- a/all_pairs/source/ndes/ndes.c +++ b/all_pairs/source/ndes/ndes.c | |||
@@ -17,7 +17,7 @@ | |||
17 | */ | 17 | */ |
18 | 18 | ||
19 | /* A read from this address will result in an known value of 1 */ | 19 | /* A read from this address will result in an known value of 1 */ |
20 | #include "../extra.h" | 20 | #include "extra.h" |
21 | #define KNOWN_VALUE 1 | 21 | #define KNOWN_VALUE 1 |
22 | #define NDES_WORSTCASE 1 | 22 | #define NDES_WORSTCASE 1 |
23 | /* | 23 | /* |
diff --git a/all_pairs/source/petrinet/petrinet.c b/all_pairs/source/petrinet/petrinet.c index cabb40d..6ef3392 100644 --- a/all_pairs/source/petrinet/petrinet.c +++ b/all_pairs/source/petrinet/petrinet.c | |||
@@ -25,7 +25,7 @@ | |||
25 | */ | 25 | */ |
26 | 26 | ||
27 | 27 | ||
28 | #include "../extra.h" | 28 | #include "extra.h" |
29 | 29 | ||
30 | #ifdef PROFILING | 30 | #ifdef PROFILING |
31 | #include <stdio.h> | 31 | #include <stdio.h> |
diff --git a/all_pairs/source/rijndael_dec/rijndael_dec.c b/all_pairs/source/rijndael_dec/rijndael_dec.c index 93bb424..61db767 100644 --- a/all_pairs/source/rijndael_dec/rijndael_dec.c +++ b/all_pairs/source/rijndael_dec/rijndael_dec.c | |||
@@ -38,7 +38,7 @@ | |||
38 | ----------------------------------------------------------------------- | 38 | ----------------------------------------------------------------------- |
39 | */ | 39 | */ |
40 | 40 | ||
41 | #include "../extra.h" | 41 | #include "extra.h" |
42 | #include "aes.h" | 42 | #include "aes.h" |
43 | #include "rijndael_dec_libc.h" | 43 | #include "rijndael_dec_libc.h" |
44 | 44 | ||
diff --git a/all_pairs/source/rijndael_enc/rijndael_enc.c b/all_pairs/source/rijndael_enc/rijndael_enc.c index 0c10353..6c85eee 100644 --- a/all_pairs/source/rijndael_enc/rijndael_enc.c +++ b/all_pairs/source/rijndael_enc/rijndael_enc.c | |||
@@ -38,7 +38,7 @@ | |||
38 | ----------------------------------------------------------------------- | 38 | ----------------------------------------------------------------------- |
39 | */ | 39 | */ |
40 | 40 | ||
41 | #include "../extra.h" | 41 | #include "extra.h" |
42 | #include "aes.h" | 42 | #include "aes.h" |
43 | #include "rijndael_enc_libc.h" | 43 | #include "rijndael_enc_libc.h" |
44 | 44 | ||
diff --git a/all_pairs/source/statemate/statemate.c b/all_pairs/source/statemate/statemate.c index 00491e5..888d0fa 100644 --- a/all_pairs/source/statemate/statemate.c +++ b/all_pairs/source/statemate/statemate.c | |||
@@ -27,7 +27,7 @@ | |||
27 | Macro definitions | 27 | Macro definitions |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "../extra.h" | 30 | #include "extra.h" |
31 | 31 | ||
32 | #define SYS_bit_get(a,b) (a)[(b)] | 32 | #define SYS_bit_get(a,b) (a)[(b)] |
33 | #define SYS_bit_clr(a,b) (a)[(b)] = 0 | 33 | #define SYS_bit_clr(a,b) (a)[(b)] = 0 |
diff --git a/all_pairs/source/susan/susan.c b/all_pairs/source/susan/susan.c index 4bc4cb8..dc27fb1 100644 --- a/all_pairs/source/susan/susan.c +++ b/all_pairs/source/susan/susan.c | |||
@@ -269,7 +269,7 @@ | |||
269 | 269 | ||
270 | \**********************************************************************/ | 270 | \**********************************************************************/ |
271 | 271 | ||
272 | #include "../extra.h" | 272 | #include "extra.h" |
273 | #include "wcclibm.h" | 273 | #include "wcclibm.h" |
274 | #include "wccfile.h" | 274 | #include "wccfile.h" |
275 | #include "wccmalloc.h" | 275 | #include "wccmalloc.h" |