Skip to content

docs: explain what --latency-correction does - #905

Merged
hatoo merged 1 commit into
hatoo:masterfrom
monsterlag:fix/issue-211-0750
Oct 22, 2026
Merged

hatoo merged 1 commit into
hatoo:masterfrom
monsterlag:fix/issue-211-0750

Conversation

@monsterlag

Copy link
Copy Markdown
Contributor

Note

AI-generated, not reviewed by a human. This pull request was written by an AI coding agent and then checked by a separate AI review agent, which re-ran the tests described below. No human has reviewed the code. It is submitted by @monsterlag, who runs these agents. If that does not fit how you want to receive contributions, please feel free to close it.

What

The README's Tips section only said that --latency-correction avoids the "Coordinated Omission Problem", without saying what the flag changes. #211 asks what it does, and a comment there asked for a short README explanation, which the maintainer agreed would be good.

This adds a short paragraph under the existing --latency-correction tip:

  • with -q or --burst-delay, requests are scheduled at a fixed rate but can only be sent when one of the -c connections is free;
  • by default latency is measured from when a request is actually sent, so time spent waiting for a free connection is left out;
  • with --latency-correction, latency is measured from the scheduled time, so that waiting is included;
  • it does nothing unless -q or --burst-delay is set.

It also corrects the flag's help text. It said "It's ignored if -q is not set", but the flag also applies with --burst-delay. It now says "It's ignored if neither -q nor --burst-delay is set." The copies of the help output in README.md and README_zh.md are updated to match.

This follows the code: RequestResult::duration() uses start_latency_correction (the scheduled time from the rate-limit queue) when it is set, and the corrected code paths are only used when a query limit (-q or --burst-delay) is set.

How tested

To check the text is accurate, I ran oha against a local Python HTTP server that waits 1 s before each response:

Command Average Slowest
oha --no-tui -n 6 -c 1 -q 4 URL 1.0343 s 1.0410 s
oha --no-tui -n 6 -c 1 -q 4 --latency-correction URL 2.9842 s 4.9770 s
oha --no-tui -n 6 -c 1 --burst-delay 200ms --burst-rate 3 URL 1.0361 s 1.0447 s
oha --no-tui -n 6 -c 1 --burst-delay 200ms --burst-rate 3 --latency-correction URL 3.5076 s 6.0140 s
oha --no-tui -n 3 -c 1 --latency-correction URL (no -q) 1.0286 s 1.0420 s

Without the flag every request reports about 1 s. With it, the reported latency includes the time each request waited for the single connection. Without -q or --burst-delay the flag has no effect.

After changing the help string, I ran oha --help on a debug build. It shows the new text, and that line matches the help blocks in README.md and README_zh.md. cargo fmt --check passes.

I did not add the new explanation to README_zh.md. Its Chinese one-line tip could get a translation in a follow-up.

Partially addresses #211

@hatoo
hatoo merged commit 89c9fda into hatoo:master Oct 22, 2026
23 checks passed
@hatoo

hatoo commented Oct 22, 2026

Copy link
Copy Markdown
Owner

nice!

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