mirror of
https://github.com/danog/ytop.git
synced 2024-11-30 04:29:10 +01:00
update psutil; get macos to compile
This commit is contained in:
parent
88a845616d
commit
1b7d3d60e2
44
Cargo.lock
generated
44
Cargo.lock
generated
@ -232,6 +232,24 @@ dependencies = [
|
||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darwin-libproc"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"darwin-libproc-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"memchr 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darwin-libproc-sys"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dirs"
|
||||
version = "2.0.2"
|
||||
@ -400,6 +418,19 @@ dependencies = [
|
||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mach"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "mio"
|
||||
version = "0.6.21"
|
||||
@ -602,9 +633,12 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "psutil"
|
||||
version = "1.7.0"
|
||||
source = "git+https://github.com/borntyping/rust-psutil#f29334464938d3bdc814d84b9363dac18e585deb"
|
||||
source = "git+https://github.com/borntyping/rust-psutil?branch=macos#08a908a1d65a25149a44948d4212273320f09021"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"darwin-libproc 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mach 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"nix 0.16.1 (git+https://github.com/nix-rust/nix)",
|
||||
"num_cpus 1.11.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"once_cell 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -992,7 +1026,7 @@ dependencies = [
|
||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-rational 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"platform-dirs 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"psutil 1.7.0 (git+https://github.com/borntyping/rust-psutil)",
|
||||
"psutil 1.7.0 (git+https://github.com/borntyping/rust-psutil?branch=macos)",
|
||||
"serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"size 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -1030,6 +1064,8 @@ dependencies = [
|
||||
"checksum crossterm 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9f03c2ede596aa7d3c74a36f63e9c01047375fdbcf2203a5cdb70a996656b028"
|
||||
"checksum crossterm_winapi 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8777c700901e2d5b50c406f736ed6b8f9e43645c7e104ddb74f8bc42b8ae62f6"
|
||||
"checksum ctrlc 3.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c7dfd2d8b4c82121dfdff120f818e09fc4380b0b7e17a742081a89b94853e87f"
|
||||
"checksum darwin-libproc 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ade5a88af8d9646bf770687321a9488a0f2b4610aa08b0373016cd1af37f0a31"
|
||||
"checksum darwin-libproc-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c30d1a078d74da1183b02fed8a8b07afc412d3998334b53b750d0ed03b031541"
|
||||
"checksum dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "13aea89a5c93364a98e9b37b2fa237effbb694d5cfe01c5b70941f7eb087d5e3"
|
||||
"checksum dirs-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "afa0b23de8fd801745c471deffa6e12d248f962c9fd4b4c33787b055599bde7b"
|
||||
"checksum doc-comment 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "923dea538cea0aa3025e8685b20d6ee21ef99c4f77e954a30febbaac5ec73a97"
|
||||
@ -1053,6 +1089,8 @@ dependencies = [
|
||||
"checksum lock_api 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "79b2de95ecb4691949fea4716ca53cdbcfccb2c612e19644a8bad05edcf9f47b"
|
||||
"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"
|
||||
"checksum mach 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "86dd2487cdfea56def77b88438a2c915fb45113c5319bfe7e14306ca4cd0b0e1"
|
||||
"checksum mach 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa"
|
||||
"checksum memchr 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3197e20c7edb283f87c071ddfc7a2cca8f8e0b888c242959846a6fce03c72223"
|
||||
"checksum mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)" = "302dec22bcf6bae6dfb69c647187f4b4d0fb6f535521f7bc022430ce8e12008f"
|
||||
"checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919"
|
||||
"checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88"
|
||||
@ -1073,7 +1111,7 @@ dependencies = [
|
||||
"checksum proc-macro-error 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "53c98547ceaea14eeb26fcadf51dc70d01a2479a7839170eae133721105e4428"
|
||||
"checksum proc-macro-error-attr 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c2bf5d493cf5d3e296beccfd61794e445e830dfc8070a9c248ad3ee071392c6c"
|
||||
"checksum proc-macro2 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "0319972dcae462681daf4da1adeeaa066e3ebd29c69be96c6abb1259d2ee2bcc"
|
||||
"checksum psutil 1.7.0 (git+https://github.com/borntyping/rust-psutil)" = "<none>"
|
||||
"checksum psutil 1.7.0 (git+https://github.com/borntyping/rust-psutil?branch=macos)" = "<none>"
|
||||
"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe"
|
||||
"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b"
|
||||
"checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc"
|
||||
|
@ -18,7 +18,7 @@ log = "0.4.8"
|
||||
num-rational = "0.2.2"
|
||||
platform-dirs = "0.2.0"
|
||||
# psutil = "1.7.0"
|
||||
psutil = { git = "https://github.com/borntyping/rust-psutil" }
|
||||
psutil = { git = "https://github.com/borntyping/rust-psutil", branch = "macos" }
|
||||
serde = { version = "1.0.104", features = ["derive"] }
|
||||
serde_json = "1.0.44"
|
||||
size = "0.1.2"
|
||||
|
@ -50,6 +50,7 @@ impl DiskWidget<'_> {
|
||||
}
|
||||
|
||||
impl UpdatableWidget for DiskWidget<'_> {
|
||||
#[cfg(target_os = "linux")]
|
||||
fn update(&mut self) {
|
||||
let io_counters = self.collector.disk_io_counters_perdisk().unwrap();
|
||||
self.partitions = disk::partitions_physical()
|
||||
@ -101,6 +102,9 @@ impl UpdatableWidget for DiskWidget<'_> {
|
||||
.collect();
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
fn update(&mut self) {}
|
||||
|
||||
fn get_update_interval(&self) -> Ratio<u64> {
|
||||
self.update_interval
|
||||
}
|
||||
|
@ -224,7 +224,11 @@ impl UpdatableWidget for ProcWidget<'_> {
|
||||
Ok(Proc {
|
||||
num: process.pid(),
|
||||
name: name.to_string(),
|
||||
commandline: process.cmdline()?.unwrap_or_else(|| format!("[{}]", name)),
|
||||
commandline: if cfg!(target_os = "linux") {
|
||||
process.cmdline()?.unwrap_or_else(|| format!("[{}]", name))
|
||||
} else {
|
||||
String::default()
|
||||
},
|
||||
cpu: process.cpu_percent()? / cpu_count,
|
||||
mem: process.memory_percent()?,
|
||||
})
|
||||
|
@ -34,6 +34,7 @@ impl TempWidget<'_> {
|
||||
}
|
||||
|
||||
impl UpdatableWidget for TempWidget<'_> {
|
||||
#[cfg(target_os = "linux")]
|
||||
fn update(&mut self) {
|
||||
self.temp_data = sensors::temperatures()
|
||||
.into_iter()
|
||||
@ -55,6 +56,9 @@ impl UpdatableWidget for TempWidget<'_> {
|
||||
.collect()
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
fn update(&mut self) {}
|
||||
|
||||
fn get_update_interval(&self) -> Ratio<u64> {
|
||||
self.update_interval
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user