diff --git a/srp_analysis/src/common.rs b/srp_analysis/src/common.rs index d6f92b1c405f22fe9cccaba059151492354431e8..48cebacf4e28f43d3a4f51dc2b12199bd4dd838c 100644 --- a/srp_analysis/src/common.rs +++ b/srp_analysis/src/common.rs @@ -2,7 +2,7 @@ use std::collections::{HashMap, HashSet}; // common data structures -#[derive(Debug)] +#[derive(Debug, Clone)] pub struct Task { pub id: String, pub prio: u8, @@ -11,8 +11,7 @@ pub struct Task { pub trace: Trace, } -//#[derive(Debug, Clone)] -#[derive(Debug)] +#[derive(Debug, Clone)] pub struct Trace { pub id: String, pub start: u32, diff --git a/srp_analysis/src/main.rs b/srp_analysis/src/main.rs index 03bb3771629543b0c41475d6df53dee8bd8e265c..8ba20199055d7d210f766bda03ba7391ababf1b6 100644 --- a/srp_analysis/src/main.rs +++ b/srp_analysis/src/main.rs @@ -74,9 +74,8 @@ fn main() { println!("ip: {:?}", ip); println!("tr: {:?}", tr); - for t in &tasks { - response_time(t, &tasks, &ip, &tr); - } + let analysis = analyse(&tasks, &ip, &tr); + println!("Analysis {:#?}", analysis); } @@ -234,3 +233,21 @@ fn busy_period(task: &Task) -> u32 { } +/* + * Analyse tasks. + * + * Note: Finally, make a function that iterates over the task set and returns a vector with containing: +Vec<Task, R(t), C(t), B(t), I(t)>. Just a simple println! of that vector gives the essential information on the analysis. + */ +fn analyse(tasks: &Tasks, ip: &IdPrio, tr: &TaskResources) -> Vec<(Task, u32, u32, u32, u32)> { + let mut analysis: Vec<(Task, u32, u32, u32, u32)> = vec!(); + for t in tasks { + let r_t = response_time(t, tasks, ip, tr); + let c_t = wcet(&t.trace); + let b_t = block_time(t, tasks, ip, tr); + let i_t = interference_time(t, tasks); + analysis.push((t.clone(), r_t, c_t, b_t, i_t)); + } + return analysis; +} +