rust sysinfo库 获取windows 系统进程列表

180it 2024-10-09 PM 82℃ 0条
[dependencies]
sysinfo = "0.32.0"

use sysinfo::{
    Components, Disks, Networks, System,
};

fn main() {

// Please note that we use "new_all" to ensure that all lists of
// CPUs and processes are filled!
let mut sys = System::new_all();

// First we update all information of our `System` struct.
sys.refresh_all();


// Display processes ID, name na disk usage:
for (pid, process) in sys.processes() {
    println!("[{pid}] {:?}", process.name());
}


}
支付宝打赏支付宝打赏 微信打赏微信打赏

如果文章或资源对您有帮助,欢迎打赏作者。一路走来,感谢有您!

标签: none

rust sysinfo库 获取windows 系统进程列表