summaryrefslogtreecommitdiffstats
path: root/extra.h
diff options
context:
space:
mode:
Diffstat (limited to 'extra.h')
-rw-r--r--extra.h36
1 files changed, 22 insertions, 14 deletions
diff --git a/extra.h b/extra.h
index 9da536d..a4a3d9c 100644
--- a/extra.h
+++ b/extra.h
@@ -403,12 +403,12 @@ static void _rt_write_to_file() {
403 } 403 }
404 fclose(fp); 404 fclose(fp);
405out: 405out:
406#if LITMUS 406// #if LITMUS
407 if (task_mode(BACKGROUND_TASK) != 0) { 407// if (task_mode(BACKGROUND_TASK) != 0) {
408 perror("Unable to become a real-time task"); 408// perror("Unable to become a real-time task");
409 exit(1); 409// exit(1);
410 } 410// }
411#endif /* LITMUS */ 411// #endif /* LITMUS */
412#ifdef PAIRED 412#ifdef PAIRED
413 munmap(_rt_barrier, 2); 413 munmap(_rt_barrier, 2);
414 sem_unlink(_rt_sem1_name); 414 sem_unlink(_rt_sem1_name);
@@ -428,7 +428,8 @@ out:
428// Start a job 428// Start a job
429static 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 430 // Let the first job run before synchrnous release --- make sure we have no further page faults
431 if(first_job){ 431 if(first_job == 1){
432 // FLUSH_CACHES
432 return; 433 return;
433 } 434 }
434#if LITMUS 435#if LITMUS
@@ -442,7 +443,7 @@ static void _rt_start_loop() {
442 else{ 443 else{
443 if (sleep_next_period() != 0) { 444 if (sleep_next_period() != 0) {
444 perror("Unable to sleep for next period"); 445 perror("Unable to sleep for next period");
445 } 446 }
446 } 447 }
447 448
448 // if (last == 0) { 449 // if (last == 0) {
@@ -479,7 +480,7 @@ static void _rt_start_loop() {
479static void _rt_stop_loop() { 480static void _rt_stop_loop() {
480 clock_gettime(CLOCK_MONOTONIC, &_rt_end); 481 clock_gettime(CLOCK_MONOTONIC, &_rt_end);
481 // Set first_job == 0 482 // Set first_job == 0
482 if(first_job){ 483 if(first_job == 1){
483 first_job = 0; 484 first_job = 0;
484 return; 485 return;
485 } 486 }
@@ -493,13 +494,20 @@ static void _rt_stop_loop() {
493 long long end = _rt_end_time[_rt_jobs_complete]; 494 long long end = _rt_end_time[_rt_jobs_complete];
494 if (end > _rt_cp->deadline) { 495 if (end > _rt_cp->deadline) {
495 fprintf(stderr, "(%s/%d:%lu) ", _rt_our_prog_name, gettid(), _rt_cp->job_index); 496 fprintf(stderr, "(%s/%d:%lu) ", _rt_our_prog_name, gettid(), _rt_cp->job_index);
496 fprintf(stderr, " tardy %llu ns, " 497 fprintf(stderr, "tardy %llu ns, relative tardiness %f\n", end - _rt_cp->deadline, (end - _rt_cp->deadline) / (double)_rt_deadline);
497 "relative tardiness %f\n",
498 end - _rt_cp->deadline,
499 (end - _rt_cp->deadline) / (double)_rt_deadline);
500 } 498 }
501#endif 499#endif
502 _rt_jobs_complete++; 500 _rt_jobs_complete++;
501#if LITMUS
502 if(_rt_jobs_complete == _rt_max_jobs){
503 // fprintf(stderr, "complete %s: %d\n" , _rt_our_prog_name, _rt_jobs_complete);
504 if (task_mode(BACKGROUND_TASK) != 0) {
505 perror("Unable to become background task");
506 exit(1);
507 }
508 }
509#endif
510
503} 511}
504 512
505/****** New API ****** 513/****** New API ******