Skip to content

net block: improve throughput formatting#704

Merged
ammgws merged 1 commit into
greshake:masterfrom
ammgws:netusagefmt
May 23, 2020
Merged

net block: improve throughput formatting#704
ammgws merged 1 commit into
greshake:masterfrom
ammgws:netusagefmt

Conversation

@ammgws

@ammgws ammgws commented May 23, 2020

Copy link
Copy Markdown
Collaborator

(Mostly?) Resolves #240.

@GladOSkar Thanks for doing the legwork on this one!

This also uncovered a calculation error with use_bits, which is now fixed.

Comparing the new default format (max 3 digits, minimum unit K):

new format: '46.8M'	 with use_bits: '0.37Gb'
cur format: '   46M'	 with use_bits: '  368M'

new format: '6.81M'	 with use_bits: '54.5Mb'
cur format: '    6M'	 with use_bits: '   48M'

new format: '0.81M'	 with use_bits: '6.51Mb'
cur format: '  813k'	 with use_bits: '    0M'

new format: '13.6K'	 with use_bits: '0.11Mb'
cur format: '   13k'	 with use_bits: '  104k'

In my opinion this is now way better than before. The only caveat may be when using use_bits as in the first example above - perhaps we should display in megabits instead of gigabits for that case. However I will leave that for a future PR.

@ammgws ammgws changed the title [WIP] net block: improve throughput formatting net block: improve throughput formatting May 23, 2020
@ammgws ammgws merged commit d84d9ba into greshake:master May 23, 2020
@ammgws ammgws deleted the netusagefmt branch May 23, 2020 06:37
@GladOSkar

Copy link
Copy Markdown
Contributor

Wow, i wrote that almost 2 years ago :D Not quite what i'd call beautiful code but it does the job

@ammgws

ammgws commented May 23, 2020

Copy link
Copy Markdown
Collaborator Author

If you're up for beautifying it then please go ahead!

@GladOSkar

GladOSkar commented May 23, 2020

Copy link
Copy Markdown
Contributor

I played around with it for a while and it doesn't actually get a lot better so... meh ¯\_(ツ)_/¯

@GladOSkar

Copy link
Copy Markdown
Contributor

I wonder if this could be adapted into the speedtest block as well, because the formatting of that one annoys me to the point that i always patch it before updating i3status-rs... But the values are obtained in a very different way there

@ammgws

ammgws commented May 23, 2020

Copy link
Copy Markdown
Collaborator Author

I created a new issue for that.

By the way do you have any other improvements you'd like to share? (or maybe put your forked repo online?)

@GladOSkar

Copy link
Copy Markdown
Contributor

No, it's really just a hardcoded removal of everything after the decimal points in the speedtest block

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Net format

2 participants