fixup graph cycles
This commit is contained in:
parent
d179343a63
commit
5648255542
@ -33,6 +33,7 @@ pub struct RawFreeRTOSSystemState {
|
|||||||
current_tcb: TCB_t,
|
current_tcb: TCB_t,
|
||||||
prio_ready_lists: [freertos::List_t; NUM_PRIOS],
|
prio_ready_lists: [freertos::List_t; NUM_PRIOS],
|
||||||
delay_list: freertos::List_t,
|
delay_list: freertos::List_t,
|
||||||
|
delay_list_overflow: freertos::List_t,
|
||||||
dumping_ground: HashMap<u32,freertos::rtos_struct>,
|
dumping_ground: HashMap<u32,freertos::rtos_struct>,
|
||||||
input_counter: u32,
|
input_counter: u32,
|
||||||
last_pc: Option<u64>,
|
last_pc: Option<u64>,
|
||||||
@ -41,7 +42,7 @@ pub struct RawFreeRTOSSystemState {
|
|||||||
static mut CURRENT_SYSTEMSTATE_VEC: Vec<RawFreeRTOSSystemState> = vec![];
|
static mut CURRENT_SYSTEMSTATE_VEC: Vec<RawFreeRTOSSystemState> = vec![];
|
||||||
|
|
||||||
/// A reduced version of freertos::TCB_t
|
/// A reduced version of freertos::TCB_t
|
||||||
#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
|
#[derive(Debug, Default, Serialize, Deserialize, Clone)]
|
||||||
pub struct RefinedTCB {
|
pub struct RefinedTCB {
|
||||||
pub task_name: String,
|
pub task_name: String,
|
||||||
pub priority: u32,
|
pub priority: u32,
|
||||||
@ -51,6 +52,15 @@ pub struct RefinedTCB {
|
|||||||
notify_state: u8,
|
notify_state: u8,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl PartialEq for RefinedTCB {
|
||||||
|
fn eq(&self, other: &Self) -> bool {
|
||||||
|
self.task_name == other.task_name &&
|
||||||
|
self.priority == other.priority &&
|
||||||
|
self.base_priority == other.base_priority
|
||||||
|
// && self.notify_state == other.notify_state
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Hash for RefinedTCB {
|
impl Hash for RefinedTCB {
|
||||||
fn hash<H: Hasher>(&self, state: &mut H) {
|
fn hash<H: Hasher>(&self, state: &mut H) {
|
||||||
self.task_name.hash(state);
|
self.task_name.hash(state);
|
||||||
@ -107,7 +117,8 @@ pub struct RefinedFreeRTOSSystemState {
|
|||||||
impl PartialEq for RefinedFreeRTOSSystemState {
|
impl PartialEq for RefinedFreeRTOSSystemState {
|
||||||
fn eq(&self, other: &Self) -> bool {
|
fn eq(&self, other: &Self) -> bool {
|
||||||
self.current_task == other.current_task && self.ready_list_after == other.ready_list_after &&
|
self.current_task == other.current_task && self.ready_list_after == other.ready_list_after &&
|
||||||
self.last_pc == other.last_pc
|
self.delay_list_after == other.delay_list_after
|
||||||
|
// && self.last_pc == other.last_pc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,24 +134,25 @@ fn refine_system_states(input: &mut Vec<RawFreeRTOSSystemState>) -> Vec<RefinedF
|
|||||||
for j in collector.iter() {let _ = iteration_counts.try_insert(j.task_name.clone(), 1);}
|
for j in collector.iter() {let _ = iteration_counts.try_insert(j.task_name.clone(), 1);}
|
||||||
for j in delay_list.iter() {let _ = iteration_counts.try_insert(j.task_name.clone(), 0);}
|
for j in delay_list.iter() {let _ = iteration_counts.try_insert(j.task_name.clone(), 0);}
|
||||||
|
|
||||||
|
// Ensure that async events appear in the delay list, so we the counts in all states
|
||||||
|
if let Some(lst) = ret.last() {
|
||||||
|
for a in lst.delay_list_after.iter().filter(|x| x.0.task_name.contains("async")) {
|
||||||
|
if delay_list.iter().find(|x| (*x).task_name==a.0.task_name).is_none() && cur.task_name != a.0.task_name {
|
||||||
|
delay_list.push(a.0.clone());
|
||||||
|
delay_list.sort_by(|a,b| a.task_name.cmp(&b.task_name));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// increase when:
|
// increase when:
|
||||||
// normal current and delayed afterwards
|
// current and delayed afterwards
|
||||||
// async current and not previous
|
if let Some(_) = delay_list.iter().find(|x| (*x).task_name==cur.task_name) {
|
||||||
if cur.task_name.contains("async") {
|
|
||||||
if let Some(l) = ret.last() {
|
|
||||||
if l.current_task.0.task_name != cur.task_name {
|
|
||||||
*iteration_counts.get_mut(&cur.task_name).unwrap()+=1;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
*iteration_counts.get_mut(&cur.task_name).unwrap()+=1;
|
|
||||||
}
|
|
||||||
} else if let Some(_) = delay_list.iter().find(|x| (*x).task_name==cur.task_name) {
|
|
||||||
*iteration_counts.get_mut(&cur.task_name).unwrap()+=1;
|
*iteration_counts.get_mut(&cur.task_name).unwrap()+=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
let collector = collector.into_iter().map(|x| {let t = *iteration_counts.get(&x.task_name).unwrap_or(&1); (x, t)}).collect();
|
let collector = collector.into_iter().map(|x| {let t = *iteration_counts.get(&x.task_name).unwrap_or(&1); (x, t)}).collect();
|
||||||
let filter_delay = delay_list.into_iter().filter(|x| !x.task_name.contains("async"));
|
// let filter_delay = delay_list.into_iter().filter(|x| !x.task_name.contains("async"));
|
||||||
let delay_list : Vec<(RefinedTCB, u32)> = filter_delay.map(|x| {let t = *iteration_counts.get(&x.task_name).unwrap_or(&0); (x, t)}).collect();
|
let delay_list : Vec<(RefinedTCB, u32)> = delay_list.into_iter().map(|x| {let t = *iteration_counts.get(&x.task_name).unwrap_or(&0); (x, t)}).collect();
|
||||||
let t = *iteration_counts.get(&cur.task_name).unwrap_or(&1);
|
let t = *iteration_counts.get(&cur.task_name).unwrap_or(&1);
|
||||||
// We don't care about the order
|
// We don't care about the order
|
||||||
ret.push(RefinedFreeRTOSSystemState {
|
ret.push(RefinedFreeRTOSSystemState {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user