Mostly gotten cpu widget done.

This commit is contained in:
ClementTsang 2019-09-06 22:46:44 -04:00
parent 96ef7dc106
commit 020fb83645
1 changed files with 19 additions and 6 deletions

View File

@ -1,9 +1,22 @@
struct TimedCPUData<'a> {
cpu_name: &'a str,
cpu_usage: f32,
time: std::time::Duration,
use sysinfo::{ProcessorExt, System, SystemExt};
pub struct TimedCPUData {
pub cpu_name : Box<str>,
pub cpu_usage : u32,
pub time : std::time::SystemTime,
}
fn get_timestamped_cpu_data() {}
pub fn get_cpu_data_list(sys : &System) -> Vec<TimedCPUData> {
let cpu_data = sys.get_processor_list();
let mut cpu_vec = Vec::new();
pub fn get_cpu_data_list() {}
for cpu in cpu_data {
cpu_vec.push(TimedCPUData {
cpu_name : Box::from(cpu.get_name()),
cpu_usage : (cpu.get_cpu_usage() * 100_f32).ceil() as u32,
time : std::time::SystemTime::now(),
})
}
cpu_vec
}