Skip to content
Snippets Groups Projects
Commit d7b02c2f authored by Blinningjr's avatar Blinningjr
Browse files

Implemented in interference time function

parent 8ecf733e
Branches
No related tags found
No related merge requests found
...@@ -76,6 +76,7 @@ fn main() { ...@@ -76,6 +76,7 @@ fn main() {
for t in &tasks { for t in &tasks {
block_time(t, &tasks, &ip, &tr); block_time(t, &tasks, &ip, &tr);
interference_time(t, &tasks);
} }
} }
...@@ -129,6 +130,7 @@ fn response_time(task: &Task) -> u32 { ...@@ -129,6 +130,7 @@ fn response_time(task: &Task) -> u32 {
//let r: u32 = block_time(task) + wcet(task) + interference_time(task); //let r: u32 = block_time(task) + wcet(task) + interference_time(task);
//println!("response_time {:?}", r); //println!("response_time {:?}", r);
//return r; //return r;
// TODO: Implement
return 0; return 0;
} }
...@@ -206,10 +208,32 @@ fn block_time(task: &Task, tasks: &Tasks, ip: &IdPrio, tr: &TaskResources) -> u3 ...@@ -206,10 +208,32 @@ fn block_time(task: &Task, tasks: &Tasks, ip: &IdPrio, tr: &TaskResources) -> u3
/* /*
* Calculates the interference (preemptions) to task t(I(t)). * Calculates the interference (preemptions) to task t(I(t)).
* I(t) * I(t)
*
* Note: I(t) = sum(C(h) * ceiling(Bp(t)/A(h))), forall tasks h, P(h) > P(t), where
* Bp(t) is the busy-period
*/ */
fn interference_time(task: &Task) -> u32 { fn interference_time(task: &Task, tasks: &Tasks) -> u32 {
// TODO: Implement let mut interference: u32 = 0;
return 0; for t in tasks {
if t.prio > task.prio {
interference += wcet(&t.trace) * (((busy_period(t) as f32) / (t.inter_arrival as f32)).ceil() as u32);
}
}
println!("interference_time {:?}", interference);
return interference;
}
/*
* Caclulates the busy period of task t(Bp(t)).
* Bp(t)
*
* Note: We can over approximate the busy period Bp(i) = D(i) (assuming the worst allowed busy-period).
* D(i) is the deadline of task i.
*/
fn busy_period(task: &Task) -> u32 {
return task.deadline;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment