Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce the number of digits shown in UI #224

Closed
carllerche opened this issue Dec 17, 2021 · 4 comments · Fixed by #402
Closed

Reduce the number of digits shown in UI #224

carllerche opened this issue Dec 17, 2021 · 4 comments · Fixed by #402
Assignees
Labels
C-console Crate: console. E-easy Effort: easy. Good for newcomers S-feature Severity: feature. This is adding a new feature.

Comments

@carllerche
Copy link
Member

It probably doesn't make much sense to include fractions in the numbers displayed in the UI.

ref: https://news.ycombinator.com/item?id=29596537

@carllerche carllerche self-assigned this Dec 17, 2021
@hawkw
Copy link
Member

hawkw commented Dec 17, 2021

I think we probably do want one or two fractional digits, at least for larger units like seconds, but definitely not 4 like we have currently.

@hawkw hawkw added S-feature Severity: feature. This is adding a new feature. E-easy Effort: easy. Good for newcomers C-console Crate: console. labels Dec 17, 2021
@pnkfelix
Copy link
Contributor

Can we just vary the fraction so that we aim for 3 significant figures total when the non-fractional part is less than 1000? (And when its >= 1000, then the fractional part should be hidden.)

Is that the wrong way to look at this?

@hawkw
Copy link
Member

hawkw commented Dec 17, 2021

not directly related, but we probably also want to format durations over one or two minutes as minutes + seconds, rather than as a large number of seconds, which it looks like std::time::Duration's fmt::Debug implementation doesn't do. So, at some point, we're definitely going to end up writing our own duration formatter, and we can probably implement significant figures logic there as well?

@carllerche
Copy link
Member Author

I think we probably do want one or two fractional digits, at least for larger units like seconds, but definitely not 4 like we have currently.

Depends... 5m20s maybe, but 3.245ms... probably not. I think 3ms would make more sense there.

@hawkw hawkw closed this as completed in #402 Mar 8, 2023
hawkw pushed a commit that referenced this issue Mar 8, 2023
The durations in the tokio-console UI are shown with a unit, so the
digits after the decimal separator are generally not relevant. Since
space is at a premium in a terminal UI, it makes sense to cut down where
possible.

This change removes all digits after the decimal separator in the tasks
table view. In the task detail view, 2 decimal places are kept.

Additionally, 4 new duration formats are added to represent
minutes-with-secondsi, hours-with-minutes, days-with-hours and days.
These are only applied once the leading unit is greater than zero.

For example, 59 seconds will be shown as seconds: `99s` and then 60
seconds will be shown as minutes-with-seconds: `1m00s`. New colors have
been chosen for each format.

NOTE: I had to make a small unrelated change in
`task::Details::make_percentiles_widget` to make clippy happy.

Fixes: #224
hawkw pushed a commit that referenced this issue Sep 29, 2023
The durations in the tokio-console UI are shown with a unit, so the
digits after the decimal separator are generally not relevant. Since
space is at a premium in a terminal UI, it makes sense to cut down where
possible.

This change removes all digits after the decimal separator in the tasks
table view. In the task detail view, 2 decimal places are kept.

Additionally, 4 new duration formats are added to represent
minutes-with-secondsi, hours-with-minutes, days-with-hours and days.
These are only applied once the leading unit is greater than zero.

For example, 59 seconds will be shown as seconds: `99s` and then 60
seconds will be shown as minutes-with-seconds: `1m00s`. New colors have
been chosen for each format.

NOTE: I had to make a small unrelated change in
`task::Details::make_percentiles_widget` to make clippy happy.

Fixes: #224
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-console Crate: console. E-easy Effort: easy. Good for newcomers S-feature Severity: feature. This is adding a new feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants