mirror of
https://github.com/ClementTsang/bottom.git
synced 2025-07-27 07:34:27 +02:00
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
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -1536,9 +1536,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sysinfo"
|
name = "sysinfo"
|
||||||
version = "0.23.13"
|
version = "0.26.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3977ec2e0520829be45c8a2df70db2bf364714d8a748316a10c3c35d4d2b01c9"
|
checksum = "4ae2421f3e16b3afd4aa692d23b83d0ba42ee9b0081d5deeb7d21428d7195fb1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"core-foundation-sys 0.8.3",
|
"core-foundation-sys 0.8.3",
|
||||||
|
@ -74,7 +74,7 @@ once_cell = "1.5.2"
|
|||||||
regex = "1.5.5"
|
regex = "1.5.5"
|
||||||
serde = { version = "1.0.136", features = ["derive"] }
|
serde = { version = "1.0.136", features = ["derive"] }
|
||||||
starship-battery = { version = "0.7.9", optional = true }
|
starship-battery = { version = "0.7.9", optional = true }
|
||||||
sysinfo = "0.23.10"
|
sysinfo = "0.26.2"
|
||||||
thiserror = "1.0.30"
|
thiserror = "1.0.30"
|
||||||
time = { version = "0.3.9", features = ["formatting", "macros"] }
|
time = { version = "0.3.9", features = ["formatting", "macros"] }
|
||||||
toml = "0.5.9"
|
toml = "0.5.9"
|
||||||
|
@ -13,4 +13,4 @@ Unofficially supported platforms known to compile/work:
|
|||||||
|
|
||||||
## Known problems
|
## 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 std::collections::VecDeque;
|
||||||
|
|
||||||
use sysinfo::{LoadAvg, ProcessorExt, System, SystemExt};
|
use sysinfo::{LoadAvg, System, SystemExt};
|
||||||
|
|
||||||
use super::{CpuData, CpuHarvest, PastCpuTotal, PastCpuWork};
|
use super::{CpuData, CpuHarvest, PastCpuTotal, PastCpuWork};
|
||||||
use crate::app::data_harvester::cpu::LoadAvgHarvest;
|
use crate::app::data_harvester::cpu::LoadAvgHarvest;
|
||||||
@ -25,7 +25,7 @@ pub async fn get_cpu_data_list(
|
|||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
if show_average_cpu {
|
if show_average_cpu {
|
||||||
let cpu = sys.global_processor_info();
|
let cpu = sys.global_cpu_info();
|
||||||
|
|
||||||
cpu_deque.push_front(CpuData {
|
cpu_deque.push_front(CpuData {
|
||||||
cpu_prefix: "AVG".to_string(),
|
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.
|
/// This is the *effective* user ID of the process. This is only used on Unix platforms.
|
||||||
#[cfg(target_family = "unix")]
|
#[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.
|
/// This is the process' user. This is only used on Unix platforms.
|
||||||
#[cfg(target_family = "unix")]
|
#[cfg(target_family = "unix")]
|
||||||
|
@ -219,7 +219,7 @@ fn read_proc(
|
|||||||
total_read_bytes,
|
total_read_bytes,
|
||||||
total_write_bytes,
|
total_write_bytes,
|
||||||
process_state,
|
process_state,
|
||||||
uid,
|
uid: Some(uid),
|
||||||
user: user_table
|
user: user_table
|
||||||
.get_uid_to_username_mapping(uid)
|
.get_uid_to_username_mapping(uid)
|
||||||
.map(Into::into)
|
.map(Into::into)
|
||||||
|
@ -4,7 +4,7 @@ use std::collections::HashMap;
|
|||||||
use std::io;
|
use std::io;
|
||||||
|
|
||||||
use super::ProcessHarvest;
|
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;
|
use crate::data_harvester::processes::UserTable;
|
||||||
|
|
||||||
@ -14,8 +14,8 @@ pub fn get_process_data(
|
|||||||
) -> crate::utils::error::Result<Vec<ProcessHarvest>> {
|
) -> crate::utils::error::Result<Vec<ProcessHarvest>> {
|
||||||
let mut process_vector: Vec<ProcessHarvest> = Vec::new();
|
let mut process_vector: Vec<ProcessHarvest> = Vec::new();
|
||||||
let process_hashmap = sys.processes();
|
let process_hashmap = sys.processes();
|
||||||
let cpu_usage = sys.global_processor_info().cpu_usage() as f64 / 100.0;
|
let cpu_usage = sys.global_cpu_info().cpu_usage() as f64 / 100.0;
|
||||||
let num_processors = sys.processors().len() as f64;
|
let num_processors = sys.cpus().len() as f64;
|
||||||
for process_val in process_hashmap.values() {
|
for process_val in process_hashmap.values() {
|
||||||
let name = if process_val.name().is_empty() {
|
let name = if process_val.name().is_empty() {
|
||||||
let process_cmd = process_val.cmd();
|
let process_cmd = process_val.cmd();
|
||||||
@ -65,7 +65,7 @@ pub fn get_process_data(
|
|||||||
let ps = process_val.status();
|
let ps = process_val.status();
|
||||||
(ps.to_string(), convert_process_status_to_char(ps))
|
(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 {
|
process_vector.push(ProcessHarvest {
|
||||||
pid: process_val.pid().as_u32() as _,
|
pid: process_val.pid().as_u32() as _,
|
||||||
parent_pid: process_val.parent().map(|p| p.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,
|
total_write_bytes: disk_usage.total_written_bytes,
|
||||||
process_state,
|
process_state,
|
||||||
uid,
|
uid,
|
||||||
user: user_table
|
user: uid
|
||||||
|
.and_then(|uid| {
|
||||||
|
user_table
|
||||||
.get_uid_to_username_mapping(uid)
|
.get_uid_to_username_mapping(uid)
|
||||||
.map(Into::into)
|
.map(Into::into)
|
||||||
.unwrap_or_else(|_| "N/A".into()),
|
.ok()
|
||||||
|
})
|
||||||
|
.unwrap_or_else(|| "N/A".into()),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
//! Process data collection for Windows. Uses sysinfo.
|
//! Process data collection for Windows. Uses sysinfo.
|
||||||
|
|
||||||
use super::ProcessHarvest;
|
use super::ProcessHarvest;
|
||||||
use sysinfo::{PidExt, ProcessExt, ProcessorExt, System, SystemExt};
|
use sysinfo::{CpuExt, PidExt, ProcessExt, System, SystemExt};
|
||||||
|
|
||||||
pub fn get_process_data(
|
pub fn get_process_data(
|
||||||
sys: &System, use_current_cpu_total: bool, mem_total_kb: u64,
|
sys: &System, use_current_cpu_total: bool, mem_total_kb: u64,
|
||||||
) -> crate::utils::error::Result<Vec<ProcessHarvest>> {
|
) -> crate::utils::error::Result<Vec<ProcessHarvest>> {
|
||||||
let mut process_vector: Vec<ProcessHarvest> = Vec::new();
|
let mut process_vector: Vec<ProcessHarvest> = Vec::new();
|
||||||
let process_hashmap = sys.processes();
|
let process_hashmap = sys.processes();
|
||||||
let cpu_usage = sys.global_processor_info().cpu_usage() as f64 / 100.0;
|
let cpu_usage = sys.global_cpu_info().cpu_usage() as f64 / 100.0;
|
||||||
let num_processors = sys.processors().len() as f64;
|
let num_processors = sys.cpus().len() as f64;
|
||||||
for process_val in process_hashmap.values() {
|
for process_val in process_hashmap.values() {
|
||||||
let name = if process_val.name().is_empty() {
|
let name = if process_val.name().is_empty() {
|
||||||
let process_cmd = process_val.cmd();
|
let process_cmd = process_val.cmd();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user