2022-01-14 07:20:53 +01:00
|
|
|
fn main() {
|
2022-09-01 02:34:26 +02:00
|
|
|
#[cfg(any(
|
|
|
|
target_os = "android",
|
|
|
|
target_os = "linux",
|
|
|
|
target_os = "macos",
|
|
|
|
target_os = "windows"
|
|
|
|
))]
|
|
|
|
{
|
2023-01-24 12:23:42 +01:00
|
|
|
let cores = std::thread::available_parallelism()
|
|
|
|
.map(|p| p.get())
|
|
|
|
.unwrap_or(1);
|
2022-09-01 02:34:26 +02:00
|
|
|
for run in 1..=10 {
|
|
|
|
for proc in nu_system::collect_proc(std::time::Duration::from_millis(100), false) {
|
|
|
|
if proc.cpu_usage() > 0.00001 {
|
|
|
|
println!(
|
|
|
|
"{} - {} - {} - {} - {:.2}% - {}M - {}M - {} procs",
|
|
|
|
run,
|
|
|
|
proc.pid(),
|
|
|
|
proc.name(),
|
|
|
|
proc.status(),
|
|
|
|
proc.cpu_usage() / cores as f64,
|
|
|
|
proc.mem_size() / (1024 * 1024),
|
|
|
|
proc.virtual_size() / (1024 * 1024),
|
|
|
|
cores,
|
|
|
|
)
|
|
|
|
}
|
2022-03-17 17:32:54 +01:00
|
|
|
}
|
2022-09-01 02:34:26 +02:00
|
|
|
std::thread::sleep(std::time::Duration::from_millis(1000));
|
2022-03-17 17:32:54 +01:00
|
|
|
}
|
2022-01-14 07:20:53 +01:00
|
|
|
}
|
|
|
|
}
|