summaryrefslogtreecommitdiffstats
path: root/extra.h
diff options
context:
space:
mode:
Diffstat (limited to 'extra.h')
-rw-r--r--extra.h79
1 files changed, 55 insertions, 24 deletions
diff --git a/extra.h b/extra.h
index 5f08a60..7bcc8f5 100644
--- a/extra.h
+++ b/extra.h
@@ -244,10 +244,10 @@ static void _rt_load_params_itrl(int argc, char **argv) {
244 exit(1); 244 exit(1);
245 } 245 }
246 _rt_cp = get_ctrl_page(); 246 _rt_cp = get_ctrl_page();
247 if (wait && wait_for_ts_release() != 0) { 247 // if (wait && wait_for_ts_release() != 0) {
248 perror("Unable to wait for taskset release"); 248 // perror("Unable to wait for taskset release");
249 exit(1); 249 // exit(1);
250 } 250 // }
251#endif /* LITMUS */ 251#endif /* LITMUS */
252#if MMDC_PROF 252#if MMDC_PROF
253 SETUP_MMDC 253 SETUP_MMDC
@@ -434,31 +434,46 @@ out:
434// Start a job 434// Start a job
435static void _rt_start_loop() { 435static void _rt_start_loop() {
436#if LITMUS 436#if LITMUS
437 static lt_t last = 0; 437 if (_rt_jobs_complete == 0) {
438 lt_t now = litmus_clock(); 438 if(wait_for_ts_release() != 0){
439 if (now > _rt_cp->deadline) { 439 perror("Unable to wait for taskset release");
440 fprintf(stderr, "(%s/%d:%lu) ", _rt_our_prog_name, gettid(), _rt_cp->job_index); 440 exit(1);
441 if (_rt_crit == 0) 441 }
442 fprintf(stderr, "CATASTROPHIC: Level-A"); 442 }
443 else if (_rt_crit == 1) 443 else{
444 fprintf(stderr, "HAZARDOUS: Level-B"); 444 if (sleep_next_period() != 0) {
445 else 445 perror("Unable to sleep for next period");
446 fprintf(stderr, "MAJOR: Level-C"); 446 }
447 fprintf(stderr, " tardy %llu ns, "
448 "relative tardiness %f\n",
449 now - _rt_cp->deadline,
450 (now - _rt_cp->deadline) / (double)_rt_period);
451 } 447 }
452 if (last == 0) { 448 // static lt_t last = 0;
453 last = now; 449 // lt_t now = litmus_clock();
454 } 450 // fprintf(stderr, "current now : %llu\n", now);
451 // if (now > _rt_cp->deadline) {
452 // fprintf(stderr, "(%s/%d:%lu) ", _rt_our_prog_name, gettid(), _rt_cp->job_index);
453 // // if (_rt_crit == 0)
454 // // fprintf(stderr, "CATASTROPHIC: Level-A");
455 // // else if (_rt_crit == 1)
456 // // fprintf(stderr, "HAZARDOUS: Level-B");
457 // // else
458 // // fprintf(stderr, "MAJOR: Level-C");
459 // fprintf(stderr, " tardy %llu ns, "
460 // "relative tardiness %f\n",
461 // now - _rt_cp->deadline,
462 // (now - _rt_cp->deadline) / (double)_rt_period);
463 // }
464 // if (last == 0) {
465 // last = now;
466 // }
455 // else if (now > last + 60ull * _BILLION && _rt_crit >= 2) { 467 // else if (now > last + 60ull * _BILLION && _rt_crit >= 2) {
456 // last = now; 468 // last = now;
457 // fprintf(stderr, "(%s/%d:%lu) Ping\n", _rt_our_prog_name, gettid(), _rt_cp->job_index); 469 // fprintf(stderr, "(%s/%d:%lu) Ping\n", _rt_our_prog_name, gettid(), _rt_cp->job_index);
458 // } 470 // }
459 if (sleep_next_period() != 0) { 471 // lt_t now = litmus_clock();
460 perror("Unable to sleep for next period"); 472 // if(_rt_jobs_complete != 0){
461 } 473 // fprintf(stderr, "in start before sleep: release: %llu, deadline: %llu, now: %llu\n", _rt_cp->release ,_rt_cp->deadline, litmus_clock());
474
475 // fprintf(stderr, "in start after sleep: release: %llu, deadline: %llu, now: %llu\n", _rt_cp->release ,_rt_cp->deadline, litmus_clock());
476 // }
462#else 477#else
463 sched_yield(); 478 sched_yield();
464#endif /* LITMUS */ 479#endif /* LITMUS */
@@ -488,6 +503,22 @@ static void _rt_stop_loop() {
488 get_mmdc_profiling_results(mmdc, &mmdc_res); 503 get_mmdc_profiling_results(mmdc, &mmdc_res);
489#endif /* MMDC_PROF */ 504#endif /* MMDC_PROF */
490 _rt_save_job_result(); 505 _rt_save_job_result();
506#if LITMUS
507 long long end = _rt_end_time[_rt_jobs_complete];
508 if (end > _rt_cp->deadline) {
509 fprintf(stderr, "(%s/%d:%lu) ", _rt_our_prog_name, gettid(), _rt_cp->job_index);
510 // if (_rt_crit == 0)
511 // fprintf(stderr, "CATASTROPHIC: Level-A");
512 // else if (_rt_crit == 1)
513 // fprintf(stderr, "HAZARDOUS: Level-B");
514 // else
515 // fprintf(stderr, "MAJOR: Level-C");
516 fprintf(stderr, " tardy %llu ns, "
517 "relative tardiness %f\n",
518 end - _rt_cp->deadline,
519 (end - _rt_cp->deadline) / (double)_rt_period);
520 }
521#endif
491 _rt_jobs_complete++; 522 _rt_jobs_complete++;
492} 523}
493 524