Commit graph

933 commits

Author SHA1 Message Date
Clement Tsang
93d6718766
other: update a bunch of argument descriptions and some arg/config names (#1441)
* other: update a bunch of argument descriptions and some arg/config names

* update docs

* changelog
2024-04-10 20:46:35 -04:00
Lee Wonjoon
a083ec00dd
feature: Add option to set a position of legend (#1430)
* Add option to set a position of legend

* some small changes

---------

Co-authored-by: ClementTsang <34804052+ClementTsang@users.noreply.github.com>
2024-04-02 01:06:01 -04:00
Clement Tsang
2ee0df1502
change: use sysinfo's swap value for Windows (#1436)
* some consts

* change: use sysinfo's swap calculation for windows

I'll add an additional field for committed in a separate PR which shows
the previous value.
2024-03-27 22:24:14 -04:00
Clement Tsang
cd1715cd8f
other: add process uptime as a default column (#1411)
* other: add process uptime as a default column

* update docs
2024-02-15 03:27:19 -05:00
Clement Tsang
3ee883420a
bug: fix uptime calculation for Linux (#1410)
* bug: fix uptime for linux

Use another calculation to determine the uptime of a process on
Linux.

* appease clippy

* changelog

* edit add
2024-02-15 03:01:45 -05:00
Clement Tsang
b6660610d0
deps: bump ratatui to 0.26 (#1406)
* deps: bump ratatui to 0.26

* adjust process width

* a few nonzero optimizations

* add a todo

* update comments to be less confusing about time chart
2024-02-03 19:59:12 -05:00
Clement Tsang
5cf17f6015
other: flatten process config struct and clean up help text (#1395)
* refactor: flatten process config field

* other: clean up some doc formatting using indoc and breaklines

* fix broken test

* remove default as that breaks things for now

* add test

* more tests
2024-01-21 05:47:13 -05:00
Clement Tsang
975e3d776b
refactor: move some files around in prep for a future options refactor (#1393)
* some formatting

* refactor: move some files around in prep for a bigger config/options refactor
2024-01-18 18:46:00 -05:00
Clement Tsang
be4fa27b84
refactor: convert layout creation tests back to being unit tests (#1392) 2024-01-16 23:47:05 -05:00
Clement Tsang
f07994ef68
deps: bump sysinfo to =0.30.5 (#1390)
* deps: bump sysinfo to =0.30.5

* fix an import

* fix stuff for linux

* fix temps

* some fmt

* disks

* oops

* fix some bugs
2024-01-15 20:43:14 -05:00
Clement Tsang
f760ce1080
deps: bump non-root dependencies as of 2024-01-15 (#1387)
* deps: bump non-root dependencies as of 2024-01-15

* also test 1.70 unofficial msrv
2024-01-15 05:06:24 -05:00
Clement Tsang
dd66ae774c
refactor: simplify some config -> constraints code (#1383)
* refactor: simplify some config -> constraints code

* iteratively progress...

* update bcr; this might need testing since I removed some old proc code

* widget side

* fix battery

* fix widget tests with bandaid for now

The issue was that the calculations assume a certain ratio for CPU
legends.

* add some tests

* bump up

* fix proc drawing issues

So with the proc widget in certain places, there would be a panic during
constraint determination.

Looks like back when I wrote this I made some gross assumptions about
certain things. In particular, the problem here was that the search
added an additional "one" height, so that needs to be accounted for
after we removed the "doubling" code.

* tests

* fix tests

* reorganize tests

* clippy

* fix cross tests not working

* fix builds for android
2024-01-15 04:19:18 -05:00
Clement Tsang
a3541c9350
docs: use consistent wording around command-line options (#1378)
* docs: use consistent wording around command-line options

* fix missing code blocks
2024-01-11 02:14:05 -05:00
Clement Tsang
bc2c363a49
refactor: clean up arg code more (#1377)
* fix sort function

* Try macros

* Revert "Try macros"

This reverts commit 93c7306f8a.

* use next_help_heading instead

* test

* Revert "test"

This reverts commit 017a1702b3.

* Reapply "test"

This reverts commit 23c09d3828.

* use foldl instead :)

* a word

* different conditionals

* update docs, change ordering

* more formatting stuff
2024-01-11 00:25:53 -05:00
Clement Tsang
6b62176554
refactor: rearrange/resort args (#1376)
* clean up Cargo.toml

* some small cleanup

* refactor: group together similar args in the help generation and code

This groups together related arguments in both the help text and the
code itself.

* update changelog

* clippy

* builder pattern instead
2024-01-10 19:07:22 -05:00
Clement Tsang
0f969fcfd4
refactor: clean up help drawing code (#1374)
* refactor: clean up the help drawing

* a bit cleaner

* add test

* some fmt
2024-01-08 02:35:32 -05:00
Thomas Mühlbacher
0c161ae77e
feature: Add support for bcachefs (#1373)
Make sure that bcachefs mounts are also displayed in the disks widget.
bcachefs is a file system that will be included in the upcoming Linux
v6.7 kernel. Briefly tested this and it works on my system.
2024-01-04 11:18:45 -05:00
Clement Tsang
77777ef588
refactor: clean up some more drawing/component code (#1372)
* rename battery info widget file

* add widget trait

* move basic table arrows over

* some renaming

* more renaming and shuffling

* cleanup

* fmt
2024-01-02 01:24:13 -05:00
Clement Tsang
c242b4aff3
refactor: move around some configuration code again (#1371) 2024-01-01 17:39:10 -05:00
Clement Tsang
228da99489
refactor: move around configuration-related files (#1370)
* rename general utils file

* refactor: move around some configuration files

* more shuffling around

* fix some ugly formatting
2024-01-01 17:20:40 -05:00
Clement Tsang
e71048e394
other: update lints (#1369)
I have `missing_docs` disabled for now as that'll take a long time to
get through... maybe in a separate PR.
2024-01-01 05:34:53 -05:00
Clement Tsang
ecb6faa089
refactor: restructure canvas file folder structure (#1368)
* refactor: group together some canvas files

* rename file

* more shuffling around

* fmt

* more shuffling

Going to flatten widgets in another PR.

* some docs

* naming

* fmt
2024-01-01 05:19:52 -05:00
Clement Tsang
74792f0ddf
other: quick lint fixes for some warnings (#1367) 2023-12-30 23:28:44 -05:00
Clement Tsang
22b40780ad
refactor: pull data collection out of nested folder structure (#1364)
* refactor: pull data collection out of nested folder structure

* fix sysinfo

* comment
2023-12-27 23:00:58 -05:00
Justin Martin
28d2950d92
deps: update ratatui version (#1362)
* cargo update ratatui

* replace convert_arc_labels with convert_mem_labels

* remove redundant generic

---------

Co-authored-by: Clement Tsang <34804052+ClementTsang@users.noreply.github.com>
2023-12-25 17:28:54 -05:00
Clement Tsang
c10779ecc0
refactor: fix macro formatting in disk data collection code (#1363) 2023-12-25 17:26:32 -05:00
Clement Tsang
a1168cac67
refactor: remove once_cell (#1361)
* refactor: remove once_cell

* some missing fixes
2023-12-23 04:35:42 -05:00
Clement Tsang
854f3aed95
refactor: some more cleanups around linux temp code (#1360) 2023-12-20 19:18:50 -05:00
Clement Tsang
a67da93c5f
other: if in a non-D0 state, short-circuit further logic (#1355)
* other: if in a non-D0 state, short-circuit further logic

* cleanup

* add back an empty name and value

* fix for macos/windows

* some testing things
2023-12-20 01:36:08 -05:00
Clement Tsang
b6f92c2f3d
feature: support default selection of average CPU graph (#1353)
* feature: support default selection of average CPU graph

* test
2023-12-10 15:21:35 -05:00
Clement Tsang
fab86e833a
other: add back local time in debug logs (#1346)
* other: add back local time in debug logs

This still has a UTC fallback.

* cleanup and some warnings
2023-12-02 04:53:31 -05:00
Clement Tsang
074b205a82
other: change group -> group_processes for consistency between config and command-line args (#1344)
* other: change group -> group_processes to match config file name

* update docs

* update changelog
2023-12-01 02:46:22 -05:00
Clement Tsang
46b7881fb0
other: preallocate space for ellipsis (#1336) 2023-11-27 04:55:21 -05:00
Clement Tsang
590f03bd69
other: update generated config file (#1335) 2023-11-27 03:39:39 -05:00
Clement Tsang
eab8736dfd
refactor: iteratively detect ASCII and build string when truncating (#1334)
* refactor: iteratively detect ASCII and build string when truncating

* more tests

* test going by usize

* Revert "test going by usize"

This reverts commit 4fe71260e7.
2023-11-27 03:30:43 -05:00
Clement Tsang
94e4573ebc
refactor: add fast branch if the string is short enough to not be truncated (#1333)
* refactor: add fast branch if the entire string is definitely not truncated

* update comments
2023-11-24 03:13:06 -05:00
Clement Tsang
a93521d2b1
refactor: add fast branch for ascii-only string truncate (#1330)
This is just a first attempt to speed up what looked like a hot spot in samply's profiling results.

Benchmark code and results here: https://gist.github.com/ClementTsang/e242f12f7e1d1902ed414dcc18c3b321
2023-11-23 23:45:03 -05:00
Clement Tsang
ab9331140a
refactor: simplify temperature conversion function usage (#1326)
* refactor: simplify temperature conversion function usage

Just make it a function on the temperature type enum.

* fix sysinfo variant

* simple test
2023-11-20 03:08:24 -05:00
Clement Tsang
10a37c263a
change: small gpu proc changes (#1325)
* other: use consistent casing with Mem/Mem% in processes for GPU cols

* other: remove mem check for GPU enable check
2023-11-20 02:30:57 -05:00
Justin Martin
e4a6e751ec
feature: Add gpu proc info (#1276)
* Add gpu util, power and procs.

Consolidated gpu calls into `data_harvester`.

Changed config flag from `enable_gpu_memory` to `enable_gpu`.

Added GPU utilization to the cpu widget.

Added GPU process memory usage and utilization percentage to the proc widget.
Added key binds for gpu process toggling.

Added GPU power usage to the battery widget.
Added bounds check to battery widget header.
Show battery widget header when `gpu_enable`.

Added feature flag `legacy-functions` to `nvml-wrapper`.

updated config file(s).
updated help text.
updated docs.

* Code Review:

Remove GPU util from cpu widget
Remove GPU power from battery widget
Use reference for gpu widgets_to_harvest
Extract match arm to function for feature gate

* Code Review: add gmem% toggle

* Do not poll gpu temp when filtered

* Code Review Two Changes:

adjust doc wordings
remove extra references
remove extra widget harvest checks
init proc gpu values
use convert_temp_unit for gpu temp
2023-11-19 23:54:15 -05:00
Clement Tsang
5a17212f89
other: add additional clamping functions on numeric types (#1324)
* other: add additional clamping functions on numeric types

* add tests and replace one usage
2023-11-19 03:15:19 -05:00
Clement Tsang
4d2df4c4e9
refactor: clean up some query code and some ascii-only string comparisons (#1316)
* refactor: update some stuff in the query code

* do some eq_ignore_ascii work

* tests

* some docs, and rename files
2023-11-15 06:23:04 -05:00
Clement Tsang
8b9328e29e
refactor: comment on convoluted Filesystem::from_str code (#1315)
* refactor: use a less convoluted match for filesystem type conversion

* revert, just use comment

* just use if statements instead

* test

* inline
2023-11-15 04:13:19 -05:00
Yuri Astrakhan
5eb4fbde5d
chore: fix certain uninlined string format uses (#1310)
* Fixed uninlined args

First ran this, and fixed a few more similar issues by hand

```
cargo clippy --workspace --fix --benches --tests --bins -- -A clippy::all -W clippy::uninlined_format_args
```

Note that in a few cases, format args were passed by ref - which is actually a tiny perf hit - compiler would not be able to optimize them.

* revert change here

since it contains a non-inlineable variable I'm not a fan of using it partially here

* revert

given the other formats above/below I would prefer keeping it like this

---------

Co-authored-by: Clement Tsang <34804052+ClementTsang@users.noreply.github.com>
2023-11-15 03:47:22 -05:00
Devin-Yeung
d1d1498900
bug: fat32 mounts don't show up in macOS (#1314) 2023-11-14 23:57:24 -05:00
Yuri Astrakhan
712a003681
Chore: Remove un-needed lifetimes in a few calls (#1309) 2023-10-23 23:53:08 -04:00
Yuri Astrakhan
1e16456d5f
chore: Minor cleanup - remove un-needed ident qualifiers (#1307)
Keep code a bit tidier and consistent (i.e. if an identifier already has a `use` entry above, why in some cases still prove a full path to it?)
2023-10-22 22:29:03 -04:00
Clement Tsang
1ef0c05aa6
deps: bump dependencies as of 2023-08-26 (#1287) 2023-08-26 21:16:43 -04:00
Clement Tsang
e8f6d4853a
other: appease clippy after Rust 1.72.0 (#1281)
* deps: use clap 4.4.0 to remove is-terminal

* fmt

* appease clippy

* fmt again

* Revert "deps: use clap 4.4.0 to remove is-terminal"

This reverts commit 78aa6ec848.
2023-08-24 20:26:46 -04:00
Clement Tsang
ac55add21e
deps: bump windows to 0.51.1 (#1279)
* deps: bump windows to 0.51.1

* some changes to fit new API
2023-08-22 17:27:36 -04:00
Zeb Piasecki
a336c64330
bug: display arc max size in arc usage instead of system memory (#1264) 2023-07-27 03:56:25 -04:00
Clement Tsang
646c9f191b
deps: Update ratatui 0.22.0 (#1261)
* deps: bump ratatui to 0.22.0

* fix missing new fields
2023-07-21 00:19:25 -04:00
Gabriele Belluardo
83a8607e5b
other: full width battery bar (#1251) 2023-07-19 20:05:13 -04:00
Clement Tsang
b0cb308106
refactor: flatten IoCounter return value (#1253)
* refactor: rewrite io stats collection function result

* refactor: flatten IoCounters vector results
2023-07-11 01:18:58 -04:00
Justin Martin
b1a39026fb
add zfs io counters for linux and freebsd (#1248)
* add zfs io counters for linux and freebsd

* ci

* freebsd clippy

* code review: remove dead code for zfs feature gate of freebsd iocounters and squash if statement in zfs_io_counters
2023-07-09 17:50:22 -04:00
Clement Tsang
a10b91239b
bug: missing windows syscall to close the handle on drop when killing (#1245)
* bug: missing windows syscall to close the handle on drop when killing

* changelog

* fix
2023-07-05 01:40:12 -04:00
Clement Tsang
f21ffde068
other: removes the percent sign from battery widget labels (#1244) 2023-07-04 01:44:17 -04:00
Clement Tsang
beef65a460
other: remove the percentage sign for CPU usage in CPU widget (#1243) 2023-07-04 01:35:39 -04:00
Clement Tsang
df3088e80e
other: hide battery tab selector if there is only one battery (#1236)
* other: hide battery tab selector if there is only one battery

* update changelog
2023-07-02 00:38:40 -04:00
Clement Tsang
3f53818c54
other: remove some unnecessary vec allocations (#1234)
* other: remove unnecessary vector allocations in farmer

* other: remove unnecessary vector allocations when drawing tui Rows
2023-07-01 03:28:23 -04:00
Clement Tsang
9c368815dd
deps: bump deps as of 2023-06-29 (#1233)
* deps: bump deps as of 2023-06-29, clean up Cargo.toml a bit

* fix deprecated function call
2023-06-29 00:48:49 -04:00
Clement Tsang
aa191a981d
bug: fix core dump if the terminal is closed while bottom is open (#1230)
* bug: fix core dump if the terminal is closed

The cause was:

- bottom thinks it's panicking if the terminal is closed.
- The panic hook tried to print out to the terminal - but the terminal
  was closed! It would unwrap and thus panic even harder.
- To solve this, we just make the panic hook calls not unwrap, since
  honestly if they fail it's whatever as far as I understand it.

* update changelog
2023-06-27 01:57:32 -04:00
Clement Tsang
4ac3b43260
docs: update time-related documentation (#1222)
* docs: update time-related documentation

* fix retention too
2023-06-24 01:36:36 -04:00
Clement Tsang
cc3833289f
feature: support human times for rate (#1221) 2023-06-23 03:42:16 -04:00
Clement Tsang
0b7f4c745d
other: fix humantime-related documentation, add tests, support numbers + strings in toml (#1220)
* update documentation and support either numerical times or human times for time_delta and default_time_value

* update docs

* give more human times on error
2023-06-22 00:01:01 -04:00
Clement Tsang
6f1a8f7e5b
bug: fix overflow/underflow with graph timespan zoom (#1219)
* bug: fix overflow/underflow with graph timespan zoom

Basically, you could overflow/underflow the time span which would skip
checks.

* changelog
2023-06-21 00:03:48 -04:00
Clement Tsang
9e97680131
other: revert color help text change (#1217)
Didn't mean to push this, reverting it.
2023-06-19 02:40:48 -04:00
Clement Tsang
751abecfe3
other: take ownership of config and matches when building App (#1215)
The clap matches/config struct was taken in as a reference when building
the App structure. However, we do not need to keep these around after
this, so we can instead take ownership of the match/config and drop it
after to save a bit of memory.
2023-06-19 01:47:57 -04:00
Clement Tsang
594e091a93
bug: fix arguments being unsorted (#1216)
clap v4 apparently changed it so arguments are not sorted by default
like before - this manually sorts the arguments beforehand to achieve
the same effect.
2023-06-19 01:37:22 -04:00
Clement Tsang
7c0eda1034
other: use f32 for process percentage values (#1212)
* other: use f32 for process percentage values

This cuts down memory by a tiny bit, and we don't need a full f64 for
percentage values.

* fix for macos and windows
2023-06-18 02:11:57 -04:00
Clement Tsang
d6b6e0aea9
refactor: move out bits/bytes enum to utils (#1211) 2023-06-17 02:08:11 -04:00
Clement Tsang
2e5d59f84d
other: clean up some cfg usage (#1205)
* other: convert some cfg if

* fix
2023-06-13 01:25:20 -04:00
Clement Tsang
531e26ea45
other: post-0.9.2 cleanup (#1203)
* other: some cleanup

* other: add conditional logging macros

* more cleanup

* use compile-time feature for some text in clap
2023-06-12 01:01:07 -04:00
Clement Tsang
9560722318
feature: on Linux, check coretemp and don't fail fast with name generation when gathering temps (#1188)
* feature: also check coretemp on Linux when gathering temps

* update changelog

* add comment

* add logic to check thermal zone if there are no hwmon entries

* cleanup

* handle duplicates between hwmon and thermal zone

* Revert "handle duplicates between hwmon and thermal zone"

This reverts commit 402606cc62f27ba196ef2ade6a669ae84aedf0e0.

* cleanup

* back to running thermal zone if no hwmon

* prevent failure cases

* temp logging

* name refactoring

* port dupe name logic to hwmon

* Cleanup, add fallback to sensor name

* more tests

* Fix log

* update changelog

* cleanup and more tests
2023-06-11 18:12:15 -04:00
Clement Tsang
9ec95a9740
ci: add a build check for aarch64-linux-android (#1124)
* ci: add a build check for aarch64-linux-android

* appease clippy

* use 1.67.0 for Android due to NDK issue

* remove sparse since it is default now for 1.70 and causes issues with older versions anyway
2023-06-11 02:01:56 -04:00
Clement Tsang
2a354f772f
other: remaining changes needed to get android to build (#1199)
* other: remaining changes needed to get android to build

* update changelog

* simplify disk os-specific code
2023-06-11 01:35:16 -04:00
Clement Tsang
2ba7394ac2
other: have dummy fallback for disk I/O for unsupported OSes (#1198) 2023-06-11 00:01:14 -04:00
Clement Tsang
13a8e5bf0e
refactor: redo how we do get processes between different OSes (#1197)
* refactor: redo how we do some processes between different OSes

* cleanup

* more cleanup

* windows

* freebsd

* clean up linux more, fix broken FreeBSD import

* some more cleanup to remove some big imports
2023-06-10 01:44:15 -04:00
database64128
48422c4111
bug: ntfs3 mounts don't show up (#1191)
Partitions mounted using the ntfs3 driver in linux (mainlined since 5.15)
won't show up because the name didn't match.
2023-06-08 13:07:18 -04:00
Clement Tsang
1cc0e910b4
refactor: remove outdated collection thread code (#1190)
This was going to be used for in-app config, but it's so old that it's
probably better to just rip it out and start anew in that regard.
2023-06-08 02:48:29 -04:00
Clement Tsang
f0121e6af4
other: enforce unused_imports lint again (#1189)
* other: enforce unused_imports lint again

I think there shouldn't be any issues with enforcing this now...

* set up cfg block so the logging feature doesn't break clippy

* some cleanup + comments
2023-06-08 02:28:36 -04:00
Clement Tsang
086b622c66
feature: use better names for duplicate temp sensors found by /sys/class/thermal (#1187)
* docs: update changelog

* feature: add a counter to duplicate names if using /sys/class/thermal/

* update changelog
2023-06-08 00:05:30 -04:00
Clement Tsang
358bddf990
bug: when getting Linux temps, don't bail ASAP if they fail (#1186)
* bug: when getting Linux temps, don't bail ASAP if they fail

This meant that if hwmon failed, it would never try and get temperatures
from thermal or GPU. The same is true for thermal failing leading to GPU
never running.

* update docs
2023-06-07 21:47:05 -04:00
Clement Tsang
5e0900584b
refactor: change canvas macOS check to compile-time (#1184) 2023-06-04 00:18:24 -04:00
Clement Tsang
c6d322263e
other: fix links and broken references in doc comments (#1182) 2023-06-03 05:44:52 -04:00
Clement Tsang
852e2e86c7
refactor: remove typed-builder (#1181) 2023-06-02 00:53:38 -04:00
Clement Tsang
4e99f31ad0
deps: bump ratatui to 0.21.0 (#1178) 2023-05-31 00:21:55 -04:00
Clement Tsang
74953455dc
refactor: clean up some Linux proc collection code (#1179) 2023-05-31 00:21:34 -04:00
Clement Tsang
635e82a8a2
refactor: remove typed builder from App struct (#1176)
Another one on the chopping block. This also moves out the app
widget logic to a separate struct.
2023-05-28 00:46:13 -04:00
Clement Tsang
eccaf11937
feature: support human times for default_time_value and time_delta (#1172)
* feature: support human times for time interval and default range

* add tests, fix not using ms

* appease clippy

* changelog
2023-05-26 00:42:40 -04:00
Clement Tsang
6b9663a2c2
other: clean up some fixmes (#1171) 2023-05-26 00:19:28 -04:00
Clement Tsang
69318465ae
other: simplify termination/event loop logic (#1169)
This just simplifies the logic around ctrl-c and termination logic and
event loop logic to something simpler and without the need for timeouts
and/or atomics.

Instead, we just make termination an event sent by ctrl-c and use the
same receiver for event handling to react to it and break the loop.
2023-05-25 00:13:04 -04:00
Clement Tsang
b6dc17cfb3
other: clean up thread event code (#1170) 2023-05-24 01:05:49 -04:00
Clement Tsang
caa1d1b88b
refactor: remove procfs (#1163)
* refactor: remove procfs, use personal impls/rustix directly

* buffer sharing

* inline

* some cleanup
2023-05-21 00:53:27 -04:00
Clement Tsang
8a49c49267
refactor: remove TypedBuilder for col (#1162)
* refactor: remove TypedBuilder for col

* clean up basic
2023-05-20 01:27:42 -04:00
Clement Tsang
463b0fbef8
refactor: remove TypedBuilder for widget (#1159)
* refactor: remove TypedBuilder for widget

* group together cpu

* clean up proc too
2023-05-18 05:45:07 -04:00
Clement Tsang
a1a48bc647
refactor: remove TypedBuilder for col row (#1158) 2023-05-17 02:43:08 -04:00
Clement Tsang
b9c106c9cf
refactor: remove unused typed-builder proc macro usage in options (#1156) 2023-05-16 00:03:34 -04:00
Clement Tsang
3a8d85d487
refactor: use macros for initializing canvas styles (#1149)
* refactor: use macros for initializing canvas styles

* add quotes

* Simplify macro

* update tests

* more renaming
2023-05-13 05:22:09 -04:00
Clement Tsang
bcca7e2621
bug: fix gruvbox cache colour being invalid (#1148)
* bug: fix gruvbox cache colour being invalid

* update changelog
2023-05-12 04:39:07 -04:00