summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dag2
-rw-r--r--dag_example5
-rw-r--r--extra.h102
-rw-r--r--extra_prev.h601
-rwxr-xr-xrun_case_study_dag.py13
-rw-r--r--tmp1
6 files changed, 649 insertions, 75 deletions
diff --git a/dag b/dag
index bb0a8cf..9180799 100644
--- a/dag
+++ b/dag
@@ -1 +1 @@
1,disparity_qcif, dis001, 2, 1, 5, 1, 15, 1, 0, 12, 14, mser_qcif, mser001, 5, 9 \ No newline at end of file 0, localization_qcif, loc001, 100, 15, loc, 1, 50, 1, 0, 50, 50 \ No newline at end of file
diff --git a/dag_example b/dag_example
index ce39489..05a7c3f 100644
--- a/dag_example
+++ b/dag_example
@@ -1,4 +1 @@
11, mser_qcif, mser001, 5, 1, 1, 1, 100, 1, 0, sift_qcif, sift001 0, stitch_qcif, stitch001, 10, 2, stitch, 1, 50, 1, 17, 15, 16 \ No newline at end of file
20, mser_qcif, mser002, 3, 2, 2, 1, 10, 1, 0
31, svm_qcif, svm001, 6, 2, 3, 1, 50, 1, 0, localization_qcif, localization001
40, tracking_qcif, tracking001, 3, 3, 4, 1, 20, 1, 17
diff --git a/extra.h b/extra.h
index fce8c3f..9da536d 100644
--- a/extra.h
+++ b/extra.h
@@ -30,7 +30,7 @@ extern int sched_getcpu();
30#endif 30#endif
31 31
32// This is a proxy for "case study mode" now 32// This is a proxy for "case study mode" now
33#define LITMUS 0 33#define LITMUS 0
34#define MMDC_PROF 0 34#define MMDC_PROF 0
35 35
36#if LITMUS 36#if LITMUS
@@ -60,6 +60,8 @@ int _rt_core;
60int _rt_will_output; 60int _rt_will_output;
61struct timespec _rt_start, _rt_end; 61struct timespec _rt_start, _rt_end;
62 62
63int first_job;
64
63char *_rt_run_id; 65char *_rt_run_id;
64char *_rt_our_prog_name; 66char *_rt_our_prog_name;
65char *_rt_other_prog_name; 67char *_rt_other_prog_name;
@@ -78,10 +80,10 @@ char _rt_shm_name[_ID_SZ] = "/_libextra_barrier-";
78 80
79#if LITMUS 81#if LITMUS
80lt_t _rt_period; 82lt_t _rt_period;
83int _rt_crit;
81lt_t _rt_phase; 84lt_t _rt_phase;
82lt_t _rt_cost; 85lt_t _rt_cost;
83lt_t _rt_deadline; 86lt_t _rt_deadline;
84int _rt_crit;
85struct control_page *_rt_cp; 87struct control_page *_rt_cp;
86#endif 88#endif
87 89
@@ -108,7 +110,7 @@ static void _rt_load_params_itrl(int argc, char **argv) {
108#if LITMUS 110#if LITMUS
109 fprintf(stderr, " <task period> in ms\n"); 111 fprintf(stderr, " <task period> in ms\n");
110 fprintf(stderr, " <task criticality level> 0 for Level-A, 1 for Level-B, 2 for Level-C\n"); 112 fprintf(stderr, " <task criticality level> 0 for Level-A, 1 for Level-B, 2 for Level-C\n");
111 fprintf(stderr, " <task phase> in ms\n"); 113 fprintf(stderr, " <task phase> in ms\n");
112 fprintf(stderr, " <task cost> in ms\n"); 114 fprintf(stderr, " <task cost> in ms\n");
113 fprintf(stderr, " <task deadline> in ms\n"); 115 fprintf(stderr, " <task deadline> in ms\n");
114#endif /* LITMUS */ 116#endif /* LITMUS */
@@ -150,19 +152,23 @@ static void _rt_load_params_itrl(int argc, char **argv) {
150 fprintf(stderr, "Run ID is too large! Keep it to less than %d characters.\n", _RT_FILENAME_LEN); 152 fprintf(stderr, "Run ID is too large! Keep it to less than %d characters.\n", _RT_FILENAME_LEN);
151 exit(1); 153 exit(1);
152 } 154 }
153#ifdef PAIRED
154 // __rt_sem2_name happens to be the longest
155 if (strlen(pairId) + strlen(_rt_sem2_name) > _ID_SZ) {
156 fprintf(stderr, "PairID is too long! Maximum length is %ld characters.\n", _ID_SZ - strlen(_rt_sem2_name));
157 exit(1);
158 }
159 _rt_start_time = calloc(_rt_max_jobs * _rt_will_output, sizeof(long long)); 155 _rt_start_time = calloc(_rt_max_jobs * _rt_will_output, sizeof(long long));
160 _rt_end_time = calloc(_rt_max_jobs * _rt_will_output, sizeof(long long)); 156 _rt_end_time = calloc(_rt_max_jobs * _rt_will_output, sizeof(long long));
161 _rt_exec_time = calloc(_rt_max_jobs * _rt_will_output, sizeof(float));
162 if (!_rt_end_time || !_rt_start_time) { 157 if (!_rt_end_time || !_rt_start_time) {
163 perror("Unable to allocate buffers for execution times"); 158 perror("Unable to allocate buffers for execution times");
164 exit(1); 159 exit(1);
165 } 160 }
161 _rt_exec_time = calloc(_rt_max_jobs * _rt_will_output, sizeof(float));
162 if (!_rt_exec_time) {
163 perror("Unable to allocate buffer for execution times");
164 exit(1);
165 }
166#ifdef PAIRED
167 // __rt_sem2_name happens to be the longest
168 if (strlen(pairId) + strlen(_rt_sem2_name) > _ID_SZ) {
169 fprintf(stderr, "PairID is too long! Maximum length is %ld characters.\n", _ID_SZ - strlen(_rt_sem2_name));
170 exit(1);
171 }
166 // Use PairID to create unique semaphore and shared memory paths 172 // Use PairID to create unique semaphore and shared memory paths
167 strcat(_rt_sem1_name, pairId); 173 strcat(_rt_sem1_name, pairId);
168 strcat(_rt_sem2_name, pairId); 174 strcat(_rt_sem2_name, pairId);
@@ -201,16 +207,11 @@ static void _rt_load_params_itrl(int argc, char **argv) {
201 exit(1); 207 exit(1);
202 } 208 }
203 *_rt_barrier = 0; 209 *_rt_barrier = 0;
204#else 210// #else
205 _rt_start_time = calloc(_rt_max_jobs * _rt_will_output, sizeof(long long)); 211
206 _rt_end_time = calloc(_rt_max_jobs * _rt_will_output, sizeof(long long));
207 _rt_exec_time = calloc(_rt_max_jobs * _rt_will_output, sizeof(float));
208 if (!_rt_exec_time) {
209 perror("Unable to allocate buffer for execution times");
210 exit(1);
211 }
212#endif /* PAIRED */ 212#endif /* PAIRED */
213 _rt_jobs_complete = 0; 213 _rt_jobs_complete = 0;
214 first_job = 1;
214 mlockall(MCL_CURRENT || MCL_FUTURE); 215 mlockall(MCL_CURRENT || MCL_FUTURE);
215#if LITMUS 216#if LITMUS
216 _rt_period = ms2ns(strtoul(argv[end], NULL, 10)); 217 _rt_period = ms2ns(strtoul(argv[end], NULL, 10));
@@ -218,7 +219,6 @@ static void _rt_load_params_itrl(int argc, char **argv) {
218 _rt_phase = ms2ns(strtoul(argv[end+2], NULL, 10)); 219 _rt_phase = ms2ns(strtoul(argv[end+2], NULL, 10));
219 _rt_cost = ms2ns(strtoul(argv[end+3], NULL, 10)); 220 _rt_cost = ms2ns(strtoul(argv[end+3], NULL, 10));
220 _rt_deadline = ms2ns(strtoul(argv[end+4], NULL, 10)); 221 _rt_deadline = ms2ns(strtoul(argv[end+4], NULL, 10));
221 // _rt_phase = 0;
222 unsigned int wait = 1; 222 unsigned int wait = 1;
223 if (be_migrate_to_domain(_rt_core) < 0) { 223 if (be_migrate_to_domain(_rt_core) < 0) {
224 perror("Unable to migrate to specified CPU"); 224 perror("Unable to migrate to specified CPU");
@@ -232,7 +232,6 @@ static void _rt_load_params_itrl(int argc, char **argv) {
232 rt_param.relative_deadline = _rt_deadline; 232 rt_param.relative_deadline = _rt_deadline;
233 rt_param.phase = _rt_phase; 233 rt_param.phase = _rt_phase;
234 rt_param.priority = LITMUS_LOWEST_PRIORITY; 234 rt_param.priority = LITMUS_LOWEST_PRIORITY;
235 // rt_param.priority = ns2ms(_rt_phase);
236 rt_param.cls = _rt_crit; 235 rt_param.cls = _rt_crit;
237 rt_param.budget_policy = NO_ENFORCEMENT; 236 rt_param.budget_policy = NO_ENFORCEMENT;
238 rt_param.cpu = _rt_core; 237 rt_param.cpu = _rt_core;
@@ -358,21 +357,10 @@ static void _rt_save_job_result() {
358 _rt_end_time[_rt_jobs_complete] = _rt_end.tv_sec; 357 _rt_end_time[_rt_jobs_complete] = _rt_end.tv_sec;
359 _rt_end_time[_rt_jobs_complete] *= _BILLION; 358 _rt_end_time[_rt_jobs_complete] *= _BILLION;
360 _rt_end_time[_rt_jobs_complete] += _rt_end.tv_nsec; 359 _rt_end_time[_rt_jobs_complete] += _rt_end.tv_nsec;
361 360// #else
362 _rt_exec_time[_rt_jobs_complete] = _rt_end.tv_sec - _rt_start.tv_sec; 361 _rt_exec_time[_rt_jobs_complete] = _rt_end.tv_sec - _rt_start.tv_sec;
363 _rt_exec_time[_rt_jobs_complete] *= _BILLION; 362 _rt_exec_time[_rt_jobs_complete] *= _BILLION;
364 _rt_exec_time[_rt_jobs_complete] += _rt_end.tv_nsec - _rt_start.tv_nsec; 363 _rt_exec_time[_rt_jobs_complete] += _rt_end.tv_nsec - _rt_start.tv_nsec;
365// #else
366// _rt_start_time[_rt_jobs_complete] = _rt_start.tv_sec;
367// _rt_start_time[_rt_jobs_complete] *= _BILLION;
368// _rt_start_time[_rt_jobs_complete] += _rt_start.tv_nsec;
369// _rt_end_time[_rt_jobs_complete] = _rt_end.tv_sec;
370// _rt_end_time[_rt_jobs_complete] *= _BILLION;
371// _rt_end_time[_rt_jobs_complete] += _rt_end.tv_nsec;
372
373// _rt_exec_time[_rt_jobs_complete] = _rt_end.tv_sec - _rt_start.tv_sec;
374// _rt_exec_time[_rt_jobs_complete] *= _BILLION;
375// _rt_exec_time[_rt_jobs_complete] += _rt_end.tv_nsec - _rt_start.tv_nsec;
376// #endif /* PAIRED */ 364// #endif /* PAIRED */
377#if MMDC_PROF 365#if MMDC_PROF
378 _rt_mmdc_read[_rt_jobs_complete] = mmdc_res.read_bytes; 366 _rt_mmdc_read[_rt_jobs_complete] = mmdc_res.read_bytes;
@@ -439,7 +427,12 @@ out:
439 427
440// Start a job 428// Start a job
441static void _rt_start_loop() { 429static void _rt_start_loop() {
430 // Let the first job run before synchrnous release --- make sure we have no further page faults
431 if(first_job){
432 return;
433 }
442#if LITMUS 434#if LITMUS
435 // static lt_t last = 0;
443 if (_rt_jobs_complete == 0) { 436 if (_rt_jobs_complete == 0) {
444 if(wait_for_ts_release() != 0){ 437 if(wait_for_ts_release() != 0){
445 perror("Unable to wait for taskset release"); 438 perror("Unable to wait for taskset release");
@@ -451,45 +444,27 @@ static void _rt_start_loop() {
451 perror("Unable to sleep for next period"); 444 perror("Unable to sleep for next period");
452 } 445 }
453 } 446 }
454 // static lt_t last = 0; 447
455 // lt_t now = litmus_clock();
456 // fprintf(stderr, "current now : %llu\n", now);
457 // if (now > _rt_cp->deadline) {
458 // fprintf(stderr, "(%s/%d:%lu) ", _rt_our_prog_name, gettid(), _rt_cp->job_index);
459 // // if (_rt_crit == 0)
460 // // fprintf(stderr, "CATASTROPHIC: Level-A");
461 // // else if (_rt_crit == 1)
462 // // fprintf(stderr, "HAZARDOUS: Level-B");
463 // // else
464 // // fprintf(stderr, "MAJOR: Level-C");
465 // fprintf(stderr, " tardy %llu ns, "
466 // "relative tardiness %f\n",
467 // now - _rt_cp->deadline,
468 // (now - _rt_cp->deadline) / (double)_rt_period);
469 // }
470 // if (last == 0) { 448 // if (last == 0) {
471 // last = now; 449 // last = now;
472 // }