diff --git a/rust/scx_utils/src/topology.rs b/rust/scx_utils/src/topology.rs index 59401c0ed..2c36189ee 100644 --- a/rust/scx_utils/src/topology.rs +++ b/rust/scx_utils/src/topology.rs @@ -506,7 +506,7 @@ fn create_insert_cpu( core_id: *core_id, llc_id: *llc_id, node_id: node.id, - package_id: package_id, + package_id, }), ); diff --git a/scheds/rust/scx_layered/src/layer_core_growth.rs b/scheds/rust/scx_layered/src/layer_core_growth.rs index 7c9febb3d..399e48798 100644 --- a/scheds/rust/scx_layered/src/layer_core_growth.rs +++ b/scheds/rust/scx_layered/src/layer_core_growth.rs @@ -133,7 +133,7 @@ struct LayerCoreOrderGenerator<'a> { impl<'a> LayerCoreOrderGenerator<'a> { fn rotate_layer_offset(&self, vec: &'a mut Vec) -> &Vec { let num_cores = self.topo.all_cores.len(); - let chunk = num_cores.div_ceil(self.layer_specs.len()) as usize; + let chunk = num_cores.div_ceil(self.layer_specs.len()); vec.rotate_right((chunk * self.layer_idx).min(num_cores)); vec } @@ -156,7 +156,7 @@ impl<'a> LayerCoreOrderGenerator<'a> { self.rotate_layer_offset(&mut core_order); for node in self.topo.nodes.values() { - for (_, llc) in &node.llcs { + for llc in node.llcs.values() { let llc_cores = llc.cores.len(); let rot = rot_by(llc_cores + (self.layer_idx << 1), llc_cores); if is_left { diff --git a/scheds/rust/scx_layered/src/main.rs b/scheds/rust/scx_layered/src/main.rs index 421366e47..da886b5f9 100644 --- a/scheds/rust/scx_layered/src/main.rs +++ b/scheds/rust/scx_layered/src/main.rs @@ -876,7 +876,7 @@ impl Stats { .layers .iter() .take(self.nr_layers) - .map(|layer| layer.slice_ns / 1000 as u64) + .map(|layer| layer.slice_ns / 1000_u64) .collect(); let cur_layer_usages = Self::read_layer_usages(&cpu_ctxs, self.nr_layers); @@ -969,7 +969,7 @@ impl Layer { if cpus_range.0 > cpus_range.1 || cpus_range.1 == 0 { bail!("invalid cpus_range {:?}", cpus_range); } - if nodes.len() == 0 && llcs.len() == 0 { + if nodes.is_empty() && llcs.is_empty() { allowed_cpus.set_all(); } else { // build up the cpus bitset @@ -1008,21 +1008,21 @@ impl Layer { common: LayerCommon { nodes, llcs, .. }, .. } => { - if nodes.len() == 0 && llcs.len() == 0 { + if nodes.is_empty() && llcs.is_empty() { allowed_cpus.set_all(); } else { // build up the cpus bitset for (node_id, node) in &topo.nodes { // first do the matching for nodes if nodes.contains(node_id) { - for (&id, _cpu) in &node.all_cpus { + for &id in node.all_cpus.keys() { allowed_cpus.set_cpu(id)?; } } // next match on any LLCs for (llc_id, llc) in &node.llcs { if llcs.contains(llc_id) { - for (&id, _cpu) in &llc.all_cpus { + for &id in llc.all_cpus.keys() { allowed_cpus.set_cpu(id)?; } } diff --git a/tools/scxtop/src/app.rs b/tools/scxtop/src/app.rs index 893f7a2da..e5c6c6516 100644 --- a/tools/scxtop/src/app.rs +++ b/tools/scxtop/src/app.rs @@ -167,7 +167,7 @@ impl<'a> App<'a> { active_perf_events, available_events: default_events, available_perf_events_list, - num_perf_events: num_perf_events, + num_perf_events, events_list_size: 1, selected_event: 0, non_hw_event_active: false, @@ -583,8 +583,7 @@ impl<'a> App<'a> { let llc_iter = self .llc_data .values() - .map(|llc_data| llc_data.event_data_immut(self.active_event.event.clone())) - .flatten() + .flat_map(|llc_data| llc_data.event_data_immut(self.active_event.event.clone())) .collect::>(); let stats = VecStats::new(&llc_iter, true, true, true, None); @@ -683,8 +682,7 @@ impl<'a> App<'a> { let node_iter = self .node_data .values() - .map(|node_data| node_data.event_data_immut(self.active_event.event.clone())) - .flatten() + .flat_map(|node_data| node_data.event_data_immut(self.active_event.event.clone())) .collect::>(); let stats = VecStats::new(&node_iter, true, true, true, None); @@ -918,8 +916,7 @@ impl<'a> App<'a> { let dsq_global_iter = self .dsq_data .values() - .map(|dsq_data| dsq_data.event_data_immut(event.clone())) - .flatten() + .flat_map(|dsq_data| dsq_data.event_data_immut(event.clone())) .collect::>(); let stats = VecStats::new(&dsq_global_iter, true, true, true, None); let sample_rate = self.skel.maps.data_data.sample_rate; @@ -993,8 +990,7 @@ impl<'a> App<'a> { let dsq_global_iter = self .dsq_data .values() - .map(|dsq_data| dsq_data.event_data_immut(event.clone())) - .flatten() + .flat_map(|dsq_data| dsq_data.event_data_immut(event.clone())) .collect::>(); let stats = VecStats::new(&dsq_global_iter, true, true, true, None); let sample_rate = self.skel.maps.data_data.sample_rate; @@ -1066,8 +1062,7 @@ impl<'a> App<'a> { .dsq_data .iter() .filter(|(_dsq_id, event_data)| event_data.data.contains_key(&event.clone())) - .map(|(_dsq_id, event_data)| event_data.event_data_immut(event.clone())) - .flatten() + .flat_map(|(_dsq_id, event_data)| event_data.event_data_immut(event.clone())) .collect::>(); let stats = VecStats::new(&vtime_global_iter, true, true, true, None); @@ -1136,8 +1131,7 @@ impl<'a> App<'a> { let dsq_global_iter = self .dsq_data .values() - .map(|dsq_data| dsq_data.event_data_immut(event.clone())) - .flatten() + .flat_map(|dsq_data| dsq_data.event_data_immut(event.clone())) .collect::>(); let stats = VecStats::new(&dsq_global_iter, true, true, true, None); @@ -1259,8 +1253,9 @@ impl<'a> App<'a> { .cpu_data .values() .filter(|cpu_data| cpu_data.node == node.id) - .map(|cpu_data| cpu_data.event_data_immut(self.active_event.event.clone())) - .flatten() + .flat_map(|cpu_data| { + cpu_data.event_data_immut(self.active_event.event.clone()) + }) .collect::>(); let stats = VecStats::new(&node_iter, true, true, true, None); @@ -1366,8 +1361,9 @@ impl<'a> App<'a> { .cpu_data .values() .filter(|cpu_data| cpu_data.node == node.id) - .map(|cpu_data| cpu_data.event_data_immut(self.active_event.event.clone())) - .flatten() + .flat_map(|cpu_data| { + cpu_data.event_data_immut(self.active_event.event.clone()) + }) .collect::>(); let stats = VecStats::new(&node_iter, true, true, true, None);