From 95b383ce406872937fb810ac1f8b8a17ef887429 Mon Sep 17 00:00:00 2001 From: leochanj105 Date: Tue, 26 Oct 2021 00:07:19 -0400 Subject: fixed power issue and extra.h first job issue --- extra.h | 79 +++++++++++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 55 insertions(+), 24 deletions(-) (limited to 'extra.h') 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) { exit(1); } _rt_cp = get_ctrl_page(); - if (wait && wait_for_ts_release() != 0) { - perror("Unable to wait for taskset release"); - exit(1); - } + // if (wait && wait_for_ts_release() != 0) { + // perror("Unable to wait for taskset release"); + // exit(1); + // } #endif /* LITMUS */ #if MMDC_PROF SETUP_MMDC @@ -434,31 +434,46 @@ out: // Start a job static void _rt_start_loop() { #if LITMUS - static lt_t last = 0; - lt_t now = litmus_clock(); - if (now > _rt_cp->deadline) { - fprintf(stderr, "(%s/%d:%lu) ", _rt_our_prog_name, gettid(), _rt_cp->job_index); - if (_rt_crit == 0) - fprintf(stderr, "CATASTROPHIC: Level-A"); - else if (_rt_crit == 1) - fprintf(stderr, "HAZARDOUS: Level-B"); - else - fprintf(stderr, "MAJOR: Level-C"); - fprintf(stderr, " tardy %llu ns, " - "relative tardiness %f\n", - now - _rt_cp->deadline, - (now - _rt_cp->deadline) / (double)_rt_period); + if (_rt_jobs_complete == 0) { + if(wait_for_ts_release() != 0){ + perror("Unable to wait for taskset release"); + exit(1); + } + } + else{ + if (sleep_next_period() != 0) { + perror("Unable to sleep for next period"); + } } - if (last == 0) { - last = now; - } + // static lt_t last = 0; + // lt_t now = litmus_clock(); + // fprintf(stderr, "current now : %llu\n", now); + // if (now > _rt_cp->deadline) { + // fprintf(stderr, "(%s/%d:%lu) ", _rt_our_prog_name, gettid(), _rt_cp->job_index); + // // if (_rt_crit == 0) + // // fprintf(stderr, "CATASTROPHIC: Level-A"); + // // else if (_rt_crit == 1) + // // fprintf(stderr, "HAZARDOUS: Level-B"); + // // else + // // fprintf(stderr, "MAJOR: Level-C"); + // fprintf(stderr, " tardy %llu ns, " + // "relative tardiness %f\n", + // now - _rt_cp->deadline, + // (now - _rt_cp->deadline) / (double)_rt_period); + // } + // if (last == 0) { + // last = now; + // } // else if (now > last + 60ull * _BILLION && _rt_crit >= 2) { // last = now; // fprintf(stderr, "(%s/%d:%lu) Ping\n", _rt_our_prog_name, gettid(), _rt_cp->job_index); // } - if (sleep_next_period() != 0) { - perror("Unable to sleep for next period"); - } + // lt_t now = litmus_clock(); + // if(_rt_jobs_complete != 0){ + // fprintf(stderr, "in start before sleep: release: %llu, deadline: %llu, now: %llu\n", _rt_cp->release ,_rt_cp->deadline, litmus_clock()); + + // fprintf(stderr, "in start after sleep: release: %llu, deadline: %llu, now: %llu\n", _rt_cp->release ,_rt_cp->deadline, litmus_clock()); + // } #else sched_yield(); #endif /* LITMUS */ @@ -488,6 +503,22 @@ static void _rt_stop_loop() { get_mmdc_profiling_results(mmdc, &mmdc_res); #endif /* MMDC_PROF */ _rt_save_job_result(); +#if LITMUS + long long end = _rt_end_time[_rt_jobs_complete]; + if (end > _rt_cp->deadline) { + fprintf(stderr, "(%s/%d:%lu) ", _rt_our_prog_name, gettid(), _rt_cp->job_index); + // if (_rt_crit == 0) + // fprintf(stderr, "CATASTROPHIC: Level-A"); + // else if (_rt_crit == 1) + // fprintf(stderr, "HAZARDOUS: Level-B"); + // else + // fprintf(stderr, "MAJOR: Level-C"); + fprintf(stderr, " tardy %llu ns, " + "relative tardiness %f\n", + end - _rt_cp->deadline, + (end - _rt_cp->deadline) / (double)_rt_period); + } +#endif _rt_jobs_complete++; } -- cgit v1.2.2