diff --git a/srp_analysis/src/main.rs b/srp_analysis/src/main.rs index c329e35a0df7540a406425aa4a79bf7c6751d0ab..e7b86406ca7f9419da4aee716677114918d927f3 100644 --- a/srp_analysis/src/main.rs +++ b/srp_analysis/src/main.rs @@ -174,9 +174,7 @@ fn blocking(task: &Task, tasks: &Tasks, ip: &IdPrio, tr: &TaskResources) -> u32 lower_prio_tasks.remove(&t.id); } } - // println!("{:?}", lower_prio_tasks); if lower_prio_tasks.len() == 0 { - // println!("0"); return 0; } /* Finding longest blocking */ @@ -186,13 +184,11 @@ fn blocking(task: &Task, tasks: &Tasks, ip: &IdPrio, tr: &TaskResources) -> u32 let mut current_block = 0; // Iterate through current task resources for r1 in resources { - // println!("Resource 1: {}, Resources 1 {:?}", r1, resources); // Iterate through lower prio tasks for t_id in &lower_prio_tasks { let mut lower_prio_task_resources = &tr[t_id]; // Iterate through lower prio task resources for r2 in lower_prio_task_resources { - // println!("Resource 2: {}, Resources 2 {:?}", r2, lower_prio_task_resources); // When current task use the same resource as a task if r1 == r2 { // Takes forward the blocking task @@ -205,8 +201,6 @@ fn blocking(task: &Task, tasks: &Tasks, ip: &IdPrio, tr: &TaskResources) -> u32 if max_block < current_block { max_block = current_block; } - // println!("1: start:{}, end:{}", inner.start, inner.end); - // println!("For id {} and resource 2 {}", t_id, r2) } // Iterate through second layer for inner2 in &inner.inner { @@ -215,8 +209,13 @@ fn blocking(task: &Task, tasks: &Tasks, ip: &IdPrio, tr: &TaskResources) -> u32 if max_block < current_block { max_block = current_block; } - // println!("2: start:{}, end:{}", inner2.start, inner2.end); - // println!("For id {} and resource 2 {}", t_id, r2) + } + // Iterate through third layer + for inner3 in &inner2.inner { + current_block = inner2.end.wrapping_sub(inner2.start); + if max_block < current_block { + max_block = current_block; + } } } } @@ -226,6 +225,5 @@ fn blocking(task: &Task, tasks: &Tasks, ip: &IdPrio, tr: &TaskResources) -> u32 } } } - // println!("{}", max_block); return max_block; } \ No newline at end of file