diff --git a/meson.build b/meson.build index 46b79ab97b90d09dbdf5f87182897e1411b8889a..5af6ba1419ad47b60a88bb35eb2b82485375e15f 100644 --- a/meson.build +++ b/meson.build @@ -67,8 +67,6 @@ src = [ 'src/protocol.hpp', 'src/queue.cpp', 'src/queue.hpp', - 'src/queueing_theory_waiting_time_estimator.cpp', - 'src/queueing_theory_waiting_time_estimator.hpp', 'src/schedule.cpp', 'src/schedule.hpp' ] diff --git a/src/queueing_theory_waiting_time_estimator.cpp b/src/queueing_theory_waiting_time_estimator.cpp deleted file mode 100644 index f047b574d645ad5875b657ced04e1c66973e435a..0000000000000000000000000000000000000000 --- a/src/queueing_theory_waiting_time_estimator.cpp +++ /dev/null @@ -1,54 +0,0 @@ -#include "queueing_theory_waiting_time_estimator.hpp" - -#include "pempek_assert.hpp" - -void QueueingTheoryWaitingTimeEstimator::add_submitted_job(const Job *job) -{ - _recently_submitted_jobs.push_back(job); -} - -void QueueingTheoryWaitingTimeEstimator::add_completed_job(const Job *job) -{ - _recently_completed_jobs.push_back(job); -} - -void QueueingTheoryWaitingTimeEstimator::remove_old(Rational old_date_thresh) -{ - for (auto submit_lit = _recently_submitted_jobs.begin(); submit_lit != _recently_submitted_jobs.end(); ) - { - const Job * job = *submit_lit; - if (job->submission_time < old_date_thresh) - submit_lit = _recently_submitted_jobs.erase(submit_lit); - else - break; - } - - for (auto complete_lit = _recently_completed_jobs.begin(); complete_lit != _recently_completed_jobs.end(); ) - { - const Job * job = *complete_lit; - if (job->completion_time < old_date_thresh) - complete_lit = _recently_completed_jobs.erase(complete_lit); - else - break; - } -} - -Rational QueueingTheoryWaitingTimeEstimator::estimate_waiting_time(Rational period_length) -{ - PPK_ASSERT_ERROR(period_length > 0); - Rational arrival_rate = _recently_submitted_jobs.size() / period_length; - Rational service_rate = _recently_completed_jobs.size() / period_length; - - if (arrival_rate != service_rate && service_rate != 0) - return (1/(service_rate-arrival_rate)) - (1/service_rate); - else - return std::numeric_limits<Rational>::infinity(); -} - -Rational QueueingTheoryWaitingTimeEstimator::estimate_waiting_time_by_area(Rational period_length, int nb_awake_machines) -{ - (void) period_length; - (void) nb_awake_machines; - PPK_ASSERT_ERROR(false, "Not implemented"); - return 0; -} diff --git a/src/queueing_theory_waiting_time_estimator.hpp b/src/queueing_theory_waiting_time_estimator.hpp deleted file mode 100644 index d0891585fc9cccfdc6e89e10dda090b9c295940c..0000000000000000000000000000000000000000 --- a/src/queueing_theory_waiting_time_estimator.hpp +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once - -#include <list> - -#include "json_workload.hpp" -#include "exact_numbers.hpp" - -struct QueueingTheoryWaitingTimeEstimator -{ - void add_submitted_job(const Job * job); - void add_completed_job(const Job * job); - - void remove_old(Rational old_date_thresh); - Rational estimate_waiting_time(Rational period_length); - Rational estimate_waiting_time_by_area(Rational period_length, int nb_awake_machines); - -private: - std::list<const Job *> _recently_submitted_jobs; - std::list<const Job *> _recently_completed_jobs; -};