summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorleochanj105 <leochanj@live.unc.edu>2020-10-23 18:03:24 -0400
committerleochanj105 <leochanj@live.unc.edu>2020-10-23 18:03:24 -0400
commit011e22414a2f51a27bfa621804d810c435d135b5 (patch)
tree7a54974b62d6e58511a85e0f4b8b16e919efa353
parent87997c91b55c9e84097a7c79c63d583044ff4c63 (diff)
parent3498e3270194093098f9b8275901517fa2f9fa32 (diff)
wip
-rw-r--r--.gitignore4
-rw-r--r--SD-VBS/common/c/extra.h508
-rw-r--r--SD-VBS/common/makefiles/Makefile.common12
-rw-r--r--extra.h3
-rwxr-xr-xrun_bench.sh4
-rw-r--r--run_case_study.py3
6 files changed, 16 insertions, 518 deletions
diff --git a/.gitignore b/.gitignore
index 0e0db96..b7e90f4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -26,15 +26,19 @@
26**/adpcm_dec 26**/adpcm_dec
27**/adpcm_enc 27**/adpcm_enc
28**/ammunition 28**/ammunition
29**/anagram
30**/audiobeam
29**/cjpeg_transupp 31**/cjpeg_transupp
30**/cjpeg_wrbmp 32**/cjpeg_wrbmp
31**/dijkstra 33**/dijkstra
32**/epic 34**/epic
33**/fmref 35**/fmref
36**/g723_enc
34**/gsm_dec 37**/gsm_dec
35**/gsm_enc 38**/gsm_enc
36**/h264_dec 39**/h264_dec
37**/huff_enc 40**/huff_enc
41**/huff_dec
38**/mpeg2 42**/mpeg2
39**/ndes 43**/ndes
40**/petrinet 44**/petrinet
diff --git a/SD-VBS/common/c/extra.h b/SD-VBS/common/c/extra.h
deleted file mode 100644
index 9c72064..0000000
--- a/SD-VBS/common/c/extra.h
+++ /dev/null
@@ -1,508 +0,0 @@
1/**
2 * Copyright 2019 Sims Hill Osborne and 2020 Joshua Bakita
3 *
4 * This header provides facilities by which to separably run and time TACLeBench
5 * To use this for paired task timing, define PAIRED (pass CFLAGS=-DPAIRED to make)
6 **/
7#define _GNU_SOURCE
8#include <fcntl.h> // For O_CREAT and O_RDWR
9#include <sched.h> // For sched_yield()
10#include <semaphore.h> // For sem_{open, post, wait}()
11#include <stdio.h>
12#include <stdlib.h> // For exit()
13#include <string.h> // For strlen()
14#include <sys/mman.h> // For mlockall()
15#include <unistd.h> // For ftruncate()
16#include <time.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.
21extern 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// This is a proxy for "case study mode" now
33#define LITMUS 1
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// Store state globally so that the job can be outside main()
45// Arrays use float as a comprimise between overflow and size
46// Paired arrays use long longs as precision is more important for those times
47#ifdef PAIRED
48long long *_rt_start_time;
49long long *_rt_end_time;
50#else
51float *_rt_exec_time;
52#endif
53#if MMDC_PERF
54float *_rt_mmdc_read;
55float *_rt_mmdc_write;
56#endif
57long _rt_jobs_complete;
58long _rt_max_jobs;
59int _rt_core;
60int _rt_will_output;
61struct timespec _rt_start, _rt_end;
62
63char *_rt_run_id;
64char *_rt_our_prog_name;
65char *_rt_other_prog_name;
66char *_rt_other_core;
67#define _RT_FILENAME_LEN 64
68#define _BILLION (1000*1000*1000)
69#ifdef PAIRED
70char *_rt_barrier;
71sem_t *_rt_first_sem, *_rt_second_sem;
72int _rt_lock_id;
73#define _ID_SZ 128
74char _rt_sem1_name[_ID_SZ] = "/_libextra_first_sem-";
75char _rt_sem2_name[_ID_SZ] = "/_libextra_second_sem-";
76char _rt_shm_name[_ID_SZ] = "/_libextra_barrier-";
77#endif /* PAIRED */
78
79#if LITMUS
80long unsigned int _rt_period;
81#endif
82
83static void _rt_load_params_itrl(int argc, char **argv) {
84#ifdef PAIRED
85 if (argc != (8 + LITMUS*2) && argc != (9 + LITMUS*2)) {
86 fprintf(stderr, "Usage: %s <name> <loops> <my core> <other core> <other name> <runID> <save results?>", argv[0]);
87#else
88 if (argc != (6 + LITMUS*2)) {
89 fprintf(stderr, "Usage: %s <name> <loops> <my core> <runID> <save results?>\n", argv[0]);
90#endif /* PAIRED */
91 fprintf(stderr, " <name> string for logging. Name of this task.\n");
92 fprintf(stderr, " <loops> integer number of iterations. -1 for infinite.\n");
93 fprintf(stderr, " <my core> integer core number. Only used for LITMUS-RT.\n");
94#ifdef PAIRED
95 fprintf(stderr, " <other core> integer for logging. Core of paired task.\n");
96 fprintf(stderr, " <other name> string for logging. Name of paired task.\n");
97#endif /* PAIRED */
98 fprintf(stderr, " <runID> string to append with .txt to yield output file name.\n");
99 fprintf(stderr, " <save results?> 1 to save results, 0 to discard.\n");
100#ifdef PAIRED
101 fprintf(stderr, " <pairID> (optional).\n");
102#endif
103#if LITMUS
104 fprintf(stderr, " <task period> in ms\n");
105 fprintf(stderr, " <task criticality level> 0 for Level-A, 1 for Level-B, 2 for Level-C\n");
106#endif /* LITMUS */
107 exit(1);
108 }
109 _rt_our_prog_name = argv[1];
110 _rt_max_jobs = atol(argv[2]);
111#if !LITMUS
112 _rt_core = sched_getcpu();
113#else
114 _rt_core = atoi(argv[3]);
115#endif
116#ifdef PAIRED
117 _rt_other_core = argv[4];
118 _rt_other_prog_name = argv[5];
119 _rt_run_id = argv[6];
120 _rt_will_output = atoi(argv[7]);
121 char *pairId;
122 int end;
123 if (argc > 8) {
124 pairId = argv[8];
125 end = 8;
126 } else {
127 pairId = "none";
128 end = 9;
129 }
130#else
131 _rt_other_core = "none";
132 _rt_other_prog_name = "none";
133 _rt_run_id = argv[4];
134 _rt_will_output = atoi(argv[5]);
135 int end = 6;
136#endif /* PAIRED */
137 if (_rt_max_jobs < 0 && _rt_will_output != 0) {
138 fprintf(stderr, "Infinite loops only supported when output is disabled!\n");
139 exit(1);
140 }
141 if (strlen(_rt_run_id) + 5 > _RT_FILENAME_LEN) {
142 fprintf(stderr, "Run ID is too large! Keep it to less than %d characters.\n", _RT_FILENAME_LEN);
143 exit(1);
144 }
145#ifdef PAIRED
146 // __rt_sem2_name happens to be the longest
147 if (strlen(pairId) + strlen(_rt_sem2_name) > _ID_SZ) {
148 fprintf(stderr, "PairID is too long! Maximum length is %ld characters.\n", _ID_SZ - strlen(_rt_sem2_name));
149 exit(1);
150 }
151 _rt_start_time = calloc(_rt_max_jobs * _rt_will_output, sizeof(long long));
152 _rt_end_time = calloc(_rt_max_jobs * _rt_will_output, sizeof(long long));
153 if (!_rt_end_time || !_rt_start_time) {
154 perror("Unable to allocate buffers for execution times");
155 exit(1);
156 }
157 // Use PairID to create unique semaphore and shared memory paths
158 strcat(_rt_sem1_name, pairId);
159 strcat(_rt_sem2_name, pairId);
160 strcat(_rt_shm_name, pairId);
161 _rt_first_sem = sem_open(_rt_sem1_name, O_CREAT, 644, 0);
162 _rt_second_sem = sem_open(_rt_sem2_name, O_CREAT, 644, 0);
163 if (_rt_first_sem == SEM_FAILED || _rt_second_sem == SEM_FAILED) {
164 perror("Error while creating semaphores");
165 exit(1);
166 }
167 // Create shared memory for barrier synchronization and infer lock ID
168 int barrier_file = shm_open(_rt_shm_name, O_CREAT | O_RDWR | O_EXCL, 644);
169 if (barrier_file == -1) {
170 // File already existed - we're the 2nd program and thus lock ID 2
171 _rt_lock_id = 2;
172 barrier_file = shm_open(_rt_shm_name, O_CREAT | O_RDWR, 644);
173 } else {