diff options
Diffstat (limited to 'baseline/source')
25 files changed, 23 insertions, 453 deletions
diff --git a/baseline/source/adpcm_dec/adpcm_dec.c b/baseline/source/adpcm_dec/adpcm_dec.c index 04a5746..368e98d 100644 --- a/baseline/source/adpcm_dec/adpcm_dec.c +++ b/baseline/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/baseline/source/adpcm_enc/adpcm_enc.c b/baseline/source/adpcm_enc/adpcm_enc.c index 464768f..777aaf5 100644 --- a/baseline/source/adpcm_enc/adpcm_enc.c +++ b/baseline/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/baseline/source/ammunition/ammunition.c b/baseline/source/ammunition/ammunition.c index 269f4c0..052520e 100644 --- a/baseline/source/ammunition/ammunition.c +++ b/baseline/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/baseline/source/anagram/anagram.c b/baseline/source/anagram/anagram.c index b458fd2..5c1f29a 100644 --- a/baseline/source/anagram/anagram.c +++ b/baseline/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/baseline/source/audiobeam/audiobeam.c b/baseline/source/audiobeam/audiobeam.c index 208de80..50ebfff 100644 --- a/baseline/source/audiobeam/audiobeam.c +++ b/baseline/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/baseline/source/cjpeg_transupp/cjpeg_transupp.c b/baseline/source/cjpeg_transupp/cjpeg_transupp.c index 3f48539..5ec7e5e 100644 --- a/baseline/source/cjpeg_transupp/cjpeg_transupp.c +++ b/baseline/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/baseline/source/cjpeg_wrbmp/cjpeg_wrbmp.c b/baseline/source/cjpeg_wrbmp/cjpeg_wrbmp.c index 278725c..3c8d7ec 100644 --- a/baseline/source/cjpeg_wrbmp/cjpeg_wrbmp.c +++ b/baseline/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/baseline/source/dijkstra/dijkstra.c b/baseline/source/dijkstra/dijkstra.c index 1b6a52f..333fd43 100644 --- a/baseline/source/dijkstra/dijkstra.c +++ b/baseline/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/baseline/source/epic/epic.c b/baseline/source/epic/epic.c index e258a4a..a1e344c 100644 --- a/baseline/source/epic/epic.c +++ b/baseline/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/baseline/source/extra.h b/baseline/source/extra.h deleted file mode 100644 index e8f3d18..0000000 --- a/baseline/source/extra.h +++ /dev/null | |||
@@ -1,350 +0,0 @@ | |||
1 | /** | ||
2 | * Copyright 2019 Sims Hill Osborne and Joshua Bakita | ||
3 | * | ||
4 | * This header provides facilities by which to separably run and time TACLeBench | ||
5 | **/ | ||
6 | #define _GNU_SOURCE | ||
7 | #include <time.h> | ||
8 | #include <sys/mman.h> | ||
9 | #include <stdlib.h> | ||
10 | #include <stdio.h> | ||
11 | #include <string.h> | ||
12 | #include <signal.h> | ||
13 | #include <limits.h> | ||
14 | #include <fcntl.h> | ||
15 | #include <stdint.h> | ||
16 | #include <sched.h> | ||
17 | |||
18 | // This is only visible if _GNU_SOURCE is defined, and that define does not | ||
19 | // come along to places where this file is included. Address this by manually | ||
20 | // forcing it into the global namespace. | ||
21 | extern int sched_getcpu(); | ||
22 | |||
23 | // These constants correspond to the imx6q-sabredb platform | ||
24 | #define LINE_SIZE 32 | ||
25 | #define L2_SIZE 16*2048*32 | ||
26 | |||
27 | #if __arm__ | ||
28 | #include <unistd.h> | ||
29 | #include <sys/syscall.h> | ||
30 | #endif | ||
31 | |||
32 | #define LITMUS 0 | ||
33 | #define MC2 0 | ||
34 | #define MMDC_PROF 0 | ||
35 | |||
36 | #if LITMUS | ||
37 | #include <litmus.h> | ||
38 | #endif | ||
39 | |||
40 | #if MMDC_PROF | ||
41 | #include "/media/speedy/litmus/tools/mmdc/mmdc.h" | ||
42 | #endif | ||
43 | |||
44 | #if LITMUS | ||
45 | #define SET_UP LOAD_PARAMS SETUP_LITMUS | ||
46 | #else | ||
47 | #define SET_UP LOAD_PARAMS | ||
48 | #endif | ||
49 | |||
50 | #if MMDC_PROF | ||
51 | #define LOAD_PARAMS LOAD_PARAMS_ITRL SETUP_MMDC | ||
52 | #else | ||
53 | #define LOAD_PARAMS LOAD_PARAMS_ITRL | ||
54 | #endif | ||
55 | |||
56 | // Store state globally so that the job can be outside main() | ||
57 | // Arrays use float as a comprimise between overflow and size | ||
58 | float *_rt_exec_time; | ||
59 | #if MMDC_PERF | ||
60 | float *_rt_mmdc_read; | ||
61 | float *_rt_mmdc_write; | ||
62 | #endif | ||
63 | long _rt_jobs_complete; | ||
64 | long _rt_max_jobs; | ||
65 | int _rt_core; | ||
66 | int _rt_will_output; | ||
67 | struct timespec _rt_start, _rt_end; | ||
68 | |||
69 | char *_rt_run_id; | ||
70 | char *_rt_our_prog_name; | ||
71 | #define _RT_FILENAME_LEN 64 | ||
72 | |||
73 | #define LOAD_PARAMS_ITRL \ | ||
74 | if (argc != 6) { \ | ||
75 | fprintf(stderr, "Usage: %s <name> <loops> <my core> <runID> <save results?>\n", argv[0]);\ | ||
76 | fprintf(stderr, " <loops> integer number of iterations. -1 for infitite.\n");\ | ||
77 | fprintf(stderr, " <save results?> 1 to save results, 0 to discard.\n");\ | ||
78 | fprintf(stderr, " <my core> UNUSED. Core is now auto-detected.\n");\ | ||
79 | exit(1);\ | ||
80 | }\ | ||
81 | _rt_our_prog_name = argv[1];\ | ||
82 | _rt_max_jobs = atol(argv[2]);\ | ||
83 | _rt_core = sched_getcpu();\ | ||
84 | _rt_run_id = argv[4];\ | ||
85 | _rt_will_output = atoi(argv[5]);\ | ||
86 | if (_rt_max_jobs < 0 && _rt_will_output != 0) {\ | ||
87 | fprintf(stderr, "Infinite loops only supported when _rt_will_output is disabled!\n");\ | ||
88 | exit(1);\ | ||
89 | }\ | ||
90 | if (strlen(_rt_run_id) + 5 > _RT_FILENAME_LEN) {\ | ||
91 | fprintf(stderr, "Run ID is too large! Keep it to less than %d characters.\n", _RT_FILENAME_LEN);\ | ||
92 | exit(1);\ | ||
93 | }\ | ||
94 | _rt_exec_time = calloc(_rt_max_jobs * _rt_will_output, sizeof(float));\ | ||
95 | if (!_rt_exec_time) {\ | ||
96 | perror("Unable to allocate buffer for execution times");\ | ||
97 | exit(1);\ | ||
98 | }\ | ||
99 | _rt_jobs_complete = 0;\ | ||
100 | mlockall(MCL_CURRENT || MCL_FUTURE); | ||
101 | |||
102 | #define SETUP_MMDC \ | ||
103 | _rt_mmdc_read = calloc(_rt_max_jobs * _rt_will_output, sizeof(float));\ | ||
104 | _rt_mmdc_write = calloc(_rt_max_jobs * _rt_will_output, sizeof(float));\ | ||
105 | if (!_rt_mmdc_read || !_rt_mmdc_write) {\ | ||
106 | perror("Unable to allocate buffer for MMDC data");\ | ||
107 | exit(1);\ | ||
108 | }\ | ||
109 | MMDC_PROFILE_RES_t mmdc_res;\ | ||
110 | memset(&mmdc_res, 0, sizeof(MMDC_PROFILE_RES_t));\ | ||
111 | int fd = open("/dev/mem", O_RDWR, 0);\ | ||
112 | if (fd < 0) {\ | ||
113 | perror("Unable to open /dev/mem");\ | ||
114 | exit(1);\ | ||
115 | }\ | ||
116 | pMMDC_t mmdc = mmap(NULL, 0x4000, PROT_READ | PROT_WRITE, MAP_SHARED, fd, MMDC_P0_IPS_BASE_ADDR);\ | ||
117 | if (mmdc == MAP_FAILED) {\ | ||
118 | perror("Unable to map MMDC address space");\ | ||
119 | exit(1);\ | ||
120 | }\ | ||
121 | mmdc->madpcr1 = axi_arm1;\ | ||
122 | msync(&(mmdc->madpcr1),4,MS_SYNC); | ||
123 | |||
124 | #define SETUP_LITMUS \ | ||
125 | unsigned int wait = 0; \ | ||
126 | if (be_migrate_to_domain(_rt_core) < 0) { \ | ||
127 | perror("Unable to migrate to specified CPU"); \ | ||
128 | exit(1); \ | ||
129 | } \ | ||
130 | struct reservation_config res; \ | ||
131 | res.id = gettid(); \ | ||
132 | res.cpu = cpu; \ | ||
133 | res.priority = LITMUS_HIGHEST_PRIORITY; \ | ||
134 | /* we take over half the CPU time (these are ns) */ \ | ||
135 | res.polling_params.budget = ms2ns(3000); \ | ||
136 | res.polling_params.period = ms2ns(3000); \ | ||
137 | res.polling_params.offset = 0; \ | ||
138 | res.polling_params.relative_deadline = ms2ns(3000); \ | ||
139 | /* Not 100% sure that we should use periodic polling */ \ | ||
140 | if (reservation_create(PERIODIC_POLLING, &res) < 0) { \ | ||
141 | perror("Unable to create reservation"); \ | ||
142 | exit(1); \ | ||
143 | } \ | ||
144 | struct rt_task rt_param; \ | ||
145 | init_rt_task_param(&rt_param); \ | ||
146 | /* Supposedly the next two parameters are irrelevant when reservations are enabled, but I'm leaving them anyway... */ \ | ||
147 | rt_param.exec_cost = ms2ns(999); \ | ||
148 | rt_param.period = ms2ns(1000); \ | ||
149 | rt_param.priority = LITMUS_HIGHEST_PRIORITY; \ | ||
150 | rt_param.cls = RT_CLASS_HARD; \ | ||
151 | rt_param.release_policy = TASK_PERIODIC; \ | ||
152 | rt_param.budget_policy = NO_ENFORCEMENT; \ | ||
153 | rt_param.cpu = cpu; \ | ||
154 | if (set_rt_task_param(gettid(), &rt_param) < 0) { \ | ||
155 | perror("Unable to set real-time parameters"); \ | ||
156 | exit(1); \ | ||
157 | } \ | ||
158 | if (init_litmus() != 0) { \ | ||
159 | perror("init_litmus failed"); \ | ||
160 | exit(1); \ | ||
161 | } \ | ||
162 | MC2_SETUP \ | ||
163 | if (task_mode(LITMUS_RT_TASK) != 0) { \ | ||
164 | perror("Unable to become real-time task"); \ | ||
165 | exit(1); \ | ||
166 | } \ | ||
167 | if (wait && wait_for_ts_release() != 0) { \ | ||
168 | perror("Unable to wait for taskset release"); \ | ||
169 | exit(1); \ | ||
170 | } | ||
171 | |||
172 | #if MC2 | ||
173 | #define MC2_SETUP \ | ||
174 | struct mc2_task mc2_param; \ | ||
175 | mc2_param.res_id = gettid(); \ | ||
176 | mc2_param.crit = CRIT_LEVEL_A; \ | ||
177 | if (set_mc2_task_param(gettid(), &mc2_param) < 0) { \ | ||
178 | perror("Unable to set MC^2 task params"); \ | ||
179 | exit(1); \ | ||
180 | } \ | ||
181 | set_page_color(rt_param.cpu); | ||
182 | #else | ||
183 | #define MC2_SETUP | ||
184 | #endif | ||
185 | |||
186 | #define CLEANUP_LITMUS \ | ||
187 | if (task_mode(BACKGROUND_TASK) != 0) { \ | ||
188 | perror("Unable to become a real-time task"); \ | ||
189 | exit(1); \ | ||
190 | } \ | ||
191 | reservation_destroy(gettid(), rt_param.cpu); | ||
192 | |||
193 | #if __arm__ | ||
194 | // On ARM, manually flush the cache | ||
195 | #define FLUSH_CACHES \ | ||
196 | volatile uint8_t buffer[L2_SIZE * 4]; \ | ||
197 | for (uint32_t j = 0; j < 4; j++) \ | ||
198 | for (uint32_t i = 0; i < L2_SIZE * 4; i += LINE_SIZE) \ | ||
199 | buffer[i]++; | ||
200 | #else | ||
201 | // On x86 call the wbinvld instruction (it's in a kernel module due to it being ring-0) | ||
202 | #define FLUSH_CACHES \ | ||
203 | FILE *fp = fopen("/proc/wbinvd", "r");\ | ||
204 | if (fp == NULL) {\ | ||
205 | perror("Cache flush module interface cannot be opened");\ | ||
206 | exit(1);\ | ||
207 | }\ | ||
208 | char dummy;\ | ||
209 | if (fread(&dummy, 1, 1, fp) == 0) {\ | ||
210 | perror("Unable to access cache flush module interface");\ | ||
211 | exit(1);\ | ||
212 | }\ | ||
213 | fclose(fp); | ||
214 | #endif | ||
215 | |||
216 | // Buffer timing result from a single job | ||
217 | static void _rt_save_job_result() { | ||
218 | if (_rt_jobs_complete >= _rt_max_jobs) { | ||
219 | fprintf(stderr, "Max jobs setting too small! Trying to record job #%ld when we only have space for %ld jobs. Exiting...\n", _rt_jobs_complete, _rt_max_jobs); | ||
220 | exit(1); | ||
221 | } | ||
222 | if (_rt_jobs_complete > -1 && _rt_will_output) { | ||
223 | _rt_exec_time[_rt_jobs_complete] = _rt_end.tv_sec - _rt_start.tv_sec; | ||
224 | _rt_exec_time[_rt_jobs_complete] *= 1e9; | ||
225 | _rt_exec_time[_rt_jobs_complete] += _rt_end.tv_nsec - _rt_start.tv_nsec; | ||
226 | #if MMDC_PROF | ||
227 | _rt_mmdc_read[_rt_jobs_complete] = mmdc_res.read_bytes; | ||
228 | _rt_mmdc_write[_rt_jobs_complete] = mmdc_res.write_bytes; | ||
229 | #endif | ||
230 | } | ||
231 | } | ||
232 | |||
233 | // Save all buffered timing results to disk | ||
234 | static void _rt_write_to_file() { | ||
235 | char fileName[_RT_FILENAME_LEN]; | ||
236 | FILE *fp; | ||
237 | if (!_rt_will_output) | ||
238 | return; | ||
239 | munlockall(); | ||
240 | strcpy(fileName, _rt_run_id); | ||
241 | strcat(fileName, ".txt"); | ||
242 | fp = fopen(fileName, "a"); | ||
243 | if (fp == NULL) { | ||
244 | perror("Unable to open _rt_will_output file"); | ||
245 | exit(1); | ||
246 | } | ||
247 | // Same format as the paired results with "none" for unused fields | ||
248 | for (int i = 0; i < _rt_jobs_complete; i++){ | ||
249 | fprintf(fp, "%s none %u none %ld %.f %s %d %.f %.f \n", | ||
250 | _rt_our_prog_name, _rt_core, _rt_max_jobs, | ||
251 | _rt_exec_time[i], _rt_run_id, i, | ||
252 | #if MMDC_PROF | ||
253 | _rt_mmdc_read[i], _rt_mmdc_write[i]); | ||
254 | #else | ||
255 | 0.0, 0.0); | ||
256 | #endif | ||
257 | } | ||
258 | fclose(fp); | ||
259 | #if LITMUS | ||
260 | CLEANUP_LITMUS | ||
261 | #endif | ||
262 | } | ||
263 | |||
264 | // Start a job | ||
265 | static void _rt_start_loop() { | ||
266 | #if LITMUS | ||
267 | if (sleep_next_period() != 0) { | ||
268 | perror("Unable to sleep for next period"); | ||
269 | } | ||
270 | #else | ||
271 | sched_yield(); | ||
272 | #endif | ||
273 | FLUSH_CACHES | ||
274 | #if MMDC_PROF | ||
275 | /* This disables profiling, resets the counters, clears the overflow bit, and enables profiling */ | ||
276 | start_mmdc_profiling(mmdc); | ||
277 | #endif | ||
278 | clock_gettime(CLOCK_MONOTONIC, &_rt_start); | ||
279 | } | ||
280 | |||
281 | // Complete a job | ||
282 | static void _rt_stop_loop() { | ||
283 | clock_gettime(CLOCK_MONOTONIC, &_rt_end); | ||
284 | #if MMDC_PROF | ||
285 | /* This freezes the profiling and makes results available */ | ||
286 | pause_mmdc_profiling(mmdc); | ||
287 | get_mmdc_profiling_results(mmdc, &mmdc_res); | ||
288 | #endif | ||
289 | _rt_save_job_result(); | ||
290 | _rt_jobs_complete++; | ||
291 | } | ||
292 | |||
293 | /****** New API ****** | ||
294 | * Intended structure: | ||
295 | * | ||
296 | * |int main(int argc, char **argv) { | ||
297 | * | SET_UP | ||
298 | * | ... | ||
299 | * | for_each_job { | ||
300 | * | tacleInit(); | ||
301 | * | tacleMain(); | ||
302 | * | } | ||
303 | * | WRITE_TO_FILE | ||
304 | * |} | ||
305 | * | ||
306 | * The main() function must call its parameters argc and argv for SET_UP to be | ||
307 | * able to read them. | ||
308 | * Only SET_UP necessarily has to be in main(). | ||
309 | * | ||
310 | * We use some niche C features, here's a quick explaination: | ||
311 | * 1. The && operator doesn't evaluate the right-hand side of the expression | ||
312 | * unless the left side evaluated to true. We use this to only execute | ||
313 | * _rt_start_loop() when the loop will actually run. | ||
314 | * 2. The comma operator executes the first expression and then throws away the | ||
315 | * result. We use this to call our void function from inside a comparison. | ||
316 | */ | ||
317 | #define for_each_job \ | ||
318 | for (; _rt_jobs_complete < _rt_max_jobs && (_rt_start_loop(),1); \ | ||
319 | _rt_stop_loop()) | ||
320 | |||
321 | /****** Legacy API ****** | ||
322 | * Intended structure: | ||
323 | * | ||
324 | * |int main(int argc, char **argv) { | ||
325 | * | SET_UP | ||
326 | * | for (jobsComplete=0; jobsComplete<maxJobs; jobsComplete++){ | ||
327 | * | START_LOOP | ||
328 | * | tacleInit(); | ||
329 | * | tacleMain(); | ||
330 | * | STOP_LOOP | ||
331 | * | } | ||
332 | * | WRITE_TO_FILE | ||
333 | * | tacleReturn | ||
334 | * |} | ||
335 | * | ||
336 | * The main() function must call its parameters argc and argv for SET_UP to be | ||
337 | * able to read them. | ||
338 | */ | ||
339 | static int jobsComplete = 0; | ||
340 | #define START_LOOP _rt_start_loop(); | ||
341 | #define STOP_LOOP _rt_stop_loop(); | ||
342 | #define WRITE_TO_FILE _rt_write_to_file(); | ||
343 | #define maxJobs _rt_max_jobs | ||
344 | // Has been part of STOP_LOOP for quite some time | ||
345 | #define SAVE_RESULTS \ | ||
346 | #warning "The SAVE_RESULTS macro is deprecated and will soon be removed!"; | ||
347 | // Unclear if SLEEP is used anywhere. | ||
348 | #define SLEEP \ | ||
349 | #warning "The SLEEP macro is deprecated and may be removed!" \ | ||
350 | nanosleep((const struct timespec[]){{0, 1000000}}, NULL); | ||
diff --git a/baseline/source/fmref/fmref.c b/baseline/source/fmref/fmref.c index bcc7ce6..e4c9aaa 100644 --- a/baseline/source/fmref/fmref.c +++ b/baseline/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/baseline/source/g723_enc/g723_enc.c b/baseline/source/g723_enc/g723_enc.c index 331c821..209e3ce 100644 --- a/baseline/source/g723_enc/g723_enc.c +++ b/baseline/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/baseline/source/gsm_dec/gsm_dec.c b/baseline/source/gsm_dec/gsm_dec.c index 06d24d5..ba9a9e9 100644 --- a/baseline/source/gsm_dec/gsm_dec.c +++ b/baseline/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/baseline/source/gsm_enc/gsm_enc.c b/baseline/source/gsm_enc/gsm_enc.c index 3f051ec..e8154bb 100644 --- a/baseline/source/gsm_enc/gsm_enc.c +++ b/baseline/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/baseline/source/h264_dec/h264_dec.c b/baseline/source/h264_dec/h264_dec.c index 1fed68b..e74bec9 100644 --- a/baseline/source/h264_dec/h264_dec.c +++ b/baseline/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/baseline/source/huff_dec/huff_dec.c b/baseline/source/huff_dec/huff_dec.c index b83b99d..58b40d3 100644 --- a/baseline/source/huff_dec/huff_dec.c +++ b/baseline/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/baseline/source/huff_enc/huff_enc.c b/baseline/source/huff_enc/huff_enc.c index 133fe95..0d74916 100644 --- a/baseline/source/huff_enc/huff_enc.c +++ b/baseline/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/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 | */ | ||
diff --git a/baseline/source/mpeg2/mpeg2.c b/baseline/source/mpeg2/mpeg2.c index a810744..0567225 100644 --- a/baseline/source/mpeg2/mpeg2.c +++ b/baseline/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/baseline/source/ndes/ndes.c b/baseline/source/ndes/ndes.c index b0f494c..f169c62 100644 --- a/baseline/source/ndes/ndes.c +++ b/baseline/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/baseline/source/petrinet/petrinet.c b/baseline/source/petrinet/petrinet.c index cabb40d..6ef3392 100644 --- a/baseline/source/petrinet/petrinet.c +++ b/baseline/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/baseline/source/rijndael_dec/rijndael_dec.c b/baseline/source/rijndael_dec/rijndael_dec.c index 93bb424..61db767 100644 --- a/baseline/source/rijndael_dec/rijndael_dec.c +++ b/baseline/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/baseline/source/rijndael_enc/rijndael_enc.c b/baseline/source/rijndael_enc/rijndael_enc.c index 0c10353..6c85eee 100644 --- a/baseline/source/rijndael_enc/rijndael_enc.c +++ b/baseline/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/baseline/source/statemate/statemate.c b/baseline/source/statemate/statemate.c index 00491e5..888d0fa 100644 --- a/baseline/source/statemate/statemate.c +++ b/baseline/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/baseline/source/susan/susan.c b/baseline/source/susan/susan.c index 4bc4cb8..dc27fb1 100644 --- a/baseline/source/susan/susan.c +++ b/baseline/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" |