summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Davison <dandavison7@gmail.com>2021-12-11 15:31:34 -0500
committerGitHub <noreply@github.com>2021-12-11 15:31:34 -0500
commit69c7aaa28fdda955cf430134170e3a533970cc0f (patch)
tree55d68bb4f93e2c63d77f30d0ede49d8d643ab853
parent5c1612ec0ad328249a611933cf7d13b05a99680a (diff)
Do not query CPU data when querying process data (#845)
* Do not query CPU data when querying process data Fixes #839 Ref https://github.com/GuillaumeGomez/sysinfo/issues/632 * Update branch of sysinfo * Update upstream sysinfo commit Ref https://github.com/GuillaumeGomez/sysinfo/pull/636 * Point sysinfo at an explicit commit rather than a symbolic branch name commit d647acfbf216848a8237e1f9251b2c48860a547f Merge: 989ac6c 67a586c Author: Guillaume Gomez <guillaume1.gomez@gmail.com> Date: 2 hours ago Merge pull request #636 from GuillaumeGomez/update-if-needed Only update processors if needed
-rw-r--r--Cargo.lock5
-rw-r--r--Cargo.toml3
-rw-r--r--src/utils/process.rs8
3 files changed, 9 insertions, 7 deletions
diff --git a/Cargo.lock b/Cargo.lock
index c01df240..4b8b476a 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1053,9 +1053,8 @@ dependencies = [
[[package]]
name = "sysinfo"
-version = "0.20.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e223c65cd36b485a34c2ce6e38efa40777d31c4166d9076030c74cdcf971679f"
+version = "0.21.2"
+source = "git+https://github.com/GuillaumeGomez/sysinfo#d647acfbf216848a8237e1f9251b2c48860a547f"
dependencies = [
"cfg-if 1.0.0",
"core-foundation-sys",
diff --git a/Cargo.toml b/Cargo.toml
index 1d44112f..355a9408 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -53,7 +53,8 @@ default-features = false
features = ["parsing", "assets", "yaml-load", "dump-load", "regex-onig"]
[dependencies.sysinfo]
-version = "0.20.5"
+git = "https://github.com/GuillaumeGomez/sysinfo"
+commit = "d647acfbf216848a8237e1f9251b2c48860a547f"
# no default features to disable the use of threads
default-features = false
features = []
diff --git a/src/utils/process.rs b/src/utils/process.rs
index 5602dd3f..68b57a6a 100644
--- a/src/utils/process.rs
+++ b/src/utils/process.rs
@@ -1,7 +1,7 @@
use std::borrow::Cow;
use std::collections::{HashMap, HashSet};
use std::path::Path;
-use sysinfo::{Pid, Process, ProcessExt, SystemExt};
+use sysinfo::{Pid, Process, ProcessExt, ProcessRefreshKind, SystemExt};
use lazy_static::lazy_static;
@@ -347,7 +347,8 @@ impl ProcessInterface for ProcInfo {
std::process::id() as Pid
}
fn refresh_process(&mut self, pid: Pid) -> bool {
- self.info.refresh_process(pid)
+ self.info
+ .refresh_process_specifics(pid, ProcessRefreshKind::new())
}
fn process(&self, pid: Pid) -> Option<&Self::Out> {
self.info.process(pid)
@@ -356,7 +357,8 @@ impl ProcessInterface for ProcInfo {
self.info.processes()
}
fn refresh_processes(&mut self) {
- self.info.refresh_processes()
+ self.info
+ .refresh_processes_specifics(ProcessRefreshKind::new())
}
}