Skip to content

Commit

Permalink
Added const to make rate switching in the future easier.
Browse files Browse the repository at this point in the history
  • Loading branch information
ClementTsang committed Sep 25, 2019
1 parent b5cacb3 commit 674de1a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 16 deletions.
16 changes: 1 addition & 15 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ Note this will probably migrate to GitHub's native Issues; this was mostly for p

## After making public

- Consider bumping up the refresh rate to 3000?

- Arrow keys for lists. This is a priority!
- Scrolling support for temp/disk

- Travis

Expand All @@ -46,18 +44,8 @@ Note this will probably migrate to GitHub's native Issues; this was mostly for p

- Remove any `unwrap()`, ensure no crashing! Might have to use this: <https://doc.rust-lang.org/std/panic/fn.catch_unwind.html>

- Scrolling event in lists

- Switching between panels

- Truncate columns if needed for tables

- Test for Windows support, mac support, other. May be doable, depends on sysinfo and how much I know about other OSes probably.

- Seems like the braille symbols are borked on windows.

- Issue with typing after windows version runs!

- Efficiency!!!

- Filtering in processes (that is, allow searching)
Expand All @@ -66,6 +54,4 @@ Note this will probably migrate to GitHub's native Issues; this was mostly for p

- Modularity

- ~~Potentially process managing? Depends on the libraries...~~ Done on Linux!

- Probably good to add a "are you sure" to dd-ing...
1 change: 1 addition & 0 deletions src/constants.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// TODO: Store like three minutes of data, then change how much is shown based on scaling!
pub const STALE_MAX_MILLISECONDS : u64 = 60 * 1000; // We wish to store at most 60 seconds worth of data. This may change in the future, or be configurable.
pub const TICK_RATE_IN_MILLISECONDS : u64 = 200; // We use this as it's a good value to work with.
pub const DEFAULT_REFRESH_RATE_IN_MILLISECONDS : u128 = 1000;
10 changes: 9 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,15 @@ fn main() -> error::Result<()> {
//.after_help("Themes:") // TODO: This and others disabled for now
.get_matches();

let update_rate_in_milliseconds : u128 = matches.value_of("RATE_MILLIS").unwrap_or("1000").parse::<u128>()?;
let update_rate_in_milliseconds : u128 = if matches.is_present("RATE_MILLIS") {
matches
.value_of("RATE_MILLIS")
.unwrap_or(&constants::DEFAULT_REFRESH_RATE_IN_MILLISECONDS.to_string())
.parse::<u128>()?
}
else {
constants::DEFAULT_REFRESH_RATE_IN_MILLISECONDS
};

if update_rate_in_milliseconds < 250 {
return Err(RustopError::InvalidArg {
Expand Down

0 comments on commit 674de1a

Please sign in to comment.