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

Calculate throughput in MB/s or GB/s instead of MiB/s or GiB/s #581

Closed
V0ldek opened this issue May 29, 2022 · 5 comments
Closed

Calculate throughput in MB/s or GB/s instead of MiB/s or GiB/s #581

V0ldek opened this issue May 29, 2022 · 5 comments
Labels
Breaking Change Requires an API-breaking change. Waiting for next major version.
Milestone

Comments

@V0ldek
Copy link

V0ldek commented May 29, 2022

I'm using Criterion with throughput calculation and it'd be really useful, but unfortunately thus far all data that we have reported was in GB/s, as in one billion bytes. Criterion gives results in GiB/s, so 2^30 bytes. I can't see a way to convert that, so either it's not there or it's not well documented.

A workaround for now is to configure it as elements and get reports of Gelems/s, it'd be nice to maybe change the label? So I could just say that instead of reporting "elems" report "Bs"?

@ambiso
Copy link

ambiso commented Jun 3, 2022

You can implement your own Measurement and return a custom ValueFormatter and make it format differently.

You can wrap this inside a separate crate like the CyclesPerByte Measurement.

@V0ldek
Copy link
Author

V0ldek commented Jul 23, 2022

I've implemented and then turned @ambiso workaround into a crate, so it can be reused:
https://crates.io/crates/criterion-decimal-throughput

@bheisler
Copy link
Owner

Hello! Thanks for the suggestion, and for the patience.

Yeah, that's a fair point. It will need to be in a breaking-change release, but I'd be open to including a Throughput::BytesDecimal or similar.

@bheisler bheisler added the Breaking Change Requires an API-breaking change. Waiting for next major version. label Aug 16, 2022
@bheisler bheisler added this to the Version 0.4.0 milestone Aug 16, 2022
@V0ldek
Copy link
Author

V0ldek commented Aug 17, 2022

@bheisler If you want help, I can do a PR with what I've implemented in https://github.com/V0ldek/criterion-decimal-throughput

@bheisler
Copy link
Owner

A pull request (to the version 0.4 branch) would be welcome, yes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Breaking Change Requires an API-breaking change. Waiting for next major version.
Projects
None yet
Development

No branches or pull requests

3 participants