mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-16 08:38:26 +00:00
kernel: print running total of memory usage size
Print the total of all processes in the system. Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
7087fbe823
commit
1b7ee904b2
1 changed files with 6 additions and 2 deletions
|
|
@ -176,20 +176,24 @@ pub fn irq(_irq_number: usize, _arg: *mut usize) {
|
|||
}
|
||||
'r' => {
|
||||
println!("RAM usage:");
|
||||
let mut total_bytes = 0;
|
||||
crate::services::SystemServices::with(|system_services| {
|
||||
crate::mem::MemoryManager::with(|mm| {
|
||||
for process in &system_services.processes {
|
||||
if !process.free() {
|
||||
let bytes_used = mm.ram_used_by(process.pid);
|
||||
total_bytes += bytes_used;
|
||||
println!(
|
||||
" PID {}: {:>4} k {}",
|
||||
" PID {:>3}: {:>4} k {}",
|
||||
process.pid,
|
||||
mm.ram_used_by(process.pid) / 1024,
|
||||
bytes_used / 1024,
|
||||
system_services.process_name(process.pid).unwrap_or("")
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
println!("{} k total", total_bytes / 1024);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue