mirror of
https://github.com/ClementTsang/bottom.git
synced 2025-07-27 07:34:27 +02:00
Merge remote-tracking branch 'origin/master' into re-merge
# Conflicts: # src/data_conversion.rs
This commit is contained in:
commit
f6a0b55a5d
51
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
51
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
@ -15,20 +15,6 @@ body:
|
||||
issues.
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: description
|
||||
validations:
|
||||
required: true
|
||||
attributes:
|
||||
label: Describe the issue
|
||||
description: >
|
||||
Give a high level description of the issue, the expected behaviour, and the observed behaviour.
|
||||
If possible, provide screenshots/videos.
|
||||
placeholder: |
|
||||
Example:
|
||||
bottom is failing to output information for a mounted encrypted partition on basic mode. It should
|
||||
be able to report this information, but I'm not seeing the entry at all.
|
||||
|
||||
- type: input
|
||||
id: operating_system
|
||||
attributes:
|
||||
@ -89,6 +75,43 @@ body:
|
||||
|
||||
# TODO: After some point also add in a `btm check` invocation
|
||||
|
||||
- type: textarea
|
||||
id: description
|
||||
validations:
|
||||
required: true
|
||||
attributes:
|
||||
label: Describe the issue
|
||||
description: >
|
||||
Give a description of the issue. If possible, provide screenshots/videos.
|
||||
placeholder: |
|
||||
Example:
|
||||
bottom is failing to output information for a mounted encrypted partition on basic mode. It should
|
||||
be able to report this information, but I'm not seeing the entry at all.
|
||||
|
||||
- type: textarea
|
||||
id: expected
|
||||
validations:
|
||||
required: true
|
||||
attributes:
|
||||
label: What is the expected behaviour?
|
||||
description: >
|
||||
Describe the behaviour you expected.
|
||||
placeholder: |
|
||||
Example:
|
||||
I expect to be able to see information about the encrypted partition on basic mode.
|
||||
|
||||
- type: textarea
|
||||
id: actual
|
||||
validations:
|
||||
required: true
|
||||
attributes:
|
||||
label: What is the actual behaviour?
|
||||
description: >
|
||||
Describe the behaviour you actually see. If possible, provide screenshots/videos.
|
||||
placeholder: |
|
||||
Example:
|
||||
I am unable to see information about my encrypted partition.
|
||||
|
||||
- type: textarea
|
||||
id: reproduce
|
||||
validations:
|
||||
|
161
Cargo.lock
generated
161
Cargo.lock
generated
@ -27,10 +27,16 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.69"
|
||||
name = "anstyle"
|
||||
version = "0.3.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800"
|
||||
checksum = "23ea9e81bd02e310c216d080f6223c179012256e5151c41db88d12c88a1684d2"
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.70"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7de8ce5e0f9f8d88245311066a578d72b7af3e7088f32783804676302df237e4"
|
||||
|
||||
[[package]]
|
||||
name = "assert_cmd"
|
||||
@ -40,7 +46,7 @@ checksum = "93ae1ddd39efd67689deb1979d80bad3bf7f2b09c6e6117c8d1f2443b5e2f83e"
|
||||
dependencies = [
|
||||
"bstr",
|
||||
"doc-comment",
|
||||
"predicates",
|
||||
"predicates 2.1.5",
|
||||
"predicates-core",
|
||||
"predicates-tree",
|
||||
"wait-timeout",
|
||||
@ -235,7 +241,7 @@ dependencies = [
|
||||
"mach2",
|
||||
"nvml-wrapper",
|
||||
"once_cell",
|
||||
"predicates",
|
||||
"predicates 3.0.2",
|
||||
"procfs",
|
||||
"regex",
|
||||
"serde",
|
||||
@ -529,7 +535,7 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"strsim 0.9.3",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -540,7 +546,7 @@ checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72"
|
||||
dependencies = [
|
||||
"darling_core",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -551,22 +557,22 @@ checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8"
|
||||
|
||||
[[package]]
|
||||
name = "dirs"
|
||||
version = "4.0.0"
|
||||
version = "5.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059"
|
||||
checksum = "dece029acd3353e3a58ac2e3eb3c8d6c35827a892edc6cc4138ef9c33df46ecd"
|
||||
dependencies = [
|
||||
"dirs-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dirs-sys"
|
||||
version = "0.3.7"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6"
|
||||
checksum = "04414300db88f70d74c5ff54e50f9e1d1737d9a5b90f53fcf2e95ca2a9ab554b"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"redox_users",
|
||||
"winapi",
|
||||
"windows-sys 0.45.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -590,7 +596,7 @@ dependencies = [
|
||||
"heck",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -631,9 +637,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "fern"
|
||||
version = "0.6.1"
|
||||
version = "0.6.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3bdd7b0849075e79ee9a1836df22c717d1eba30451796fdc631b04565dd11e2a"
|
||||
checksum = "d9f0c14694cbd524c8720dd69b0e3179344f04ebb5f90f2e4a440c6ea3b2f1ee"
|
||||
dependencies = [
|
||||
"log",
|
||||
]
|
||||
@ -735,7 +741,7 @@ checksum = "95a73af87da33b5acf53acfebdc339fe592ecf5357ac7c0a7734ab9d8c876a70"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -910,9 +916,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "1.9.2"
|
||||
version = "1.9.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399"
|
||||
checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"hashbrown",
|
||||
@ -975,9 +981,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.137"
|
||||
version = "0.2.140"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89"
|
||||
checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c"
|
||||
|
||||
[[package]]
|
||||
name = "libloading"
|
||||
@ -1264,6 +1270,18 @@ version = "2.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "59230a63c37f3e18569bdb90e4a89cbf5bf8b06fea0b84e65ea10cc4df47addd"
|
||||
dependencies = [
|
||||
"difflib",
|
||||
"itertools",
|
||||
"predicates-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "predicates"
|
||||
version = "3.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c575290b64d24745b6c57a12a31465f0a66f3a4799686a6921526a33b0797965"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"difflib",
|
||||
"float-cmp",
|
||||
"itertools",
|
||||
@ -1290,9 +1308,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.49"
|
||||
version = "1.0.54"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5"
|
||||
checksum = "e472a104799c74b514a57226160104aa483546de37e839ec50e3c2e41dd87534"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
@ -1312,9 +1330,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.18"
|
||||
version = "1.0.26"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1"
|
||||
checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
@ -1365,9 +1383,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.7.1"
|
||||
version = "1.7.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733"
|
||||
checksum = "8b1f693b24f6ac912f4893ef08244d70b6067480d2f1a46e950c9691e6749d1d"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
@ -1382,9 +1400,9 @@ checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132"
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.6.28"
|
||||
version = "0.6.29"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848"
|
||||
checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1"
|
||||
|
||||
[[package]]
|
||||
name = "roff"
|
||||
@ -1435,29 +1453,29 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.152"
|
||||
version = "1.0.158"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb"
|
||||
checksum = "771d4d9c4163ee138805e12c710dd365e4f44be8be0503cb1bb9eb989425d9c9"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.152"
|
||||
version = "1.0.158"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e"
|
||||
checksum = "e801c1712f48475582b7696ac71e0ca34ebb30e09338425384269d9717c62cad"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 2.0.10",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.93"
|
||||
version = "1.0.95"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cad406b69c91885b5107daf2c29572f6c8cdb3c66826821e286c533490c0bc76"
|
||||
checksum = "d721eca97ac802aa7777b701877c8004d950fc142651367300d21c1cc0194744"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"ryu",
|
||||
@ -1589,6 +1607,17 @@ dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5aad1363ed6d37b84299588d62d3a7d95b5a5c2d9aad5c85609fda12afaa1f40"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sysctl"
|
||||
version = "0.5.4"
|
||||
@ -1605,9 +1634,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "sysinfo"
|
||||
version = "0.26.9"
|
||||
version = "0.28.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c18a6156d1f27a9592ee18c1a846ca8dd5c258b7179fc193ae87c74ebb666f5"
|
||||
checksum = "b4c2f3ca6693feb29a89724516f016488e9aafc7f37264f898593ee4b942f31b"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"core-foundation-sys 0.8.3",
|
||||
@ -1654,22 +1683,22 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.38"
|
||||
version = "1.0.40"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0"
|
||||
checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.38"
|
||||
version = "1.0.40"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f"
|
||||
checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 2.0.10",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1710,9 +1739,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "toml_edit"
|
||||
version = "0.19.4"
|
||||
version = "0.19.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9a1eb0622d28f4b9c90adc4ea4b2b46b47663fde9ac5fafcb14a1369d5508825"
|
||||
checksum = "239410c8609e8125456927e6707163a3b1fdb40561e4b803bc041f466ccfdc13"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"serde",
|
||||
@ -1742,7 +1771,7 @@ checksum = "89851716b67b937e393b3daa8423e67ddfc4bbbf1654bcf05488e95e0828db0c"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1872,9 +1901,9 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
|
||||
[[package]]
|
||||
name = "windows"
|
||||
version = "0.44.0"
|
||||
version = "0.46.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9e745dab35a0c4c77aa3ce42d595e13d2003d6902d6b08c9ef5fc326d08da12b"
|
||||
checksum = "cdacb41e6a96a052c6cb63a144f24900236121c6f63f4f8219fef5977ecb0c25"
|
||||
dependencies = [
|
||||
"windows-targets",
|
||||
]
|
||||
@ -1905,9 +1934,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.42.1"
|
||||
version = "0.42.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7"
|
||||
checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm",
|
||||
"windows_aarch64_msvc",
|
||||
@ -1920,51 +1949,51 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.42.1"
|
||||
version = "0.42.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608"
|
||||
checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.42.1"
|
||||
version = "0.42.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7"
|
||||
checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.42.1"
|
||||
version = "0.42.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640"
|
||||
checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.42.1"
|
||||
version = "0.42.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605"
|
||||
checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.42.1"
|
||||
version = "0.42.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45"
|
||||
checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.42.1"
|
||||
version = "0.42.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463"
|
||||
checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.42.1"
|
||||
version = "0.42.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd"
|
||||
checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0"
|
||||
|
||||
[[package]]
|
||||
name = "winnow"
|
||||
version = "0.3.3"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "faf09497b8f8b5ac5d3bb4d05c0a99be20f26fd3d5f2db7b0716e946d5103658"
|
||||
checksum = "ae8970b36c66498d8ff1d66685dc86b91b29db0c7739899012f63a63814b4b28"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
@ -1978,5 +2007,5 @@ dependencies = [
|
||||
"darling",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"syn 1.0.107",
|
||||
]
|
||||
|
26
Cargo.toml
26
Cargo.toml
@ -72,7 +72,7 @@ default = ["fern", "log", "battery", "gpu", "zfs"]
|
||||
deploy = ["battery", "gpu", "zfs"]
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0.69"
|
||||
anyhow = "1.0.70"
|
||||
backtrace = "0.3.67"
|
||||
cfg-if = "1.0.0"
|
||||
clap = { version = "3.2.2", features = ["default", "cargo", "wrap_help"] }
|
||||
@ -80,33 +80,33 @@ concat-string = "1.0.1"
|
||||
const_format = "0.2.30"
|
||||
crossterm = "0.26.1"
|
||||
ctrlc = { version = "3.2.5", features = ["termination"] }
|
||||
dirs = "4.0.0"
|
||||
fern = { version = "0.6.1", optional = true }
|
||||
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"
|
||||
indexmap = "1.9.2"
|
||||
indexmap = "1.9.3"
|
||||
itertools = "0.10.5"
|
||||
kstring = { version = "2.0.0", features = ["arc"] }
|
||||
log = { version = "0.4.17", optional = true }
|
||||
nvml-wrapper = { version = "0.9.0", optional = true }
|
||||
once_cell = "1.5.2"
|
||||
regex = "1.7.1"
|
||||
serde = { version = "1.0.152", features = ["derive"] }
|
||||
regex = "1.7.3"
|
||||
serde = { version = "1.0.158", features = ["derive"] }
|
||||
starship-battery = { version = "0.7.9", optional = true }
|
||||
sysinfo = "0.26.7"
|
||||
thiserror = "1.0.38"
|
||||
sysinfo = "0.28.4"
|
||||
thiserror = "1.0.40"
|
||||
time = { version = "0.3.20", features = ["formatting", "macros"] }
|
||||
toml_edit = { version = "0.19.4", features = ["serde"] }
|
||||
toml_edit = { version = "0.19.8", features = ["serde"] }
|
||||
tui = "0.19.0"
|
||||
typed-builder = "0.10.0"
|
||||
unicode-segmentation = "1.10.1"
|
||||
unicode-width = "0.1.10"
|
||||
|
||||
[target.'cfg(unix)'.dependencies]
|
||||
libc = "0.2.124"
|
||||
libc = "0.2.140"
|
||||
|
||||
[target.'cfg(target_os = "linux")'.dependencies]
|
||||
heim = { version = "0.1.0-rc.1", features = ["disk"] }
|
||||
@ -118,20 +118,20 @@ mach2 = "0.4.1"
|
||||
|
||||
[target.'cfg(target_os = "windows")'.dependencies]
|
||||
heim = { version = "0.1.0-rc.1", features = ["disk"] }
|
||||
windows = { version = "0.44.0", features = [
|
||||
windows = { version = "0.46.0", features = [
|
||||
"Win32_Foundation",
|
||||
"Win32_System_ProcessStatus",
|
||||
"Win32_System_Threading",
|
||||
] }
|
||||
|
||||
[target.'cfg(target_os = "freebsd")'.dependencies]
|
||||
serde_json = { version = "1.0.93" }
|
||||
serde_json = { version = "1.0.95" }
|
||||
sysctl = { version = "0.5.4" }
|
||||
filedescriptor = "0.8.2"
|
||||
|
||||
[dev-dependencies]
|
||||
assert_cmd = "2.0.4" # cannot update this due to once_cell
|
||||
predicates = "2.1.5"
|
||||
predicates = "3.0.2"
|
||||
|
||||
[dev-dependencies.cargo-husky]
|
||||
version = "1.5.0"
|
||||
|
@ -19,10 +19,21 @@ which generally seems better supported out of the box, at the expense of looking
|
||||
<figcaption><sub>Example using <code>btm --dot_marker</code></sub></figcaption>
|
||||
</figure>
|
||||
|
||||
Another (better) alternative is to install a font that supports braille fonts, and configure your terminal to use it. For example, installing
|
||||
something like [UBraille](https://yudit.org/download/fonts/UBraille/) or [Iosevka](https://github.com/be5invis/Iosevka)
|
||||
Another (better) alternative is to install a font that supports braille fonts, and configure your terminal emulator to use it.
|
||||
For example, installing something like [UBraille](https://yudit.org/download/fonts/UBraille/) or [Iosevka](https://github.com/be5invis/Iosevka)
|
||||
and ensuring your terminal uses it should work.
|
||||
|
||||
### Braille font issues on Linux/macOS/Unix-like
|
||||
|
||||
Generally, the problem comes down to you either not having a font that supports the braille markers, or your terminal
|
||||
emulator is not using the correct font for the braille markers.
|
||||
|
||||
See [here](https://github.com/cjbassi/gotop/issues/18) for possible fixes if you're having font issues on Linux, which
|
||||
may also be helpful for macOS or other Unix-like systems.
|
||||
|
||||
If you're still having issues, feel free to open a [discussion](https://github.com/ClementTsang/bottom/discussions/new/)
|
||||
question about it.
|
||||
|
||||
### Installing fonts for Windows Command Prompt/PowerShell
|
||||
|
||||
**Note: I would advise backing up your registry beforehand if you aren't sure what you are doing!**
|
||||
|
@ -1,5 +1,5 @@
|
||||
mkdocs == 1.4.2
|
||||
mkdocs-material == 9.1.3
|
||||
mkdocs-material == 9.1.4
|
||||
mkdocs-material-extensions == 1.1.1
|
||||
mdx_truly_sane_lists == 1.3
|
||||
mike == 1.1.2
|
||||
|
@ -1,6 +1,6 @@
|
||||
//! This is the main file to house data collection functions.
|
||||
|
||||
use std::time::Instant;
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
use fxhash::FxHashMap;
|
||||
@ -104,13 +104,6 @@ impl Data {
|
||||
pub struct DataCollector {
|
||||
pub data: Data,
|
||||
sys: System,
|
||||
#[cfg(target_os = "linux")]
|
||||
pid_mapping: FxHashMap<crate::Pid, processes::PrevProcDetails>,
|
||||
#[cfg(target_os = "linux")]
|
||||
prev_idle: f64,
|
||||
#[cfg(target_os = "linux")]
|
||||
prev_non_idle: f64,
|
||||
mem_total_kb: u64,
|
||||
temperature_type: TemperatureType,
|
||||
use_current_cpu_total: bool,
|
||||
unnormalized_cpu: bool,
|
||||
@ -119,11 +112,19 @@ pub struct DataCollector {
|
||||
total_tx: u64,
|
||||
show_average_cpu: bool,
|
||||
widgets_to_harvest: UsedWidgets,
|
||||
filters: DataFilters,
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
pid_mapping: FxHashMap<crate::Pid, processes::PrevProcDetails>,
|
||||
#[cfg(target_os = "linux")]
|
||||
prev_idle: f64,
|
||||
#[cfg(target_os = "linux")]
|
||||
prev_non_idle: f64,
|
||||
|
||||
#[cfg(feature = "battery")]
|
||||
battery_manager: Option<Manager>,
|
||||
#[cfg(feature = "battery")]
|
||||
battery_list: Option<Vec<Battery>>,
|
||||
filters: DataFilters,
|
||||
|
||||
#[cfg(target_family = "unix")]
|
||||
user_table: self::processes::UserTable,
|
||||
@ -140,7 +141,6 @@ impl DataCollector {
|
||||
prev_idle: 0_f64,
|
||||
#[cfg(target_os = "linux")]
|
||||
prev_non_idle: 0_f64,
|
||||
mem_total_kb: 0,
|
||||
temperature_type: TemperatureType::Celsius,
|
||||
use_current_cpu_total: false,
|
||||
unnormalized_cpu: false,
|
||||
@ -160,35 +160,6 @@ impl DataCollector {
|
||||
}
|
||||
|
||||
pub fn init(&mut self) {
|
||||
self.sys.refresh_memory();
|
||||
self.mem_total_kb = self.sys.total_memory();
|
||||
|
||||
// Refresh network list once at the start.
|
||||
if self.widgets_to_harvest.use_net {
|
||||
self.sys.refresh_networks_list(); // TODO: refresh on a timer?
|
||||
}
|
||||
|
||||
if self.widgets_to_harvest.use_proc || self.widgets_to_harvest.use_cpu {
|
||||
self.sys.refresh_cpu();
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
{
|
||||
// Refresh components list once.
|
||||
if self.widgets_to_harvest.use_temp {
|
||||
self.sys.refresh_components_list(); // TODO: refresh on a timer?
|
||||
}
|
||||
|
||||
if cfg!(target_os = "windows") && self.widgets_to_harvest.use_proc {
|
||||
self.sys.refresh_users_list();
|
||||
}
|
||||
|
||||
// Refresh disk list once...
|
||||
if cfg!(target_os = "freebsd") && self.widgets_to_harvest.use_disk {
|
||||
self.sys.refresh_disks_list();
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "battery")]
|
||||
{
|
||||
if self.widgets_to_harvest.use_battery {
|
||||
@ -204,6 +175,17 @@ impl DataCollector {
|
||||
}
|
||||
}
|
||||
|
||||
if self.widgets_to_harvest.use_net {
|
||||
self.sys.refresh_networks_list();
|
||||
}
|
||||
if self.widgets_to_harvest.use_temp {
|
||||
self.sys.refresh_components_list();
|
||||
}
|
||||
#[cfg(target_os = "windows")]
|
||||
if self.widgets_to_harvest.use_proc {
|
||||
self.sys.refresh_users_list();
|
||||
}
|
||||
|
||||
futures::executor::block_on(self.update_data());
|
||||
|
||||
std::thread::sleep(std::time::Duration::from_millis(250));
|
||||
@ -230,53 +212,63 @@ impl DataCollector {
|
||||
self.show_average_cpu = show_average_cpu;
|
||||
}
|
||||
|
||||
pub async fn update_data(&mut self) {
|
||||
if self.widgets_to_harvest.use_proc || self.widgets_to_harvest.use_cpu {
|
||||
/// Refresh sysinfo data.
|
||||
fn refresh_sysinfo_data(&mut self) {
|
||||
// Refresh once every minute. If it's too frequent it can cause segfaults.
|
||||
const LIST_REFRESH_TIME: Duration = Duration::from_secs(60);
|
||||
let refresh_start = Instant::now();
|
||||
|
||||
if self.widgets_to_harvest.use_cpu || self.widgets_to_harvest.use_proc {
|
||||
self.sys.refresh_cpu();
|
||||
}
|
||||
|
||||
if self.widgets_to_harvest.use_mem {
|
||||
if self.widgets_to_harvest.use_mem || self.widgets_to_harvest.use_proc {
|
||||
self.sys.refresh_memory();
|
||||
}
|
||||
|
||||
if self.widgets_to_harvest.use_net {
|
||||
if refresh_start.duration_since(self.last_collection_time) > LIST_REFRESH_TIME {
|
||||
self.sys.refresh_networks_list();
|
||||
}
|
||||
self.sys.refresh_networks();
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
{
|
||||
if self.widgets_to_harvest.use_proc {
|
||||
#[cfg(target_os = "windows")]
|
||||
if refresh_start.duration_since(self.last_collection_time) > LIST_REFRESH_TIME {
|
||||
self.sys.refresh_users_list();
|
||||
}
|
||||
|
||||
self.sys.refresh_processes();
|
||||
}
|
||||
|
||||
if self.widgets_to_harvest.use_temp {
|
||||
if refresh_start.duration_since(self.last_collection_time) > LIST_REFRESH_TIME {
|
||||
self.sys.refresh_components_list();
|
||||
}
|
||||
self.sys.refresh_components();
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "freebsd")]
|
||||
if self.widgets_to_harvest.use_disk {
|
||||
self.sys.refresh_disks();
|
||||
}
|
||||
|
||||
pub async fn update_data(&mut self) {
|
||||
self.refresh_sysinfo_data();
|
||||
|
||||
let current_instant = Instant::now();
|
||||
|
||||
self.update_cpu_usage();
|
||||
self.update_memory_usage();
|
||||
self.update_processes(
|
||||
#[cfg(target_os = "linux")]
|
||||
current_instant,
|
||||
);
|
||||
self.update_temps();
|
||||
self.update_memory_usage();
|
||||
self.update_network_usage(current_instant);
|
||||
|
||||
#[cfg(feature = "battery")]
|
||||
if let Some(battery_manager) = &self.battery_manager {
|
||||
if let Some(battery_list) = &mut self.battery_list {
|
||||
self.data.list_of_batteries =
|
||||
Some(batteries::refresh_batteries(battery_manager, battery_list));
|
||||
}
|
||||
}
|
||||
self.update_batteries();
|
||||
|
||||
let (disk_res, io_res) = futures::join!(
|
||||
disks::get_disk_usage(
|
||||
@ -316,6 +308,12 @@ impl DataCollector {
|
||||
fn update_processes(&mut self, #[cfg(target_os = "linux")] current_instant: Instant) {
|
||||
if self.widgets_to_harvest.use_proc {
|
||||
if let Ok(mut process_list) = {
|
||||
let total_memory = if let Some(memory) = &self.data.memory {
|
||||
memory.total_bytes
|
||||
} else {
|
||||
self.sys.total_memory()
|
||||
};
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
use self::processes::{PrevProc, ProcHarvestOptions};
|
||||
@ -340,7 +338,7 @@ impl DataCollector {
|
||||
&mut self.pid_mapping,
|
||||
proc_harvest_options,
|
||||
time_diff,
|
||||
self.mem_total_kb,
|
||||
total_memory,
|
||||
&mut self.user_table,
|
||||
)
|
||||
}
|
||||
@ -352,7 +350,7 @@ impl DataCollector {
|
||||
&self.sys,
|
||||
self.use_current_cpu_total,
|
||||
self.unnormalized_cpu,
|
||||
self.mem_total_kb,
|
||||
total_memory,
|
||||
&mut self.user_table,
|
||||
)
|
||||
}
|
||||
@ -362,7 +360,7 @@ impl DataCollector {
|
||||
&self.sys,
|
||||
self.use_current_cpu_total,
|
||||
self.unnormalized_cpu,
|
||||
self.mem_total_kb,
|
||||
total_memory,
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -441,6 +439,17 @@ impl DataCollector {
|
||||
self.data.network = Some(net_data);
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[cfg(feature = "battery")]
|
||||
fn update_batteries(&mut self) {
|
||||
if let Some(battery_manager) = &self.battery_manager {
|
||||
if let Some(battery_list) = &mut self.battery_list {
|
||||
self.data.list_of_batteries =
|
||||
Some(batteries::refresh_batteries(battery_manager, battery_list));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "freebsd")]
|
||||
|
@ -23,7 +23,7 @@ pub mod arc;
|
||||
|
||||
#[derive(Debug, Clone, Default)]
|
||||
pub struct MemHarvest {
|
||||
pub total_kib: u64,
|
||||
pub used_kib: u64,
|
||||
pub use_percent: Option<f64>,
|
||||
pub used_bytes: u64,
|
||||
pub total_bytes: u64,
|
||||
pub use_percent: Option<f64>, // TODO: Might be find to just make this an f64, and any consumer checks NaN.
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ pub(crate) fn get_arc_usage() -> Option<MemHarvest> {
|
||||
}
|
||||
}
|
||||
}
|
||||
(mem_total / 1024, mem_arc / 1024)
|
||||
(mem_total, mem_arc)
|
||||
} else {
|
||||
(0, 0)
|
||||
}
|
||||
@ -50,7 +50,7 @@ pub(crate) fn get_arc_usage() -> Option<MemHarvest> {
|
||||
if let (Ok(sysctl::CtlValue::U64(arc)), Ok(sysctl::CtlValue::Ulong(mem))) =
|
||||
(mem_arc_value.value(), mem_sys_value.value())
|
||||
{
|
||||
(mem / 1024, arc / 1024)
|
||||
(mem, arc)
|
||||
} else {
|
||||
(0, 0)
|
||||
}
|
||||
@ -64,8 +64,8 @@ pub(crate) fn get_arc_usage() -> Option<MemHarvest> {
|
||||
};
|
||||
|
||||
Some(MemHarvest {
|
||||
total_kib: mem_total_in_kib,
|
||||
used_kib: mem_used_in_kib,
|
||||
total_bytes: mem_total_in_kib,
|
||||
used_bytes: mem_used_in_kib,
|
||||
use_percent: if mem_total_in_kib == 0 {
|
||||
None
|
||||
} else {
|
||||
|
@ -22,17 +22,15 @@ fn get_nvidia_mem_usage() -> Option<Vec<(String, MemHarvest)>> {
|
||||
if let Ok(device) = nvml.device_by_index(i) {
|
||||
if let (Ok(name), Ok(mem)) = (device.name(), device.memory_info()) {
|
||||
// add device memory in bytes
|
||||
let mem_total_in_kib = mem.total / 1024;
|
||||
let mem_used_in_kib = mem.used / 1024;
|
||||
results.push((
|
||||
name,
|
||||
MemHarvest {
|
||||
total_kib: mem_total_in_kib,
|
||||
used_kib: mem_used_in_kib,
|
||||
use_percent: if mem_total_in_kib == 0 {
|
||||
total_bytes: mem.total,
|
||||
used_bytes: mem.used,
|
||||
use_percent: if mem.total == 0 {
|
||||
None
|
||||
} else {
|
||||
Some(mem_used_in_kib as f64 / mem_total_in_kib as f64 * 100.0)
|
||||
Some(mem.used as f64 / mem.total as f64 * 100.0)
|
||||
},
|
||||
},
|
||||
));
|
||||
|
@ -6,16 +6,16 @@ use crate::data_harvester::memory::MemHarvest;
|
||||
|
||||
/// Returns RAM usage.
|
||||
pub(crate) fn get_ram_usage(sys: &System) -> Option<MemHarvest> {
|
||||
let mem_used_in_kib = sys.used_memory() / 1024;
|
||||
let mem_total_in_kib = sys.total_memory() / 1024;
|
||||
let mem_used = sys.used_memory();
|
||||
let mem_total = sys.total_memory();
|
||||
|
||||
Some(MemHarvest {
|
||||
total_kib: mem_total_in_kib,
|
||||
used_kib: mem_used_in_kib,
|
||||
use_percent: if mem_total_in_kib == 0 {
|
||||
used_bytes: mem_used,
|
||||
total_bytes: mem_total,
|
||||
use_percent: if mem_total == 0 {
|
||||
None
|
||||
} else {
|
||||
Some(mem_used_in_kib as f64 / mem_total_in_kib as f64 * 100.0)
|
||||
Some(mem_used as f64 / mem_total as f64 * 100.0)
|
||||
},
|
||||
})
|
||||
}
|
||||
@ -23,16 +23,16 @@ pub(crate) fn get_ram_usage(sys: &System) -> Option<MemHarvest> {
|
||||
/// Returns SWAP usage.
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
pub(crate) fn get_swap_usage(sys: &System) -> Option<MemHarvest> {
|
||||
let mem_used_in_kib = sys.used_swap() / 1024;
|
||||
let mem_total_in_kib = sys.total_swap() / 1024;
|
||||
let mem_used = sys.used_swap();
|
||||
let mem_total = sys.total_swap();
|
||||
|
||||
Some(MemHarvest {
|
||||
total_kib: mem_total_in_kib,
|
||||
used_kib: mem_used_in_kib,
|
||||
use_percent: if mem_total_in_kib == 0 {
|
||||
used_bytes: mem_used,
|
||||
total_bytes: mem_total,
|
||||
use_percent: if mem_total == 0 {
|
||||
None
|
||||
} else {
|
||||
Some(mem_used_in_kib as f64 / mem_total_in_kib as f64 * 100.0)
|
||||
Some(mem_used as f64 / mem_total as f64 * 100.0)
|
||||
},
|
||||
})
|
||||
}
|
||||
|
@ -21,8 +21,8 @@ pub(crate) fn get_swap_usage() -> Option<MemHarvest> {
|
||||
let swap_used = perf_info.PageSize.saturating_mul(perf_info.CommitTotal) as u64;
|
||||
|
||||
Some(MemHarvest {
|
||||
total_kib: swap_total / 1024,
|
||||
used_kib: swap_used / 1024,
|
||||
used_bytes: swap_used,
|
||||
total_bytes: swap_total,
|
||||
use_percent: Some(swap_used as f64 / swap_total as f64 * 100.0),
|
||||
})
|
||||
} else {
|
||||
|
@ -25,14 +25,14 @@ struct ProcessRow {
|
||||
}
|
||||
|
||||
pub fn get_process_data(
|
||||
sys: &System, use_current_cpu_total: bool, unnormalized_cpu: bool, mem_total_kb: u64,
|
||||
sys: &System, use_current_cpu_total: bool, unnormalized_cpu: bool, total_memory: u64,
|
||||
user_table: &mut UserTable,
|
||||
) -> crate::utils::error::Result<Vec<ProcessHarvest>> {
|
||||
super::macos_freebsd::get_process_data(
|
||||
sys,
|
||||
use_current_cpu_total,
|
||||
unnormalized_cpu,
|
||||
mem_total_kb,
|
||||
total_memory,
|
||||
user_table,
|
||||
get_freebsd_process_cpu_usage,
|
||||
)
|
||||
|
@ -116,7 +116,7 @@ fn get_linux_cpu_usage(
|
||||
|
||||
fn read_proc(
|
||||
prev_proc: &PrevProcDetails, process: &Process, cpu_usage: f64, cpu_fraction: f64,
|
||||
use_current_cpu_total: bool, time_difference_in_secs: u64, mem_total_kb: u64,
|
||||
use_current_cpu_total: bool, time_difference_in_secs: u64, total_memory: u64,
|
||||
user_table: &mut UserTable,
|
||||
) -> error::Result<(ProcessHarvest, u64)> {
|
||||
let stat = process.stat()?;
|
||||
@ -164,8 +164,7 @@ fn read_proc(
|
||||
);
|
||||
let parent_pid = Some(stat.ppid);
|
||||
let mem_usage_bytes = stat.rss_bytes();
|
||||
let mem_usage_kb = mem_usage_bytes / 1024;
|
||||
let mem_usage_percent = mem_usage_kb as f64 / mem_total_kb as f64 * 100.0;
|
||||
let mem_usage_percent = mem_usage_bytes as f64 / total_memory as f64 * 100.0;
|
||||
|
||||
// This can fail if permission is denied!
|
||||
let (total_read_bytes, total_write_bytes, read_bytes_per_sec, write_bytes_per_sec) =
|
||||
@ -233,7 +232,7 @@ pub(crate) struct ProcHarvestOptions {
|
||||
|
||||
pub(crate) fn get_process_data(
|
||||
sys: &System, prev_proc: PrevProc<'_>, pid_mapping: &mut FxHashMap<Pid, PrevProcDetails>,
|
||||
proc_harvest_options: ProcHarvestOptions, time_difference_in_secs: u64, mem_total_kb: u64,
|
||||
proc_harvest_options: ProcHarvestOptions, time_difference_in_secs: u64, total_memory: u64,
|
||||
user_table: &mut UserTable,
|
||||
) -> crate::utils::error::Result<Vec<ProcessHarvest>> {
|
||||
let ProcHarvestOptions {
|
||||
@ -280,7 +279,7 @@ pub(crate) fn get_process_data(
|
||||
cpu_fraction,
|
||||
use_current_cpu_total,
|
||||
time_difference_in_secs,
|
||||
mem_total_kb,
|
||||
total_memory,
|
||||
user_table,
|
||||
) {
|
||||
prev_proc_details.cpu_time = new_process_times;
|
||||
|
@ -7,14 +7,14 @@ use crate::{data_harvester::processes::UserTable, Pid};
|
||||
mod sysctl_bindings;
|
||||
|
||||
pub fn get_process_data(
|
||||
sys: &System, use_current_cpu_total: bool, unnormalized_cpu: bool, mem_total_kb: u64,
|
||||
sys: &System, use_current_cpu_total: bool, unnormalized_cpu: bool, mem_total: u64,
|
||||
user_table: &mut UserTable,
|
||||
) -> crate::utils::error::Result<Vec<ProcessHarvest>> {
|
||||
super::macos_freebsd::get_process_data(
|
||||
sys,
|
||||
use_current_cpu_total,
|
||||
unnormalized_cpu,
|
||||
mem_total_kb,
|
||||
mem_total,
|
||||
user_table,
|
||||
get_macos_process_cpu_usage,
|
||||
)
|
||||
|
@ -9,7 +9,7 @@ use super::ProcessHarvest;
|
||||
use crate::{data_harvester::processes::UserTable, utils::error::Result, Pid};
|
||||
|
||||
pub fn get_process_data<F>(
|
||||
sys: &System, use_current_cpu_total: bool, unnormalized_cpu: bool, mem_total_kb: u64,
|
||||
sys: &System, use_current_cpu_total: bool, unnormalized_cpu: bool, total_memory: u64,
|
||||
user_table: &mut UserTable, backup_cpu_proc_usage: F,
|
||||
) -> Result<Vec<ProcessHarvest>>
|
||||
where
|
||||
@ -88,8 +88,8 @@ where
|
||||
},
|
||||
name,
|
||||
command,
|
||||
mem_usage_percent: if mem_total_kb > 0 {
|
||||
process_val.memory() as f64 * 100.0 / mem_total_kb as f64
|
||||
mem_usage_percent: if total_memory > 0 {
|
||||
process_val.memory() as f64 * 100.0 / total_memory as f64
|
||||
} else {
|
||||
0.0
|
||||
},
|
||||
|
@ -5,7 +5,7 @@ use sysinfo::{CpuExt, PidExt, ProcessExt, System, SystemExt, UserExt};
|
||||
use super::ProcessHarvest;
|
||||
|
||||
pub fn get_process_data(
|
||||
sys: &System, use_current_cpu_total: bool, unnormalized_cpu: bool, mem_total_kb: u64,
|
||||
sys: &System, use_current_cpu_total: bool, unnormalized_cpu: bool, total_memory: u64,
|
||||
) -> crate::utils::error::Result<Vec<ProcessHarvest>> {
|
||||
let mut process_vector: Vec<ProcessHarvest> = Vec::new();
|
||||
let process_hashmap = sys.processes();
|
||||
@ -63,8 +63,8 @@ pub fn get_process_data(
|
||||
parent_pid: process_val.parent().map(|p| p.as_u32() as _),
|
||||
name,
|
||||
command,
|
||||
mem_usage_percent: if mem_total_kb > 0 {
|
||||
process_val.memory() as f64 * 100.0 / mem_total_kb as f64
|
||||
mem_usage_percent: if total_memory > 0 {
|
||||
process_val.memory() as f64 * 100.0 / total_memory as f64
|
||||
} else {
|
||||
0.0
|
||||
},
|
||||
|
@ -1,5 +1,4 @@
|
||||
#![warn(rust_2018_idioms)]
|
||||
#![allow(clippy::uninlined_format_args)]
|
||||
#![deny(clippy::missing_safety_doc)]
|
||||
#[allow(unused_imports)]
|
||||
#[cfg(feature = "log")]
|
||||
|
@ -260,6 +260,26 @@ pub fn convert_swap_data_points(current_data: &DataCollection) -> Vec<Point> {
|
||||
result
|
||||
}
|
||||
|
||||
/// Returns the most appropriate binary prefix unit type (e.g. kibibyte) and denominator for the given amount of bytes.
|
||||
///
|
||||
/// The expected usage is to divide out the given value with the returned denominator in order to be able to use it
|
||||
/// with the returned binary unit (e.g. divide 3000 bytes by 1024 to have a value in KiB).
|
||||
fn get_mem_binary_unit_and_denominator(bytes: u64) -> (&'static str, f64) {
|
||||
if bytes < KIBI_LIMIT {
|
||||
// Stick with bytes if under a kibibyte.
|
||||
("B", 1.0)
|
||||
} else if bytes < MEBI_LIMIT {
|
||||
("KiB", KIBI_LIMIT_F64)
|
||||
} else if bytes < GIBI_LIMIT {
|
||||
("MiB", MEBI_LIMIT_F64)
|
||||
} else if bytes < TEBI_LIMIT {
|
||||
("GiB", GIBI_LIMIT_F64)
|
||||
} else {
|
||||
// Otherwise just use tebibytes, which is probably safe for most use cases.
|
||||
("TiB", TEBI_LIMIT_F64)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn convert_mem_label(harvest: &MemHarvest) -> Option<(String, String)> {
|
||||
/// Returns the unit type and denominator for given total amount of memory in kibibytes.
|
||||
fn return_unit_and_denominator_for_mem_kib(mem_total_kib: u64) -> (&'static str, f64) {
|
||||
@ -539,24 +559,7 @@ pub fn convert_battery_harvest(current_data: &DataCollection) -> Vec<ConvertedBa
|
||||
pub fn convert_arc_labels(
|
||||
current_data: &crate::app::data_farmer::DataCollection,
|
||||
) -> Option<(String, String)> {
|
||||
/// Returns the unit type and denominator for given total amount of memory in kibibytes.
|
||||
fn return_unit_and_denominator_for_mem_kib(mem_total_kib: u64) -> (&'static str, f64) {
|
||||
if mem_total_kib < 1024 {
|
||||
// Stay with KiB
|
||||
("KiB", 1.0)
|
||||
} else if mem_total_kib < MEBI_LIMIT {
|
||||
// Use MiB
|
||||
("MiB", KIBI_LIMIT_F64)
|
||||
} else if mem_total_kib < GIBI_LIMIT {
|
||||
// Use GiB
|
||||
("GiB", MEBI_LIMIT_F64)
|
||||
} else {
|
||||
// Use TiB
|
||||
("TiB", GIBI_LIMIT_F64)
|
||||
}
|
||||
}
|
||||
|
||||
if current_data.arc_harvest.total_kib > 0 {
|
||||
if current_data.arc_harvest.total_bytes > 0 {
|
||||
Some((
|
||||
format!(
|
||||
"{:3.0}%",
|
||||
@ -564,14 +567,12 @@ pub fn convert_arc_labels(
|
||||
),
|
||||
{
|
||||
let (unit, denominator) =
|
||||
return_unit_and_denominator_for_mem_kib(current_data.arc_harvest.total_kib);
|
||||
get_mem_binary_unit_and_denominator(current_data.arc_harvest.total_bytes);
|
||||
|
||||
format!(
|
||||
" {:.1}{}/{:.1}{}",
|
||||
current_data.arc_harvest.used_kib as f64 / denominator,
|
||||
unit,
|
||||
(current_data.arc_harvest.total_kib as f64 / denominator),
|
||||
unit
|
||||
" {:.1}{unit}/{:.1}{unit}",
|
||||
current_data.arc_harvest.used_bytes as f64 / denominator,
|
||||
(current_data.arc_harvest.total_bytes as f64 / denominator),
|
||||
)
|
||||
},
|
||||
))
|
||||
@ -614,23 +615,6 @@ pub struct ConvertedGpuData {
|
||||
pub fn convert_gpu_data(
|
||||
current_data: &crate::app::data_farmer::DataCollection,
|
||||
) -> Option<Vec<ConvertedGpuData>> {
|
||||
/// Returns the unit type and denominator for given total amount of memory in kibibytes.
|
||||
fn return_unit_and_denominator_for_mem_kib(mem_total_kib: u64) -> (&'static str, f64) {
|
||||
if mem_total_kib < 1024 {
|
||||
// Stay with KiB
|
||||
("KiB", 1.0)
|
||||
} else if mem_total_kib < MEBI_LIMIT {
|
||||
// Use MiB
|
||||
("MiB", KIBI_LIMIT_F64)
|
||||
} else if mem_total_kib < GIBI_LIMIT {
|
||||
// Use GiB
|
||||
("GiB", MEBI_LIMIT_F64)
|
||||
} else {
|
||||
// Use TiB
|
||||
("TiB", GIBI_LIMIT_F64)
|
||||
}
|
||||
}
|
||||
|
||||
let current_time = current_data.current_instant;
|
||||
|
||||
// convert points
|
||||
@ -671,14 +655,12 @@ pub fn convert_gpu_data(
|
||||
mem_percent: format!("{:3.0}%", gpu.1.use_percent.unwrap_or(0.0)),
|
||||
mem_total: {
|
||||
let (unit, denominator) =
|
||||
return_unit_and_denominator_for_mem_kib(gpu.1.total_kib);
|
||||
get_mem_binary_unit_and_denominator(gpu.1.total_bytes);
|
||||
|
||||
format!(
|
||||
" {:.1}{}/{:.1}{}",
|
||||
gpu.1.used_kib as f64 / denominator,
|
||||
unit,
|
||||
(gpu.1.total_kib as f64 / denominator),
|
||||
unit
|
||||
" {:.1}{unit}/{:.1}{unit}",
|
||||
gpu.1.used_bytes as f64 / denominator,
|
||||
(gpu.1.total_bytes as f64 / denominator),
|
||||
)
|
||||
},
|
||||
}
|
||||
|
@ -6,15 +6,14 @@
|
||||
//! bottom, refer to [here](https://clementtsang.github.io/bottom/stable/).
|
||||
|
||||
#![warn(rust_2018_idioms)]
|
||||
#![allow(clippy::uninlined_format_args)]
|
||||
#![deny(clippy::missing_safety_doc)]
|
||||
// TODO: Deny unused imports.
|
||||
#[allow(unused_imports)]
|
||||
// Only used for builds not intended for release.
|
||||
#[cfg(feature = "log")]
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
|
||||
// TODO: Deny unused imports.
|
||||
|
||||
use std::{
|
||||
boxed::Box,
|
||||
fs,
|
||||
|
Loading…
x
Reference in New Issue
Block a user