fix release-detection for api -> isr -> app, fix crash on empty trace
This commit is contained in:
parent
6902e21c6a
commit
e6ec643781
@ -341,19 +341,22 @@ fn get_releases(trace: &Vec<ExecInterval>, states: &HashMap<u64, ReducedFreeRTOS
|
||||
}
|
||||
// Release driven by an API call. This produces a lot of false positives, as a job may block multiple times per instance. Despite this, aperiodic jobs not be modeled otherwise. If we assume the first release is the real one, we can filter out the rest.
|
||||
if i.start_capture.0 == CaptureEvent::APIStart {
|
||||
let api_start = states.get(&i.start_state).expect("State not found");
|
||||
let api_end = {
|
||||
let api_start_state = states.get(&i.start_state).expect("State not found");
|
||||
let api_end_state = {
|
||||
let mut end_index = _n;
|
||||
for n in (_n)..trace.len() {
|
||||
if trace[n].end_capture.0 == CaptureEvent::APIEnd || trace[n].end_capture.0 == CaptureEvent::End {
|
||||
end_index = n;
|
||||
break;
|
||||
} else if n > _n && trace[n].level == 0 { // API Start -> ISR Start+End -> APP Continue
|
||||
end_index = n-1; // any return to a regular app block is a fair point of comparison for the ready list, because scheduling has been performed
|
||||
break;
|
||||
}
|
||||
};
|
||||
states.get(&trace[end_index].end_state).expect("State not found")
|
||||
};
|
||||
api_end.ready_list_after.iter().for_each(|x| {
|
||||
if x.task_name != api_start.current_task.task_name && !api_start.ready_list_after.iter().any(|y| x.task_name == y.task_name) {
|
||||
api_end_state.ready_list_after.iter().for_each(|x| {
|
||||
if x.task_name != api_start_state.current_task.task_name && !api_start_state.ready_list_after.iter().any(|y| x.task_name == y.task_name) {
|
||||
ret.push((i.end_tick, x.task_name.clone()));
|
||||
// eprintln!("Task {} released by API call at {:.1}ms", x.task_name, crate::time::clock::tick_to_time(i.end_tick).as_micros() as f32/1000.0);
|
||||
}
|
||||
|
@ -443,6 +443,9 @@ impl StgFeedback {
|
||||
let mut return_edge_trace = vec![];
|
||||
let mut interesting = false;
|
||||
let mut updated = false;
|
||||
if trace.is_empty() {
|
||||
return (return_node_trace, return_edge_trace, interesting, updated);
|
||||
}
|
||||
let mut instance_time = execinterval_to_abb_instances(trace, read_trace);
|
||||
// add all missing state+abb combinations to the graph
|
||||
for (_i,interval) in trace.iter().enumerate() { // Iterate intervals
|
||||
|
Loading…
x
Reference in New Issue
Block a user