Fix compilation with sys_stat feature

This commit is contained in:
Jeremy Soller
2025-10-12 15:45:50 -06:00
parent 0931a7f49f
commit c9653525a0
2 changed files with 7 additions and 5 deletions
+3 -3
View File
@@ -160,7 +160,7 @@ pub fn add_context_switch() {
/// Get the number of context switches.
#[cfg(feature = "sys_stat")]
pub fn get_context_switch_count() -> u64 {
pub fn get_context_switch_count() -> usize {
CONTEXT_SWITCH_COUNT.load(Ordering::Relaxed)
}
@@ -176,13 +176,13 @@ pub fn add_context() {
/// Get the number of contexts created.
#[cfg(feature = "sys_stat")]
pub fn get_contexts_count() -> u64 {
pub fn get_contexts_count() -> usize {
CONTEXTS_COUNT.load(Ordering::Relaxed)
}
/// Get the count of each interrupt.
#[cfg(feature = "sys_stat")]
pub fn irq_counts() -> Vec<u64> {
pub fn irq_counts() -> Vec<usize> {
IRQ_COUNT
.iter()
.map(|count| count.load(Ordering::Relaxed))
+4 -2
View File
@@ -73,10 +73,12 @@ fn get_contexts_stats(token: &mut CleanLockToken) -> (u64, u64) {
let mut running = 0;
let mut blocked = 0;
let statuses = contexts(token.token())
let mut contexts = contexts(token.token());
let (contexts, mut token) = contexts.token_split();
let statuses = contexts
.iter()
.filter_map(ContextRef::upgrade)
.map(|context| context.read_arc().status.clone())
.map(|context| context.read(token.token()).status.clone())
.collect::<Vec<_>>();
for status in statuses {