summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClement Tsang <34804052+ClementTsang@users.noreply.github.com>2023-04-10 05:52:46 -0400
committerGitHub <noreply@github.com>2023-04-10 05:52:46 -0400
commit9edde9b133dd56bfe99bccaa93345626ed26d53c (patch)
treea3f234330f5c7b5467f3c5c40a9b9b50a7611050
parentb2801b16a95b6ce93a9350445ee7e4221c7f002c (diff)
refactor: migrate disk collection code off of heim, remove heim (#1064)
Migrates existing heim-based disk data collection code off of it to either sysinfo or vendored code based on heim/sysinfo/other sources. This also allows us to remove heim completely from bottom. --- * refactor: fix some refresh code * remove async from the freebsd code * some file/implementation organization Turns out sysinfo lacks a lot of data I need. I can still use it for the Windows disk usage implementation, but I'm probably going to manually implement macos/linux usage and all io usage stats. * more restructuring * Some other fixes * remove futures * ready for some big changes? * big changes * linux io + reads * use lossy conversion for mount point * add windows refresh * so long heim, and thanks for all the fish * fix filter behaviour, remove string allocation when reading lines * rename unix -> system for more accurate file struct representation * fix freebsd * port generic unix partition code * add bindings and fix errors * finish macOS bindings for I/O * disable conform check, this seems to... make disk I/O work on macOS????? * fix linux * add safety comments * more comments * update changelog * changelog * We're going full 0.9.0 for this * update lock * fix some typing * bleh * some file management * hoist out get_disk_usage * fix some stuff for Windows * typing and remove dead code allow lint * unify typing * fix * fix 2 * macOS fix * Add bindings file for windows * add windows implementation * fix macos
-rw-r--r--CHANGELOG.md8
-rw-r--r--Cargo.lock460
-rw-r--r--Cargo.toml12
-rw-r--r--src/app/data_farmer.rs42
-rw-r--r--src/app/data_harvester.rs79
-rw-r--r--src/app/data_harvester/disks.rs174
-rw-r--r--src/app/data_harvester/disks/freebsd.rs56
-rw-r--r--src/app/data_harvester/disks/heim.rs139
-rw-r--r--src/app/data_harvester/disks/heim/linux.rs34
-rw-r--r--src/app/data_harvester/disks/heim/windows_macos.rs14
-rw-r--r--src/app/data_harvester/disks/io_counters.rs30
-rw-r--r--src/app/data_harvester/disks/unix.rs73
-rw-r--r--src/app/data_harvester/disks/unix/file_systems.rs141
-rw-r--r--src/app/data_harvester/disks/unix/linux/counters.rs85
-rw-r--r--src/app/data_harvester/disks/unix/linux/mod.rs5
-rw-r--r--src/app/data_harvester/disks/unix/linux/partition.rs197
-rw-r--r--src/app/data_harvester/disks/unix/macos/counters.rs49
-rw-r--r--src/app/data_harvester/disks/unix/macos/io_kit.rs10
-rw-r--r--src/app/data_harvester/disks/unix/macos/io_kit/bindings.rs59
-rw-r--r--src/app/data_harvester/disks/unix/macos/io_kit/io_disks.rs24
-rw-r--r--src/app/data_harvester/disks/unix/macos/io_kit/io_iterator.rs54
-rw-r--r--src/app/data_harvester/disks/unix/macos/io_kit/io_object.rs140
-rw-r--r--src/app/data_harvester/disks/unix/macos/mod.rs4
-rw-r--r--src/app/data_harvester/disks/unix/other/bindings.rs46
-rw-r--r--src/app/data_harvester/disks/unix/other/mod.rs4
-rw-r--r--src/app/data_harvester/disks/unix/other/partition.rs99
-rw-r--r--src/app/data_harvester/disks/unix/usage.rs32
-rw-r--r--src/app/data_harvester/disks/windows.rs75
-rw-r--r--src/app/data_harvester/disks/windows/bindings.rs198
-rw-r--r--src/app/data_harvester/memory/arc.rs10
-rw-r--r--src/app/data_harvester/temperature/linux.rs4
-rw-r--r--src/app/filter.rs8
-rw-r--r--src/bin/main.rs3
-rw-r--r--src/data_conversion.rs1
-rw-r--r--src/lib.rs3
-rw-r--r--src/utils/error.rs10
-rw-r--r--src/widgets/disk_table.rs6
37 files changed, 1623 insertions, 765 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f226b988..cead9d4c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,12 +5,15 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
-## [0.9.0]/[0.8.1] - Unreleased
+## [0.9.0] - Unreleased
## Bug Fixes
- [#1021](https://github.com/ClementTsang/bottom/pull/1021): Fix selected text background colour being wrong if only the foreground colour was set.
- [#1037](https://github.com/ClementTsang/bottom/pull/1037): Fix `is_list_ignored` accepting all results if set to `false`.
+- [#1064](https://github.com/ClementTsang/bottom/pull/1064): Disk name/mount filter now doesn't always show all entries if one filter wasn't set.
+- [#1064](https://github.com/ClementTsang/bottom/pull/1064): macOS disk I/O is potentially working now.
+- [#597](https://github.com/ClementTsang/bottom/issues/597): Resolve RUSTSEC-2021-0119 by removing heim.
## Features
@@ -25,6 +28,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [#1036](https://github.com/ClementTsang/bottom/pull/1036): Migrate away from heim for memory information; Linux
platforms will also now try to use `MemAvailable` to determine used memory if supported.
- [#1041](https://github.com/ClementTsang/bottom/pull/1041): Migrate away from heim for network information.
+- [#1064](https://github.com/ClementTsang/bottom/pull/1064): Migrate away from heim for storage information.
+- [#812](https://github.com/ClementTsang/bottom/issues/812): Fully remove heim from bottom.
+- [#1075](https://github.com/ClementTsang/bottom/issues/1075): Update how drives are named in Windows.
## Other
diff --git a/Cargo.lock b/Cargo.lock
index ac4dd4f3..154af504 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -53,110 +53,6 @@ dependencies = [
]
[[package]]
-name = "async-channel"
-version = "1.6.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2114d64672151c0c5eaa5e131ec84a74f06e1e559830dabba01ca30605d66319"
-dependencies = [
- "concurrent-queue",
- "event-listener",
- "futures-core",
-]
-
-[[package]]
-name = "async-executor"
-version = "1.4.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "871f9bb5e0a22eeb7e8cf16641feb87c9dc67032ccf8ff49e772eb9941d3a965"
-dependencies = [
- "async-task",
- "concurrent-queue",
- "fastrand",
- "futures-lite",
- "once_cell",
- "slab",
-]
-
-[[package]]
-name = "async-fs"
-version = "1.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8b3ca4f8ff117c37c278a2f7415ce9be55560b846b5bc4412aaa5d29c1c3dae2"
-dependencies = [
- "async-lock",
- "blocking",
- "futures-lite",
-]
-
-[[package]]
-name = "async-io"
-version = "1.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a811e6a479f2439f0c04038796b5cfb3d2ad56c230e0f2d3f7b04d68cfee607b"
-dependencies = [
- "concurrent-queue",
- "futures-lite",
- "libc",
- "log",
- "once_cell",
- "parking",
- "polling",
- "slab",
- "socket2",
- "waker-fn",
- "winapi",
-]
-
-[[package]]
-name = "async-lock"
-version = "2.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e97a171d191782fba31bb902b14ad94e24a68145032b7eedf871ab0bc0d077b6"
-dependencies = [
- "event-listener",
-]
-
-[[package]]
-name = "async-net"
-version = "1.6.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5373304df79b9b4395068fb080369ec7178608827306ce4d081cba51cac551df"
-dependencies = [
- "async-io",
- "blocking",
- "futures-lite",
-]
-
-[[package]]
-name = "async-process"
-version = "1.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "83137067e3a2a6a06d67168e49e68a0957d215410473a740cea95a2425c0b7c6"
-dependencies = [
- "async-io",
- "blocking",
- "cfg-if",
- "event-listener",
- "futures-lite",
- "libc",
- "once_cell",
- "signal-hook",
- "winapi",
-]
-
-[[package]]
-name = "async-task"
-version = "4.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "30696a84d817107fc028e049980e09d5e140e8da8f1caeb17e8e950658a3cea9"
-
-[[package]]
-name = "atomic-waker"
-version = "1.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "065374052e7df7ee4047b1160cca5e1467a12351a40b3da123c870ba0b8eda2a"
-
-[[package]]
name = "atty"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -195,22 +91,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
-name = "blocking"
-version = "1.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c6ccb65d468978a086b69884437ded69a90faab3bbe6e67f242173ea728acccc"
-dependencies = [
- "async-channel",
- "async-task",
- "atomic-waker",
- "fastrand",
- "futures-lite",
- "once_cell",
-]
-
-[[package]]
name = "bottom"
-version = "0.8.1"
+version = "0.9.0"
dependencies = [
"anyhow",
"assert_cmd",
@@ -222,15 +104,13 @@ dependencies = [
"clap_mangen",
"concat-string",
"const_format",
+ "core-foundation 0.9.3",
"crossterm 0.26.1",
"ctrlc",
"dirs",
"fern",
"filedescriptor",
- "futures",
- "futures-timer",
"fxhash",
- "heim",
"humantime",
"humantime-serde",
"indexmap",
@@ -277,12 +157,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
[[package]]
-name = "cache-padded"
-version = "1.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c1db59621ec70f09c5e9b597b220c7a2b43611f4710dc03ceb8748637775692c"
-
-[[package]]
name = "cargo-husky"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -358,15 +232,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7439becb5fafc780b6f4de382b1a7a3e70234afe783854a4702ee8adbb838609"
[[package]]
-name = "concurrent-queue"
-version = "1.2.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "30ed07550be01594c6026cff2a1d7fe9c8f683caa798e12b68694ac9e88286a3"
-dependencies = [
- "cache-padded",
-]
-
-[[package]]
name = "const_format"
version = "0.2.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -402,7 +267,7 @@ version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146"
dependencies = [
- "core-foundation-sys 0.8.3",
+ "core-foundation-sys 0.8.4",
"libc",
]
@@ -414,9 +279,9 @@ checksum = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac"
[[package]]
name = "core-foundation-sys"
-version = "0.8.3"
+version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc"
+checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa"
[[package]]
name = "crossbeam-channel"
@@ -621,21 +486,6 @@ dependencies = [
]
[[package]]
-name = "event-listener"
-version = "2.5.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "77f3309417938f28bf8228fcff79a4a37103981e3e186d2ccd19c74b38f4eb71"
-
-[[package]]
-name = "fastrand"
-version = "1.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf"
-dependencies = [
- "instant",
-]
-
-[[package]]
name = "fern"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -671,116 +521,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
[[package]]
-name = "futures"
-version = "0.3.26"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "13e2792b0ff0340399d58445b88fd9770e3489eff258a4cbc1523418f12abf84"
-dependencies = [
- "futures-channel",
- "futures-core",
- "futures-executor",
- "futures-io",
- "futures-sink",
- "futures-task",
- "futures-util",
-]
-
-[[package]]
-name = "futures-channel"
-version = "0.3.26"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2e5317663a9089767a1ec00a487df42e0ca174b61b4483213ac24448e4664df5"
-dependencies = [
- "futures-core",
- "futures-sink",
-]
-
-[[package]]
-name = "futures-core"
-version = "0.3.26"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ec90ff4d0fe1f57d600049061dc6bb68ed03c7d2fbd697274c41805dcb3f8608"
-
-[[package]]
-name = "futures-executor"
-version = "0.3.26"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e8de0a35a6ab97ec8869e32a2473f4b1324459e14c29275d14b10cb1fd19b50e"
-dependencies = [
- "futures-core",
- "futures-task",
- "futures-util",
-]
-
-[[package]]
-name = "futures-io"
-version = "0.3.26"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bfb8371b6fb2aeb2d280374607aeabfc99d95c72edfe51692e42d3d7f0d08531"
-
-[[package]]
-name = "futures-lite"
-version = "1.12.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7694489acd39452c77daa48516b894c153f192c3578d5a839b62c58099fcbf48"
-dependencies = [
- "fastrand",
- "futures-core",
- "futures-io",
- "memchr",
- "parking",
- "pin-project-lite",
- "waker-fn",
-]
-
-[[package]]
-name = "futures-macro"
-version = "0.3.26"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "95a73af87da33b5acf53acfebdc339fe592ecf5357ac7c0a7734ab9d8c876a70"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn 1.0.107",
-]
-
-[[package]]
-name = "futures-sink"
-version = "0.3.26"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f310820bb3e8cfd46c80db4d7fb8353e15dfff853a127158425f31e0be6c8364"
-
-[[package]]
-name = "futures-task"
-version = "0.3.26"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dcf79a1bf610b10f42aea489289c5a2c478a786509693b80cd39c44ccd936366"
-
-[[package]]
-name = "futures-timer"
-version = "3.0.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c"
-
-[[package]]
-name = "futures-util"
-version = "0.3.26"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9c1d6de3acfef38d2be4b1f543f553131788603495be83da675e180c8d6b7bd1"
-dependencies = [
- "futures-channel",
- "futures-core",
- "futures-io",
- "futures-macro",
- "futures-sink",
- "futures-task",
- "memchr",
- "pin-project-lite",
- "pin-utils",
- "slab",
-]
-
-[[package]]
name = "fxhash"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -819,65 +559,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
[[package]]
-name = "heim"
-version = "0.1.0-rc.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b8a653442b9bdd11a77d3753a60443c60c4437d3acac8e6c3d4a6a9acd7cceed"
-dependencies = [
- "heim-common",
- "heim-disk",
- "heim-runtime",
-]
-
-[[package]]
-name = "heim-common"
-version = "0.1.0-rc.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d767e6e47cf88abe7c9a5ebb4df82f180d30d9c0ba0269b6d166482461765834"
-dependencies = [
- "cfg-if",
- "core-foundation 0.9.3",
- "futures-core",
- "futures-util",
- "lazy_static",
- "libc",
- "mach",
- "nix 0.19.1",
- "pin-utils",
- "uom",
- "winapi",
-]
-
-[[package]]
-name = "heim-disk"
-version = "0.1.0-rc.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "75603ff3868851c04954ee86bf610a6bd45be2732a0e81c35fd72b2b90fa4718"
-dependencies = [
- "bitflags",
- "cfg-if",
- "core-foundation 0.9.3",
- "heim-common",
- "heim-runtime",
- "libc",
- "mach",
- "widestring",
- "winapi",
-]
-
-[[package]]
-name = "heim-runtime"
-version = "0.1.0-rc.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "54ec7e5238c8f0dd0cc60914d31a5a7aadd4cde74c966a76c1caed1f5224e9b8"
-dependencies = [
- "futures",
- "futures-timer",
- "once_cell",
- "smol",
-]
-
-[[package]]
name = "hermit-abi"
version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -925,15 +606,6 @@ dependencies = [
]
[[package]]
-name = "instant"
-version = "0.1.12"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
-dependencies = [
- "cfg-if",
-]
-
-[[package]]
name = "io-lifetimes"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1076,18 +748,6 @@ dependencies = [
[[package]]
name = "nix"
-version = "0.19.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b2ccba0cfe4fdf15982d1674c69b1fd80bad427d293849982668dfe454bd61f2"
-dependencies = [
- "bitflags",
- "cc",
- "cfg-if",
- "libc",
-]
-
-[[package]]
-name = "nix"
version = "0.23.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f866317acbd3a240710c63f065ffb1e4fd466259045ccb504130b7f668f35c6"
@@ -1127,27 +787,6 @@ dependencies = [
]
[[package]]
-name = "num-integer"
-version = "0.1.44"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db"
-dependencies = [
- "autocfg",
- "num-traits",
-]
-
-[[package]]
-name = "num-rational"
-version = "0.3.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "12ac428b1cb17fce6f731001d307d351ec70a6d202fc2e60f7d4c5e42d8f4f07"
-dependencies = [
- "autocfg",
- "num-integer",
- "num-traits",
-]
-
-[[package]]
name = "num-traits"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1211,12 +850,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64"
[[package]]
-name = "parking"
-version = "2.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72"
-
-[[package]]
name = "parking_lot"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1240,31 +873,6 @@ dependencies = [
]
[[package]]
-name = "pin-project-lite"
-version = "0.2.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116"
-
-[[package]]
-name = "pin-utils"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
-
-[[package]]
-name = "polling"
-version = "2.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "685404d509889fade3e86fe3a5803bca2ec09b0c0778d5ada6ec8bf7a8de5259"
-dependencies = [
- "cfg-if",
- "libc",
- "log",
- "wepoll-ffi",
- "winapi",
-]
-
-[[package]]
name = "predicates"
version = "2.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1522,46 +1130,12 @@ dependencies = [
]
[[package]]
-name = "slab"
-version = "0.4.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "eb703cfe953bccee95685111adeedb76fabe4e97549a58d16f03ea7b9367bb32"
-
-[[package]]
name = "smallvec"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83"
[[package]]
-name = "smol"
-version = "1.2.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "85cf3b5351f3e783c1d79ab5fc604eeed8b8ae9abd36b166e8b87a089efd85e4"
-dependencies = [
- "async-channel",
- "async-executor",
- "async-fs",
- "async-io",
- "async-lock",
- "async-net",
- "async-process",
- "blocking",
- "futures-lite",
- "once_cell",
-]
-
-[[package]]
-name = "socket2"
-version = "0.4.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "66d72b759436ae32898a2af0a14218dbf55efde3feeb170eb623637db85ee1e0"
-dependencies = [
- "libc",
- "winapi",
-]
-
-[[package]]
name = "starship-battery"
version = "0.7.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1639,7 +1213,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4c2f3ca6693feb29a89724516f016488e9aafc7f37264f898593ee4b942f31b"
dependencies = [
"cfg-if",
- "core-foundation-sys 0.8.3",
+ "core-foundation-sys 0.8.4",
"libc",
"ntapi",
"once_cell",
@@ -1810,7 +1384,6 @@ version = "0.30.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e76503e636584f1e10b9b3b9498538279561adcef5412927ba00c2b32c4ce5ed"
dependencies = [
- "num-rational",
"num-traits",
"typenum",
]
@@ -1825,12 +1398,6 @@ dependencies = [
]
[[package]]
-name = "waker-fn"
-version = "1.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca"
-
-[[package]]
name = "walkdir"
version = "2.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1854,21 +1421,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
-name = "wepoll-ffi"
-version = "0.1.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d743fdedc5c64377b5fc2bc036b01c7fd642205a0d96356034ae3404d49eb7fb"
-dependencies = [
- "cc",
-]
-
-[[package]]
-name = "widestring"
-version = "0.4.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c168940144dd21fd8046987c16a46a33d5fc84eec29ef9dcddc2ac9e31526b7c"
-
-[[package]]
name = "winapi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/Cargo.toml b/Cargo.toml
index ee8ac946..b188ace4 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "bottom"
-version = "0.8.1"
+version = "0.9.0"
authors = ["Clement Tsang <cjhtsang@uwaterloo.ca>"]
edition = "2021"
repository = "https://github.com/ClementTsang/bottom"
@@ -82,8 +82,6 @@ crossterm = "0.26.1"
ctrlc = { version = "3.2.5", features = ["termination"] }
dirs = "5.0.0"
fern = { version = "0.6.2", optional = true }
-futures = "0.3.26"
-futures-timer = "3.0.2"
fxhash = "0.2.1"
humantime = "2.1.0"
humantime-serde = "1.1.1"
@@ -109,17 +107,19 @@ unicode-width = "0.1.10"
libc = "0.2.141"
[target.'cfg(target_os = "linux")'.dependencies]
-heim = { version = "0.1.0-rc.1", features = ["disk"] }
procfs = { version = "0.15.1", default-features = false }
[target.'cfg(target_os = "macos")'.dependencies]
-heim = { version = "0.1.0-rc.1", features = ["disk"] }
+core-foundation = "0.9.3"
mach2 = "0.4.1"
[target.'cfg(target_os = "windows")'.dependencies]
-heim = { version = "0.1.0-rc.1", features = ["disk"] }
windows = { version = "0.48.0", features = [
"Win32_Foundation",
+ "Win32_Security",
+ "Win32_Storage_FileSystem",
+ "Win32_System_IO",
+ "Win32_System_Ioctl",
"Win32_System_ProcessStatus",
"Win32_System_Threading",
] }
diff --git a/src/app/data_farmer.rs b/src/app/data_farmer.rs
index d17c0545..b36946dc 100644
--- a/src/app/data_farmer.rs
+++ b/src/app/data_farmer.rs
@@ -16,8 +16,6 @@
use std::{collections::BTreeMap, time::Instant, vec::Vec};
use fxhash::FxHashMap;
-use once_cell::sync::Lazy;
-use regex::Regex;
#[cfg(feature = "battery")]
use crate::data_harvester::batteries;
@@ -317,23 +315,43 @@ impl DataCollection {
&mut self, disks: Vec<disks::DiskHarvest>, io: disks::IoHarvest, harvested_time: Instant,
) {
// TODO: [PO] To implement
-
let time_since_last_harvest = harvested_time
.duration_since(self.current_instant)
.as_secs_f64();
for (itx, device) in disks.iter().enumerate() {
- if let Some(trim) = device.name.split('/').last() {
- let io_device = if cfg!(target_os = "macos") {
- // Must trim one level further for macOS!
- static DISK_REGEX: Lazy<Regex> = Lazy::new(|| Regex::new(r"disk\d+").unwrap());
- if let Some(disk_trim) = DISK_REGEX.find(trim) {
- io.get(disk_trim.as_str())
+ let checked_name = {
+ cfg_if::cfg_if! {
+ if #[cfg(target_os = "windows")] {
+ match &device.volume_name {
+ Some(volume_name) => Some(volume_name.as_str()),
+ None => device.name.split('/').last(),
+ }
} else {
- None
+ device.name.split('/').last()
+ }
+ }
+ };
+
+ if let Some(checked_name) = checked_name {
+ let io_device = {
+ cfg_if::cfg_if! {
+ if #[cfg(target_os = "macos")] {
+ use once_cell::sync::Lazy;
+ use regex::Regex;
+
+ // Must trim one level further for macOS!
+ static DISK_REGEX: Lazy<Regex> =
+ Lazy::new(|| Regex::new(r"disk\d+").unwrap());
+ if let Some(new_name) = DISK_REGEX.find(checked_name) {
+ io.get(new_name.as_str())
+ } else {
+ None
+ }
+ } else {
+ io.get(checked_name)
+ }
}
- } else {
- io.get(trim)
};
if let Some(io_device) = io_device {
diff --git a/src/app/data_harvester.rs b/src/app/data_harvester.rs
index fce310e4..77e301f6 100644
--- a/src/app/data_harvester.rs
+++ b/src/app/data_harvester.rs
@@ -171,18 +171,27 @@ impl DataCollector {
}
}
+ // Sysinfo-related list refresh