forked from extern/nushell
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"
|
libc = "0.2"
|
||||||
|
|
||||||
[target.'cfg(target_os = "windows")'.dependencies]
|
[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", "securitybaseapi"] }
|
||||||
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"] }
|
|
||||||
chrono = "0.4"
|
chrono = "0.4"
|
||||||
libc = "0.2"
|
libc = "0.2"
|
||||||
ntapi = "0.3"
|
ntapi = "0.3"
|
||||||
|
@ -1,17 +1,27 @@
|
|||||||
|
use std::thread::available_parallelism;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
for proc in nu_system::collect_proc(Duration::from_millis(100), false) {
|
let cores = match available_parallelism() {
|
||||||
// if proc.cpu_usage() > 0.1 {
|
Ok(p) => p.get(),
|
||||||
println!(
|
Err(_) => 1usize,
|
||||||
"{} - {} - {} - {:.1} - {}M - {}M",
|
};
|
||||||
proc.pid(),
|
for run in 1..=10 {
|
||||||
proc.name(),
|
for proc in nu_system::collect_proc(Duration::from_millis(100), false) {
|
||||||
proc.status(),
|
if proc.cpu_usage() > 0.00001 {
|
||||||
proc.cpu_usage(),
|
println!(
|
||||||
proc.mem_size() / (1024 * 1024),
|
"{} - {} - {} - {} - {:.2}% - {}M - {}M - {} procs",
|
||||||
proc.virtual_size() / (1024 * 1024),
|
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