Merge pull request #658 from GuillaumeGomez/update-sysinfo
Update sysinfo version
This commit is contained in:
commit
fbd95126b0
|
@ -887,9 +887,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
|
|||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.104"
|
||||
version = "0.2.112"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7b2f96d100e1cf1929e7719b7edb3b90ab5298072638fccd77be9ce942ecdfce"
|
||||
checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125"
|
||||
|
||||
[[package]]
|
||||
name = "lock_api"
|
||||
|
@ -1394,13 +1394,12 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "sysinfo"
|
||||
version = "0.18.2"
|
||||
version = "0.23.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d404aefa651a24a7f2a1190fec9fb6380ba84ac511a6fefad79eb0e63d39a97d"
|
||||
checksum = "9e757000a4bed2b1be9be65a3f418b9696adf30bb419214c73997422de73a591"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"core-foundation-sys 0.8.3",
|
||||
"doc-comment",
|
||||
"libc",
|
||||
"ntapi",
|
||||
"once_cell",
|
||||
|
|
|
@ -51,7 +51,7 @@ once_cell = "1.5.2"
|
|||
regex = "1.5.4"
|
||||
serde = { version = "1.0.125", features = ["derive"] }
|
||||
# Sysinfo is still used in Linux for the ProcessStatus
|
||||
sysinfo = "0.18.2"
|
||||
sysinfo = "0.23.0"
|
||||
thiserror = "1.0.24"
|
||||
time = { version = "0.3.5", features = ["formatting", "macros"] }
|
||||
toml = "0.5.8"
|
||||
|
|
|
@ -144,7 +144,7 @@ impl DataCollector {
|
|||
#[cfg(not(target_os = "linux"))]
|
||||
{
|
||||
self.sys.refresh_memory();
|
||||
self.mem_total_kb = self.sys.get_total_memory();
|
||||
self.mem_total_kb = self.sys.total_memory();
|
||||
|
||||
// TODO: Would be good to get this and network list running on a timer instead...?
|
||||
// Refresh components list once...
|
||||
|
|
|
@ -17,7 +17,7 @@ pub async fn get_network_data(
|
|||
let mut total_rx: u64 = 0;
|
||||
let mut total_tx: u64 = 0;
|
||||
|
||||
let networks = sys.get_networks();
|
||||
let networks = sys.networks();
|
||||
for (name, network) in networks {
|
||||
let to_keep = if let Some(filter) = filter {
|
||||
let mut ret = filter.is_list_ignored;
|
||||
|
@ -33,8 +33,8 @@ pub async fn get_network_data(
|
|||
};
|
||||
|
||||
if to_keep {
|
||||
total_rx += network.get_total_received() * 8;
|
||||
total_tx += network.get_total_transmitted() * 8;
|
||||
total_rx += network.total_received() * 8;
|
||||
total_tx += network.total_transmitted() * 8;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//! Process data collection for macOS. Uses sysinfo.
|
||||
|
||||
use super::ProcessHarvest;
|
||||
use sysinfo::{ProcessExt, ProcessStatus, ProcessorExt, System, SystemExt};
|
||||
use sysinfo::{PidExt, ProcessExt, ProcessStatus, ProcessorExt, System, SystemExt};
|
||||
|
||||
fn get_macos_process_cpu_usage(
|
||||
pids: &[i32],
|
||||
|
@ -38,9 +38,9 @@ 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.get_processes();
|
||||
let cpu_usage = sys.get_global_processor_info().get_cpu_usage() as f64 / 100.0;
|
||||
let num_processors = sys.get_processors().len() as f64;
|
||||
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;
|
||||
for process_val in process_hashmap.values() {
|
||||
let name = if process_val.name().is_empty() {
|
||||
let process_cmd = process_val.cmd();
|
||||
|
@ -87,8 +87,8 @@ pub fn get_process_data(
|
|||
|
||||
let disk_usage = process_val.disk_usage();
|
||||
process_vector.push(ProcessHarvest {
|
||||
pid: process_val.pid(),
|
||||
parent_pid: process_val.parent(),
|
||||
pid: process_val.pid().as_u32() as _,
|
||||
parent_pid: process_val.parent().map(|p| p.as_u32() as _),
|
||||
name,
|
||||
command,
|
||||
mem_usage_percent: if mem_total_kb > 0 {
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
//! Process data collection for Windows. Uses sysinfo.
|
||||
|
||||
use super::ProcessHarvest;
|
||||
use sysinfo::{ProcessExt, ProcessorExt, System, SystemExt};
|
||||
use sysinfo::{PidExt, ProcessExt, ProcessorExt, 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.get_processes();
|
||||
let cpu_usage = sys.get_global_processor_info().get_cpu_usage() as f64 / 100.0;
|
||||
let num_processors = sys.get_processors().len() as f64;
|
||||
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;
|
||||
for process_val in process_hashmap.values() {
|
||||
let name = if process_val.name().is_empty() {
|
||||
let process_cmd = process_val.cmd();
|
||||
|
@ -56,8 +56,8 @@ pub fn get_process_data(
|
|||
|
||||
let disk_usage = process_val.disk_usage();
|
||||
process_vector.push(ProcessHarvest {
|
||||
pid: process_val.pid(),
|
||||
parent_pid: process_val.parent(),
|
||||
pid: process_val.pid().as_u32() as _,
|
||||
parent_pid: process_val.parent().map(|p| p.as_u32() as _),
|
||||
name,
|
||||
command,
|
||||
mem_usage_percent: if mem_total_kb > 0 {
|
||||
|
|
|
@ -22,20 +22,18 @@ pub async fn get_temperature_data(
|
|||
|
||||
let mut temperature_vec: Vec<TempHarvest> = Vec::new();
|
||||
|
||||
let sensor_data = sys.get_components();
|
||||
let sensor_data = sys.components();
|
||||
for component in sensor_data {
|
||||
let name = component.get_label().to_string();
|
||||
let name = component.label().to_string();
|
||||
|
||||
if is_temp_filtered(filter, &name) {
|
||||
temperature_vec.push(TempHarvest {
|
||||
name,
|
||||
temperature: match temp_type {
|
||||
TemperatureType::Celsius => component.get_temperature(),
|
||||
TemperatureType::Kelvin => {
|
||||
convert_celsius_to_kelvin(component.get_temperature())
|
||||
}
|
||||
TemperatureType::Celsius => component.temperature(),
|
||||
TemperatureType::Kelvin => convert_celsius_to_kelvin(component.temperature()),
|
||||
TemperatureType::Fahrenheit => {
|
||||
convert_celsius_to_fahrenheit(component.get_temperature())
|
||||
convert_celsius_to_fahrenheit(component.temperature())
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue