Skip to content
Snippets Groups Projects
Commit 1593a662 authored by Maxime MORGE's avatar Maxime MORGE :construction_worker:
Browse files

PSSI: Redo XP 4 C^S_H

parent bc0827e6
No related branches found
No related tags found
No related merge requests found
......@@ -431,6 +431,56 @@ Allocation(stap, delay){
* Returns the ongoing mean global flowtime
*/
def ongoingMeanGlobalFlowtime: Double = ongoingGlobalFlowtime / jobs.size
/**
* Returns the delay of the task for the node, eventually +∞
* The delay is the waiting time from the current time before the task is processed
*/
private def exPostDelay(task: Task, node: ComputingNode): Double = {
bundle(node).takeWhile(_ != task).foldLeft(0.0) { (sum, previousTask) => sum + simulatedCost.simulatedCost(stap.cost(previousTask, node), node) }
}
/**
* Returns the completion time of the task for the computing node
* Since we consider time-extended allocation,
* the completion time of a task depends on the release time of its job
* WARNING the cost unit is a millisecond
*/
private def exPostCompletionTime(task: Task, node: ComputingNode): Double = {
val duration = new Duration(stap.jobOf(task).releaseTime.toDateTime(), time.toDateTime())
val theTime =
duration.getMillis + exPostDelay(task, node) + simulatedCost.simulatedCost(stap.cost(task, node), node)
theTime
}
/**
* Returns the completion time of the task, eventually +∞
*/
private def exPostCompletionTime(task: Task): Double = {
if (node(task).isDefined) return exPostCompletionTime(task, node(task).get)
0.0
}
/**
* Returns the completion time of the job, i.e. its makespan
*/
private def exPostCompletionTime(job: Job): Double = job.tasks.foldLeft(0.0) {
(maxCompletionTime, task) => Math.max(exPostCompletionTime(task), maxCompletionTime)
}
/**
* Returns the mean globalFlowtime of the jobs
*/
private def exPostGlobalFlowtime: Double = stap.jobs.foldLeft(0.0)(
(sum: Double, job: Job) => sum + exPostCompletionTime(job)
)
/**
* Returns the mean localFlowtime of the jobs
*/
def exPostMeanGlobalFlowtime: Double = exPostGlobalFlowtime / stap.l
}
/**
......
......@@ -78,7 +78,7 @@ class ConsumptionExperiment(setting: ConsumptionSetting) extends Experiment[Cons
"09NbDelegatedTasks" -> setting.consumer.nbDelegatedTasks,
"10NbFirstStages" -> setting.consumer.nbFirstStages,
"11NbSecondStages" -> setting.consumer.nbSecondStages,
"12MeanSimulatedFlowtime" -> result.consumptions2allocation.realGlobalMeanFlowtime//result.simulatedMeanGlobalFlowtime
"12MeanSimulatedFlowtime" -> result.consumptions2allocation.exPostMeanGlobalFlowtime//.realGlobalMeanFlowtime//result.simulatedMeanGlobalFlowtime
))
if (result.isSound) outcome
else throw new RuntimeException(s"Consumer: the outcome\n $result\nis not sound for\n ${setting.allocation.stap}")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment