From 99a53c80aefadf78978fbd4503f50faec52b8b3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Madon?= Date: Tue, 7 Nov 2023 09:19:56 +0100 Subject: [PATCH 1/2] code: change definition for makespan, github issue #69 --- docs/output-schedule.rst | 2 +- src/export.cpp | 15 +++++++++++---- src/export.hpp | 3 ++- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/docs/output-schedule.rst b/docs/output-schedule.rst index 3fc166be..26dbc78b 100644 --- a/docs/output-schedule.rst +++ b/docs/output-schedule.rst @@ -9,7 +9,7 @@ This file contains the following fields in lexicographic order of the fields nam - ``batsim_version``: Similar to the output of the ``--version`` :ref:`cli` option. - ``consumed_joules``: The total amount of joules consumed by the machines from the submission time of the first job to the finish time of the last job. -- ``makespan``: The completion time of the last job. +- ``makespan``: The time that elapses from the submission time of the first job to the finish time of the last job. It is calculated by `max(completion_time) - min(submission_time)`. - ``max_slowdown``: The maximum slowdown observed on a job. Slowdown is computed for a job as its turnaround time divided by its execution time. - ``max_turnaround_time``: The maximum turnaround time observed on a job. diff --git a/src/export.cpp b/src/export.cpp index 944d64e3..320ed290 100644 --- a/src/export.cpp +++ b/src/export.cpp @@ -1066,6 +1066,7 @@ void JobsTracer::finalize() double mean_waiting_time = static_cast(_sum_waiting_time)/_nb_jobs; double mean_turnaround_time = static_cast(_sum_turnaround_time)/_nb_jobs; double mean_slowdown = static_cast(_sum_slowdown)/_nb_jobs; + double makespan = static_cast(_max_completion_time - _min_submission_time); output_map["batsim_version"] = _context->batsim_version; output_map["nb_jobs"] = to_string(_nb_jobs); @@ -1075,7 +1076,7 @@ void JobsTracer::finalize() output_map["nb_jobs_rejected"] = to_string(_nb_jobs_rejected); output_map["success_rate"] = to_string(success_rate); - output_map["makespan"] = to_string(static_cast(_makespan)); + output_map["makespan"] = to_string(makespan); output_map["mean_waiting_time"] = to_string(mean_waiting_time); output_map["mean_turnaround_time"] = to_string(mean_turnaround_time); output_map["mean_slowdown"] = to_string(mean_slowdown); @@ -1089,7 +1090,7 @@ void JobsTracer::finalize() _nb_jobs, _nb_jobs_finished, _nb_jobs_success, _nb_jobs_killed, success_rate); XBT_INFO("makespan=%lf, scheduling_time=%lf, mean_waiting_time=%lf, mean_turnaround_time=%lf, " "mean_slowdown=%lf, max_waiting_time=%lf, max_turnaround_time=%lf, max_slowdown=%lf", - static_cast(_makespan), static_cast(seconds_used_by_scheduler), + makespan, static_cast(seconds_used_by_scheduler), static_cast(mean_waiting_time), static_cast(mean_turnaround_time), mean_slowdown, static_cast(_max_waiting_time), static_cast(_max_turnaround_time), static_cast(_max_slowdown)); XBT_INFO("mean_machines_running=%lf, max_machines_running=%lf", @@ -1171,14 +1172,20 @@ void JobsTracer::write_job(const JobPtr job) long double completion_time = job->starting_time + job->runtime; long double turnaround_time = completion_time - job->submission_time; long double slowdown = turnaround_time / job->runtime; + long double submission_time = job->submission_time; _sum_waiting_time += waiting_time; _sum_turnaround_time += turnaround_time; _sum_slowdown += slowdown; - if (completion_time > _makespan) + if (completion_time > _max_completion_time) { - _makespan = completion_time; + _max_completion_time = completion_time; + } + + if (submission_time < _min_submission_time) + { + _min_submission_time = submission_time; } if (waiting_time > _max_waiting_time) diff --git a/src/export.hpp b/src/export.hpp index 95818d16..a97ec1b6 100644 --- a/src/export.hpp +++ b/src/export.hpp @@ -512,7 +512,8 @@ class JobsTracer int _nb_jobs_success = 0; //!< The number of successful jobs. int _nb_jobs_killed = 0; //!< The number of killed jobs. int _nb_jobs_rejected = 0; //!< The number of rejected jobs. - long double _makespan = 0; //!< The makespan. + long double _max_completion_time = 0; //!< The maximum completion time observed. + long double _min_submission_time = 0; //!< The minimum submission time observed. long double _sum_waiting_time = 0; //!< The sum of the waiting time of jobs. long double _sum_turnaround_time = 0; //!< The sum of the turnaround time of jobs. long double _sum_slowdown = 0; //!< The sum of the slowdown (AKA stretch) of jobs. From b39bf1beaab9eadff22e686fcf932a88535153d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Madon?= Date: Tue, 7 Nov 2023 09:21:55 +0100 Subject: [PATCH 2/2] doc: homogeneize notations finish/completion time --- docs/output-schedule.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/output-schedule.rst b/docs/output-schedule.rst index 26dbc78b..b073293a 100644 --- a/docs/output-schedule.rst +++ b/docs/output-schedule.rst @@ -9,17 +9,17 @@ This file contains the following fields in lexicographic order of the fields nam - ``batsim_version``: Similar to the output of the ``--version`` :ref:`cli` option. - ``consumed_joules``: The total amount of joules consumed by the machines from the submission time of the first job to the finish time of the last job. -- ``makespan``: The time that elapses from the submission time of the first job to the finish time of the last job. It is calculated by `max(completion_time) - min(submission_time)`. +- ``makespan``: The time that elapses from the submission time of the first job to the finish time of the last job. It is calculated by `max(finish_time) - min(submission_time)`. - ``max_slowdown``: The maximum slowdown observed on a job. Slowdown is computed for a job as its turnaround time divided by its execution time. - ``max_turnaround_time``: The maximum turnaround time observed on a job. - Turnaround time is computed for a job as its completion time minus its submission time. + Turnaround time is computed for a job as its finish time minus its submission time. - ``max_waiting_time``: The maximum waiting time observed on a job. Waiting time is computed for a job as its starting time minus its submission time. - ``mean_slowdown``: The average slowdown observed on jobs. Slowdown is computed for a job as its turnaround time divided by its execution time. - ``mean_turnaround_time``: The average turnaround time observed on jobs. - Turnaround time is computed for a job as its completion time minus its submission time. + Turnaround time is computed for a job as its finish time minus its submission time. - ``mean_waiting_time``: The average waiting time observed on jobs. Waiting time is computed for a job as its starting time minus its submission time. - ``nb_computing_machines``: The number of computing machines in the simulation.