mirror of
https://github.com/nushell/nushell.git
synced 2024-11-22 08:23:24 +01:00
some tweaks to main for testing (#4862)
This commit is contained in:
parent
9db356e174
commit
6e69d40bb9
@ -27,8 +27,7 @@ which = "4"
|
||||
libc = "0.2"
|
||||
|
||||
[target.'cfg(target_os = "windows")'.dependencies]
|
||||
# winapi = { version = "0.3", features = ["handleapi", "minwindef", "psapi", "securitybaseapi", "tlhelp32", "winbase", "winnt"] }
|
||||
winapi = { version = "0.3.9", features = ["tlhelp32", "fileapi", "handleapi", "ifdef", "ioapiset", "minwindef", "pdh", "psapi", "synchapi", "sysinfoapi", "winbase", "winerror", "winioctl", "winnt", "oleauto", "wbemcli", "rpcdce", "combaseapi", "objidl", "powerbase", "netioapi", "lmcons", "lmaccess", "lmapibuf", "memoryapi", "shellapi", "std"] }
|
||||
winapi = { version = "0.3.9", features = ["tlhelp32", "fileapi", "handleapi", "ifdef", "ioapiset", "minwindef", "pdh", "psapi", "synchapi", "sysinfoapi", "winbase", "winerror", "winioctl", "winnt", "oleauto", "wbemcli", "rpcdce", "combaseapi", "objidl", "powerbase", "netioapi", "lmcons", "lmaccess", "lmapibuf", "memoryapi", "shellapi", "std", "securitybaseapi"] }
|
||||
chrono = "0.4"
|
||||
libc = "0.2"
|
||||
ntapi = "0.3"
|
||||
|
@ -1,17 +1,27 @@
|
||||
use std::thread::available_parallelism;
|
||||
use std::time::Duration;
|
||||
|
||||
fn main() {
|
||||
for proc in nu_system::collect_proc(Duration::from_millis(100), false) {
|
||||
// if proc.cpu_usage() > 0.1 {
|
||||
println!(
|
||||
"{} - {} - {} - {:.1} - {}M - {}M",
|
||||
proc.pid(),
|
||||
proc.name(),
|
||||
proc.status(),
|
||||
proc.cpu_usage(),
|
||||
proc.mem_size() / (1024 * 1024),
|
||||
proc.virtual_size() / (1024 * 1024),
|
||||
)
|
||||
// }
|
||||
let cores = match available_parallelism() {
|
||||
Ok(p) => p.get(),
|
||||
Err(_) => 1usize,
|
||||
};
|
||||
for run in 1..=10 {
|
||||
for proc in nu_system::collect_proc(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,
|
||||
)
|
||||
}
|
||||
}
|
||||
std::thread::sleep(std::time::Duration::from_millis(1000));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user