summaryrefslogtreecommitdiffstats
path: root/src/utils
AgeCommit message (Collapse)Author
2024-05-07refactor: extract unicode-ellipsis into its own crate (#1465)Clement Tsang
* refactor: extract unicode-ellipsis into its own crate * 0.1.4
2024-05-07refactor: some string-related code cleanup/refactor (#1463)Clement Tsang
* other: organize some utility function files * deps: remove kstring * refactor: some naming changes * refactor: some more small refactoring/naming changes * simplify to_cell to return a Cow * enable lints
2024-04-28deps: bump deps as of 2024-04-28 (#1450)Clement Tsang
* deps: bump deps as of 2024-04-28 * fix tests * extra test
2024-02-03deps: bump ratatui to 0.26 (#1406)Clement Tsang
* 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-01-01refactor: move around configuration-related files (#1370)Clement Tsang
* rename general utils file * refactor: move around some configuration files * more shuffling around * fix some ugly formatting
2023-12-23refactor: remove once_cell (#1361)Clement Tsang
* refactor: remove once_cell * some missing fixes
2023-12-20other: if in a non-D0 state, short-circuit further logic (#1355)Clement Tsang
* 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-02other: add back local time in debug logs (#1346)Clement Tsang
* other: add back local time in debug logs This still has a UTC fallback. * cleanup and some warnings
2023-11-27other: preallocate space for ellipsis (#1336)Clement Tsang
2023-11-27refactor: iteratively detect ASCII and build string when truncating (#1334)Clement Tsang
* refactor: iteratively detect ASCII and build string when truncating * more tests * test going by usize * Revert "test going by usize" This reverts commit 4fe71260e70696a0bb5907c97a2ca049fc23214c.
2023-11-24refactor: add fast branch if the string is short enough to not be truncated ↵Clement Tsang
(#1333) * refactor: add fast branch if the entire string is definitely not truncated * update comments
2023-11-23refactor: add fast branch for ascii-only string truncate (#1330)Clement Tsang
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-19other: add additional clamping functions on numeric types (#1324)Clement Tsang
* other: add additional clamping functions on numeric types * add tests and replace one usage
2023-11-15refactor: clean up some query code and some ascii-only string comparisons ↵Clement Tsang
(#1316) * refactor: update some stuff in the query code * do some eq_ignore_ascii work * tests * some docs, and rename files
2023-11-15chore: fix certain uninlined string format uses (#1310)Yuri Astrakhan
* 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-10-22chore: Minor cleanup - remove un-needed ident qualifiers (#1307)Yuri Astrakhan
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-06-17refactor: move out bits/bytes enum to utils (#1211)Clement Tsang
2023-06-12other: post-0.9.2 cleanup (#1203)Clement Tsang
* other: some cleanup * other: add conditional logging macros * more cleanup * use compile-time feature for some text in clap
2023-05-31deps: bump ratatui to 0.21.0 (#1178)Clement Tsang
2023-05-21refactor: remove procfs (#1163)Clement Tsang
* refactor: remove procfs, use personal impls/rustix directly * buffer sharing * inline * some cleanup
2023-05-02feature: show running time of processes (#801)Yuxuan Shui
* feature: show running time of processes * fix clippy * add time searching * update changelog * use safer duration for linux in case of 0 * some cleanup * quick hack to deal with some Windows processes returning unix epoch time as start time --------- Co-authored-by: Clement Tsang <34804052+ClementTsang@users.noreply.github.com>
2023-04-10refactor: migrate disk collection code off of heim, remove heim (#1064)Clement Tsang
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
2023-03-03refactor: migrate memory collection to sysinfo for all platforms (#1036)Clement Tsang
* cleanup * refactor: remove heim memory code * add missing updates, remove heim memory feature * restrict export visibility * some refactoring, remove smol * gpu feature
2023-03-01other: switch to toml_edit (#1034)Clement Tsang
2023-01-18other: switch to windows-rs for process killing (#985)Clement Tsang
2022-12-31bug: fix search scrolling with wider Unicode characters. (#938)Clement Tsang
This should help make search scrolling more reliable larger Unicode characters like CJK/flag characters.
2022-12-05bug: fix incorrect text width calculation (#925)Clement Tsang
* bug: fix incorrect text calculation * actual fix, add tests * appease clippy * add link to inspiration
2022-11-29other: slightly reduce the CPU time spent for draws (#918)Clement Tsang
* other: group all dataset draws in a time chart We used to draw each data set separately as a new canvas. Now, in one canvas, we draw all datasets. Note that this changes how dataset lines are drawn - rather than drawing one on top of another, it now draws kinda all at once. This effect is *kinda* a bit better IMO, but it might also look a bit more cluttered. * other: optimize truncate_text Flamegraphs showed that this area seems to be a bit heavy at times with some inefficient use of iterators and collection. This change should hopefully optimize this a bit by reducing some collections or reallocations. There can also be some further optimizations with less allocations from callers. * Reduce some redundant draws
2022-11-21other: don't use manual map for color name mapping (#908)Clement Tsang
* other: don't use manual map for color name mapping I actually don't know why I was doing it like that before. This commit removes the phf crate, as it's not needed anymore. * update test
2022-11-20other: clean up some strings (#904)Clement Tsang
* other: clean up some strings * formatting
2022-11-17other: deduplicate sorts, always sort proc by PID first (#898)Clement Tsang
* other: deduplicate sorts, sort proc by PID by default * add proc test * remove sort in Windows * fix tree * fix test * Remove mut * Add comment on sorting processes
2022-11-10refactor: run cargo +nightly fmt with group_imports (#885)Clement Tsang
* refactor: add some disabled unstable fmt options * run cargo +nightly fmt with group_imports * separate out the cfg-specific imports for clarity
2022-11-08deps: Update tui to 0.19.0 and crossterm to 0.25.0 (#878)Clement Tsang
* deps: update tui to 0.19 and crossterm to 0.25 * fix error * handle breaking changes
2022-10-12refactor: tables V2 (#749)Clement Tsang
* refactor: move to new data table implementation * more work towards refactor * move disk and temp over, fix longstanding bug with disk and temp if removing the last value and selected * work towards porting over CPU work towards porting over CPU fix typo partially port over cpu, fix some potentially inefficient concat_string calls more work towards cpu widget migration some refactoring * sortable data sortable data more refactoring some sort refactoring more refactoringgggg column refactoring renaming and reorganizing more refactoring regarding column logic add sort arrows again * move over sort menu * port over process port over process precommit temp temp two, remember to squash work fix broken ltr calculation and CPU hiding add back row styling temp fix a bunch of issues, get proc working more fixes around click fix frozen issues * fix dd process killing * revert some of the persistent config changes from #257 * fix colouring for trees * fix missing entries in tree * keep columns if there is no data * add and remove tests * Fix ellipsis
2022-07-23Implement support for FreeBSD (#766)Wesley Moore
* WIP FreeBSD support * Implement get_cpu_data_list for FreeBSD * Implement disks for FreeBSD It doesn't work though as sysinfo doesn't make the device name available. * Use libxo to read process cpu info on FreeBSD * Populate get_io_usage with libxo too Actual I/O stats still aren't populated though as there's not an easy source for them. * Share more processes code between macos and freebsd * Extract function for deserializing libxo output on FreeBSD * Implement filtering of disks in FreeBSD * Clean up memory data collection * Update module docs
2022-05-15refactor: simplify partial ordering fn, clean up codeClementTsang
2022-05-15refactor: remove redundant get_ordering fn, add testsClementTsang
2022-05-15bug: fix issues with macos and windows during refactorClementTsang
2022-05-15refactor: more work towards unifying process codeClementTsang
A bunch of work towards also refactoring how the process widget gathers and converts data.
2021-12-23deps: update time to 0.3.5 (#643)Clement Tsang
Updates time to 0.3.5: https://github.com/time-rs/time/blob/main/CHANGELOG.md#035-2021-11-12
2021-10-17deps: bump deps, remove chrono (#600)Clement Tsang
Bumps up some dependencies and removes chrono, switching to the time crate instead. One of side-effects of this change is that local time seems to not work (?)... so all logs are now in UTC. Oh well, this doesn't affect general user behaviour so I'm fine with it.
2021-07-12refactor: remove beef dependency for nowClementTsang
This is just a temp change, I wanted to remove it just for clarity's sake among dependencies, and will probably add it back in the future. For now I'll just stick to std's beef.
2021-05-13refactor: switch to procfs library (#479)Clement Tsang
Switch the Linux proc parts to the procfs library: https://crates.io/crates/procfs.
2021-04-04feature: Rework network y-axis, linear interpolation for off-screen data (#437)Clement Tsang
Rewrite of the y-axis labeling and scaling for the network widget, along with more customization. This still has one step to be optimized (cache results so we don't have to recalculate the legend each time), but will be done in another PR for sake of this one being too large already. Furthermore, this change adds linear interpolation at the 0 point in the case a data point shoots too far back - this seems to have lead to ugly gaps to the left of graphs in some cases, because the left hand limit was not big enough for the data point. We address this by grabbing values just outside the time range and linearly interpolating at the leftmost limit. This affects all graph widgets (CPU, mem, network). This can be optimized, and will hopefully be prior to release in a separate change.
2021-02-28feature: User info in proc widget for Unix-based systems (#425)Clement Tsang
Adds users into the process widget (for Unix-based systems). This shows only in non-grouped modes, similar to state. Search is also supported. In addition, a quick fix to prevent users from being in grouped mode when they tried to enter tree mode while grouped.
2020-12-17refactor: re-use heim for ARM targets if possible (#360)Clement Tsang
Use heim on ARM targets again where appropriate.
2020-12-12refactor: More minor optimization changes (#353)Clement Tsang
- Move data rather than cloning during data transferring step - Try using beef?
2020-12-11refactor: Use feature flags to avoid building with fern and log (#351)Clement Tsang
2020-09-30Use tmp_dir rather than /tmp/ (#260)Clement Tsang
Uses a less hard-coded method of writing to /tmp/.
2020-09-30feature: add --debug flag for logging (#259)Clement Tsang
Adds a `--debug` flag to aid in debugging issues. This saves to `/tmp/bottom_debug.log`.