Mostly gotten cpu widget done.
This commit is contained in:
parent
96ef7dc106
commit
020fb83645
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue