deps: update sysinfo to 0.26.2 (#806)
* deps: update sysinfo to 0.26.2 This dependency update has some nice things in store for us: - MacOS M1 temperature support - Bevy of bug fixes * update documentation * some fixes
This commit is contained in:
parent
a427a9d2f2
commit
c6c7fb3a30
|
@ -1536,9 +1536,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "sysinfo"
|
||||
version = "0.23.13"
|
||||
version = "0.26.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3977ec2e0520829be45c8a2df70db2bf364714d8a748316a10c3c35d4d2b01c9"
|
||||
checksum = "4ae2421f3e16b3afd4aa692d23b83d0ba42ee9b0081d5deeb7d21428d7195fb1"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"core-foundation-sys 0.8.3",
|
||||
|
|
|
@ -74,7 +74,7 @@ once_cell = "1.5.2"
|
|||
regex = "1.5.5"
|
||||
serde = { version = "1.0.136", features = ["derive"] }
|
||||
starship-battery = { version = "0.7.9", optional = true }
|
||||
sysinfo = "0.23.10"
|
||||
sysinfo = "0.26.2"
|
||||
thiserror = "1.0.30"
|
||||
time = { version = "0.3.9", features = ["formatting", "macros"] }
|
||||
toml = "0.5.9"
|
||||
|
|
|
@ -13,4 +13,4 @@ Unofficially supported platforms known to compile/work:
|
|||
|
||||
## Known problems
|
||||
|
||||
- ARM-based macOS devices currently doesn't support the temperature widget. This should hopefully be fixed soon.
|
||||
None at the moment.
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
use std::collections::VecDeque;
|
||||
|
||||
use sysinfo::{LoadAvg, ProcessorExt, System, SystemExt};
|
||||
use sysinfo::{LoadAvg, System, SystemExt};
|
||||
|
||||
use super::{CpuData, CpuHarvest, PastCpuTotal, PastCpuWork};
|
||||
use crate::app::data_harvester::cpu::LoadAvgHarvest;
|
||||
|
@ -25,7 +25,7 @@ pub async fn get_cpu_data_list(
|
|||
.collect();
|
||||
|
||||
if show_average_cpu {
|
||||
let cpu = sys.global_processor_info();
|
||||
let cpu = sys.global_cpu_info();
|
||||
|
||||
cpu_deque.push_front(CpuData {
|
||||
cpu_prefix: "AVG".to_string(),
|
||||
|
|
|
@ -70,7 +70,7 @@ pub struct ProcessHarvest {
|
|||
|
||||
/// This is the *effective* user ID of the process. This is only used on Unix platforms.
|
||||
#[cfg(target_family = "unix")]
|
||||
pub uid: libc::uid_t,
|
||||
pub uid: Option<libc::uid_t>,
|
||||
|
||||
/// This is the process' user. This is only used on Unix platforms.
|
||||
#[cfg(target_family = "unix")]
|
||||
|
|
|
@ -219,7 +219,7 @@ fn read_proc(
|
|||
total_read_bytes,
|
||||
total_write_bytes,
|
||||
process_state,
|
||||
uid,
|
||||
uid: Some(uid),
|
||||
user: user_table
|
||||
.get_uid_to_username_mapping(uid)
|
||||
.map(Into::into)
|
||||
|
|
|
@ -4,7 +4,7 @@ use std::collections::HashMap;
|
|||
use std::io;
|
||||
|
||||
use super::ProcessHarvest;
|
||||
use sysinfo::{PidExt, ProcessExt, ProcessStatus, ProcessorExt, System, SystemExt};
|
||||
use sysinfo::{CpuExt, PidExt, ProcessExt, ProcessStatus, System, SystemExt};
|
||||
|
||||
use crate::data_harvester::processes::UserTable;
|
||||
|
||||
|
@ -14,8 +14,8 @@ pub fn get_process_data(
|
|||
) -> crate::utils::error::Result<Vec<ProcessHarvest>> {
|
||||
let mut process_vector: Vec<ProcessHarvest> = Vec::new();
|
||||
let process_hashmap = sys.processes();
|
||||
let cpu_usage = sys.global_processor_info().cpu_usage() as f64 / 100.0;
|
||||
let num_processors = sys.processors().len() as f64;
|
||||
let cpu_usage = sys.global_cpu_info().cpu_usage() as f64 / 100.0;
|
||||
let num_processors = sys.cpus().len() as f64;
|
||||
for process_val in process_hashmap.values() {
|
||||
let name = if process_val.name().is_empty() {
|
||||
let process_cmd = process_val.cmd();
|
||||
|
@ -65,7 +65,7 @@ pub fn get_process_data(
|
|||
let ps = process_val.status();
|
||||
(ps.to_string(), convert_process_status_to_char(ps))
|
||||
};
|
||||
let uid = process_val.uid;
|
||||
let uid = process_val.user_id().map(|u| **u);
|
||||
process_vector.push(ProcessHarvest {
|
||||
pid: process_val.pid().as_u32() as _,
|
||||
parent_pid: process_val.parent().map(|p| p.as_u32() as _),
|
||||
|
@ -84,10 +84,14 @@ pub fn get_process_data(
|
|||
total_write_bytes: disk_usage.total_written_bytes,
|
||||
process_state,
|
||||
uid,
|
||||
user: user_table
|
||||
.get_uid_to_username_mapping(uid)
|
||||
.map(Into::into)
|
||||
.unwrap_or_else(|_| "N/A".into()),
|
||||
user: uid
|
||||
.and_then(|uid| {
|
||||
user_table
|
||||
.get_uid_to_username_mapping(uid)
|
||||
.map(Into::into)
|
||||
.ok()
|
||||
})
|
||||
.unwrap_or_else(|| "N/A".into()),
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
//! Process data collection for Windows. Uses sysinfo.
|
||||
|
||||
use super::ProcessHarvest;
|
||||
use sysinfo::{PidExt, ProcessExt, ProcessorExt, System, SystemExt};
|
||||
use sysinfo::{CpuExt, PidExt, ProcessExt, System, SystemExt};
|
||||
|
||||
pub fn get_process_data(
|
||||
sys: &System, use_current_cpu_total: bool, mem_total_kb: u64,
|
||||
) -> crate::utils::error::Result<Vec<ProcessHarvest>> {
|
||||
let mut process_vector: Vec<ProcessHarvest> = Vec::new();
|
||||
let process_hashmap = sys.processes();
|
||||
let cpu_usage = sys.global_processor_info().cpu_usage() as f64 / 100.0;
|
||||
let num_processors = sys.processors().len() as f64;
|
||||
let cpu_usage = sys.global_cpu_info().cpu_usage() as f64 / 100.0;
|
||||
let num_processors = sys.cpus().len() as f64;
|
||||
for process_val in process_hashmap.values() {
|
||||
let name = if process_val.name().is_empty() {
|
||||
let process_cmd = process_val.cmd();
|
||||
|
|
Loading…
Reference in New Issue