in resctl-bench/src/bench/iocost_tune.rs [2140:2206]
fn test_bench_iocost_tune_datasel_sort_and_group() {
let mut sels = vec![
DataSel::RLat("99".to_owned(), "90".to_owned()),
DataSel::RLat("90".to_owned(), "99".to_owned()),
DataSel::MOF,
DataSel::WorkCsv,
DataSel::RLat("90".to_owned(), "90".to_owned()),
DataSel::WLat("90".to_owned(), "90".to_owned()),
DataSel::RLat("99".to_owned(), "99".to_owned()),
DataSel::Missing,
DataSel::LatImp,
DataSel::Isol,
DataSel::WLat("99".to_owned(), "90".to_owned()),
DataSel::WLat("99".to_owned(), "99".to_owned()),
];
sels.sort();
let grouped = DataSel::group(sels);
assert_eq!(
grouped,
vec![
vec![
DataSel::MOF,
DataSel::Isol,
DataSel::LatImp,
DataSel::WorkCsv,
DataSel::Missing,
],
vec![
DataSel::RLat("90".to_owned(), "90".to_owned()),
DataSel::RLat("99".to_owned(), "90".to_owned()),
],
vec![
DataSel::RLat("90".to_owned(), "99".to_owned()),
DataSel::RLat("99".to_owned(), "99".to_owned()),
],
vec![
DataSel::WLat("90".to_owned(), "90".to_owned()),
DataSel::WLat("99".to_owned(), "90".to_owned()),
],
vec![DataSel::WLat("99".to_owned(), "99".to_owned()),],
]
);
let merged = DataSel::align_and_merge_groups(grouped, 6);
assert_eq!(
merged,
vec![
vec![
DataSel::MOF,
DataSel::Isol,
DataSel::LatImp,
DataSel::WorkCsv,
DataSel::Missing,
],
vec![
DataSel::RLat("90".to_owned(), "90".to_owned()),
DataSel::RLat("99".to_owned(), "90".to_owned()),
DataSel::RLat("90".to_owned(), "99".to_owned()),
DataSel::RLat("99".to_owned(), "99".to_owned()),
DataSel::WLat("90".to_owned(), "90".to_owned()),
DataSel::WLat("99".to_owned(), "90".to_owned()),
],
vec![DataSel::WLat("99".to_owned(), "99".to_owned()),],
]
);
}