mirror of
https://github.com/ClementTsang/bottom.git
synced 2025-07-22 13:14:40 +02:00
Mostly gotten cpu widget done.
This commit is contained in:
parent
96ef7dc106
commit
020fb83645
@ -1,9 +1,22 @@
|
|||||||
struct TimedCPUData<'a> {
|
use sysinfo::{ProcessorExt, System, SystemExt};
|
||||||
cpu_name: &'a str,
|
|
||||||
cpu_usage: f32,
|
pub struct TimedCPUData {
|
||||||
time: std::time::Duration,
|
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…
x
Reference in New Issue
Block a user