Skip to content

fix(speed): publish the engine's aggregate rate in decimal MB/s - #206

Open
shaktimaan00 wants to merge 1 commit into
LeyckerS:mainfrom
shaktimaan00:fix/engine-speed-decimal-mb
Open

shaktimaan00 wants to merge 1 commit into
LeyckerS:mainfrom
shaktimaan00:fix/engine-speed-decimal-mb

Conversation

@shaktimaan00

Copy link
Copy Markdown

Most of #84 has already landed: #194 put a file's live rate on the same /1e6 as its final average, and #154 replaced the CLI's private copy of the arithmetic with the engine snapshot. What was left is the run-wide figure Engine.snapshot() publishes.

moon_engine.py divided the aggregate byte rate by 1_048_576 and shipped it as speed_mbs. Both front-ends read that figure as MB/s: web/app.js prints it through fmtSpeed, moon_cli.py through _fmt_speed, and both scale it down to KB/s by 1024. So the aggregate line sat 4.9% below the per-file rates printed next to it for the same run.

Convention: decimal MB/s, /1e6. That is what the labels already claim, and it makes the aggregate agree with the per-file numbers.

Lines changed:

  • moon_engine.py:770 aggregate rate: / 1_048_576 -> / 1e6
  • moon_engine.py:778 ETA: mbs * 1_048_576 -> mbs * 1e6, so the published figure is converted back to bytes at the unit it was published in
  • tests/test_snapshot_speed.py rewritten: exact expectations instead of the old 0.5 < got < 1.5 bands, an ETA case, and a syntax-tree guard against a MiB divisor coming back

Deliberately untouched:

The rewritten test fails on main in all four cases and passes here. Full suite: 173 passed. ruff check . clean. Fixes #84.

snapshot() divided the aggregate byte rate by 1_048_576 and shipped it as
speed_mbs; both front-ends print that figure as MB/s and scale it down to
KB/s by 1024. The per-file rates beside it have been divided by 1e6 since
LeyckerS#194, so the run-wide line read 4.9% below the files it summarises.

The ETA multiplied the same figure back into bytes, so it moves to 1e6 with
it. The stall detector is untouched: it already compares against a /1e6 value.
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.

the same speed is computed in MiB/s in some places and MB/s in others, all labelled "MB/s"

1 participant