* Note: We can compute the total CPU request (or load factor), as Ltot = sum(L(T)), T being the set of tasks.
*/
fntotal_load_factor(tasks:&Tasks)->f32{
letmutltot:f32=0.0;
fortintasks{
ltot+=cpu_load(t);
}
returnltot;
}
/*
* Calculates the cpu load of a task(L(t) where t is a task).
*
* Note: Each task t has a WCET C(t) and given (assumed) inter-arrival time A(t). The CPU request (or load) inferred by a task is L(t) = C(t)/A(t). Ask yourself, what is the consequence of C(t) > A(t)?
*/
fncpu_load(task:&Task)->f32{
return(wcet(task)asf32)/(task.inter_arrivalasf32)
}
/*
* Worst case execution time(WCET) of a task t(C(t)).