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

Report duration of each iteration #38

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

joecryptotoo
Copy link
Contributor

@joecryptotoo joecryptotoo commented Jul 18, 2023

docker-compose.yml for testing:

---
version: "2.1"
services:

  gateway-mfr-rs:
    build:
      context: https://github.com/joecryptotoo/gateway-mfr-rs.git#bench
    cap_add:
      - SYS_RAWIO
    devices:
      - /dev/i2c-1:/dev/i2c-1
    command: /usr/src/gateway-mfr-rs/target/debug/gateway_mfr --device ecc://i2c-1:96 bench -i 3

Just run docker compose up and this should build from my bench branch and run.

@madninja
Copy link
Member

Just listing out all the timings for each iteration is going to get way too large to work with.

How about using histogram bucketing and reporting that instead? that way you get the median and percentiles reported in a single short list of numbers

Copy link
Member

@madninja madninja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm.. nope sorry.. I 'd like just the fix.. and then we need to work on the durations output being optional and not forced in by default

@joecryptotoo
Copy link
Contributor Author

hmm.. nope sorry.. I 'd like just the fix.. and then we need to work on the durations output being optional and not forced in by default

@madninja
durations are now optional with the -d flag

"iterations": self.iterations,
"avg_ms": round2(avg_ms),
"rate": round2(rate),
});
if self.durations {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not map durations to a Vec of mills and then just insert it into the top level json?
e.g.

let durations: Vec<u128> = durations.map(|d| d.as_millis()).collect();

and in the json construction above:

let json = json!({
    "iterations": self.iterations,
    "avg_ms": round2(avg_ms),
    "rate": round2(rate),
    "durations": durations,
 });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants