Skip to content

Commit 0f36e4e

Browse files
fanzeyifacebook-github-bot
authored andcommitted
sysinfo: 0.20.4 -> 0.26.8
Summary: Update sysinfo from 0.20.4 to 0.26.8. The main motivation is to pick up the upstream change in `System::new`, which it no longer loads CPU info by default. This results as a 20x speed up in some of our hosts with powerful CPUs. Reviewed By: chadaustin, MichaelCuevas Differential Revision: D41813852 fbshipit-source-id: 678bd0ec36d4771caa8396810355212eec593bb9
1 parent 7fce203 commit 0f36e4e

5 files changed

Lines changed: 13 additions & 12 deletions

File tree

eden/fs/cli_rs/edenfs-client/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ regex = "1.6.0"
2424
serde = { version = "1.0.136", features = ["derive", "rc"] }
2525
serde_json = { version = "1.0.79", features = ["float_roundtrip", "unbounded_depth"] }
2626
subprocess = "0.2.7"
27-
sysinfo = "0.20.4"
27+
sysinfo = "0.26.8"
2828
thrift-types = { version = "0.1.0", path = "../../../scm/lib/thrift-types" }
2929
thrift_streaming = { version = "0.1.0", path = "../../service/thrift_streaming" }
3030
tokio = { version = "1.21.2", features = ["full", "test-util", "tracing"] }

eden/fs/cli_rs/edenfs-commands/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ serde = { version = "1.0.136", features = ["derive", "rc"] }
2626
serde_json = { version = "1.0.79", features = ["float_roundtrip", "unbounded_depth"] }
2727
shlex = "1.0"
2828
subprocess = "0.2.7"
29-
sysinfo = "0.20.4"
29+
sysinfo = "0.26.8"
3030
tabular = "0.2.0"
3131
termwiz = { version = "0.18", features = ["widgets"] }
3232
thrift-types = { version = "0.1.0", path = "../../../scm/lib/thrift-types" }

eden/fs/cli_rs/edenfs-commands/src/minitop.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,11 @@ impl Process {
204204

205205
/// Test if this `Process` is still running.
206206
fn is_running(&self, system: &System) -> bool {
207-
system.process(self.pid as Pid).is_some()
207+
#[cfg(not(windows))]
208+
let pid = Pid::from(self.pid);
209+
#[cfg(windows)]
210+
let pid = Pid::from(self.pid as usize);
211+
system.process(pid).is_some()
208212
}
209213
}
210214

eden/fs/cli_rs/edenfs-utils/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ anyhow = "1.0.65"
1212
edenfs-error = { version = "0.1.0", path = "../edenfs-error" }
1313
glob = "0.3"
1414
subprocess = "0.2.7"
15-
sysinfo = "0.20.4"
15+
sysinfo = "0.26.8"
1616
tracing = "0.1.35"
1717

1818
[target.'cfg(target_os = "linux")'.dependencies]

eden/fs/cli_rs/edenfs-utils/src/lib.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ use edenfs_error::ResultExt;
2222
use glob::glob;
2323
use subprocess::Exec;
2424
use subprocess::Redirection;
25+
use sysinfo::Pid;
2526
use sysinfo::ProcessExt;
2627
use sysinfo::SystemExt;
2728
use tracing::trace;
@@ -134,7 +135,7 @@ pub fn get_executable(pid: sysinfo::Pid) -> Option<PathBuf> {
134135
if system.refresh_process(pid) {
135136
if let Some(process) = system.process(pid) {
136137
let executable = process.exe();
137-
trace!(pid, ?executable, "found process executable");
138+
trace!(%pid, ?executable, "found process executable");
138139

139140
#[cfg(unix)]
140141
{
@@ -150,7 +151,7 @@ pub fn get_executable(pid: sysinfo::Pid) -> Option<PathBuf> {
150151
return Some(executable.into());
151152
}
152153
} else {
153-
trace!(pid, "unable to find process");
154+
trace!(%pid, "unable to find process");
154155
}
155156
} else {
156157
trace!("unable to load process information");
@@ -159,7 +160,7 @@ pub fn get_executable(pid: sysinfo::Pid) -> Option<PathBuf> {
159160
None
160161
}
161162

162-
pub fn is_process_running(pid: sysinfo::Pid) -> bool {
163+
pub fn is_process_running(pid: Pid) -> bool {
163164
let mut system = sysinfo::System::new();
164165

165166
if system.refresh_process(pid) {
@@ -213,12 +214,8 @@ pub fn stop_buckd_for_repo(path: &Path) {
213214
pub fn is_buckd_running_for_path(path: &Path) -> bool {
214215
let pid_file = path.join(".buckd").join("pid");
215216
let file_contents = read_to_string(&pid_file).unwrap_or_default();
216-
#[cfg(windows)]
217-
let buck_pid_parse = file_contents.trim().parse::<usize>();
218-
#[cfg(not(windows))]
219-
let buck_pid_parse = file_contents.trim().parse::<i32>();
220217

221-
if let Ok(buck_pid) = buck_pid_parse {
218+
if let Ok(buck_pid) = file_contents.trim().parse::<Pid>() {
222219
is_process_running(buck_pid)
223220
} else {
224221
false

0 commit comments

Comments
 (0)