Skip to content

Commit

Permalink
code: change definition for makespan, github issue oar-team#69
Browse files Browse the repository at this point in the history
  • Loading branch information
Maël Madon committed Nov 7, 2023
1 parent 6e5a6fa commit 99a53c8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/output-schedule.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
15 changes: 11 additions & 4 deletions src/export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1066,6 +1066,7 @@ void JobsTracer::finalize()
double mean_waiting_time = static_cast<double>(_sum_waiting_time)/_nb_jobs;
double mean_turnaround_time = static_cast<double>(_sum_turnaround_time)/_nb_jobs;
double mean_slowdown = static_cast<double>(_sum_slowdown)/_nb_jobs;
double makespan = static_cast<double>(_max_completion_time - _min_submission_time);

output_map["batsim_version"] = _context->batsim_version;
output_map["nb_jobs"] = to_string(_nb_jobs);
Expand All @@ -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<double>(_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);
Expand All @@ -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<double>(_makespan), static_cast<double>(seconds_used_by_scheduler),
makespan, static_cast<double>(seconds_used_by_scheduler),
static_cast<double>(mean_waiting_time), static_cast<double>(mean_turnaround_time), mean_slowdown,
static_cast<double>(_max_waiting_time), static_cast<double>(_max_turnaround_time), static_cast<double>(_max_slowdown));
XBT_INFO("mean_machines_running=%lf, max_machines_running=%lf",
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion src/export.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 99a53c8

Please sign in to comment.