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

Made a analyse function

parent ad24e21c
No related branches found
No related tags found
No related merge requests found
......@@ -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,
......
......@@ -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;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment