fix trace seection when no instance was found, comments++
This commit is contained in:
parent
66a87835be
commit
d4ee679d0e
@ -268,7 +268,8 @@ pub type GraphMaximizerCorpusScheduler<CS, O> =
|
||||
MinimizerScheduler<CS, MaxTimeFavFactor<<CS as UsesState>::State>,STGNodeMetadata,O>;
|
||||
|
||||
// AI generated, human verified
|
||||
fn count_occurrences<T>(vec: &Vec<T>) -> HashMap<&T, usize>
|
||||
/// Count the occurrences of each element in a vector, assumes the vector is sorted
|
||||
fn count_occurrences_sorted<T>(vec: &Vec<T>) -> HashMap<&T, usize>
|
||||
where
|
||||
T: PartialEq + Eq + Hash + Clone,
|
||||
{
|
||||
@ -550,7 +551,11 @@ where
|
||||
let t = observer.last_trace.iter().filter(|x| x.start_tick < worst_instance.1 && x.end_tick > worst_instance.0 ).cloned().collect();
|
||||
StgFeedback::abbs_in_exec_order(&t)
|
||||
} else {
|
||||
if observer.select_task.is_none() { // if nothing was selected, just take the whole trace, otherwise there is nothing interesting here
|
||||
StgFeedback::abbs_in_exec_order(&observer.last_trace)
|
||||
} else {
|
||||
Vec::new()
|
||||
}
|
||||
}
|
||||
};
|
||||
if INTEREST_AGGREGATE || INTEREST_ABBPATH {
|
||||
@ -572,8 +577,8 @@ where
|
||||
if INTEREST_AGGREGATE {
|
||||
// aggegation by sorting, order of states is not relevant
|
||||
let mut _tmp = tmp.clone();
|
||||
_tmp.sort();
|
||||
let counts = count_occurrences(&_tmp);
|
||||
_tmp.sort(); // use sort+count, because we need the sorted trace anyways
|
||||
let counts = count_occurrences_sorted(&_tmp);
|
||||
let mut top_indices = Vec::new();
|
||||
for (k,c) in counts {
|
||||
if let Some(reference) = feedbackstate.worst_abb_exec_count.get_mut(k) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user