Skip to content

fix(tune): floor the bench freq median to whole kHz — awk sci-notation tripped the #62 throttle guard - #282

Merged
VijitSingh97 merged 6 commits into
developfrom
fix/266-median-sci-notation
Jul 17, 2026
Merged

VijitSingh97 merged 6 commits into
developfrom
fix/266-median-sci-notation

Conversation

@VijitSingh97

Copy link
Copy Markdown
Contributor

Summary

_median averages the middle pair for an even sample count, and awk's OFMT prints large non-integral results (kHz clocks ~4.6e6) in scientific notation (4.6275e+06). The consumer's bf=${bf%.*} floor mangled that into 4 → 0 MHz → the #62 throttle guard falsely rejected healthy candidates, so tune --bench silently kept the seed baseline on real hardware.

Fix per the issue: floor at the one producer whose values are large (the freq writer in _xmrig_bench), via awk '{printf "%d", $0+0}' — $0+0 parses the sci-notation back to 4627500 and %d prints whole kHz. _median itself is unchanged (its other consumers — hashrate/watts — never exceed 1e6). The now-stale consumer comment updated; its .-floor kept as a harmless belt.

Tests

  • Unit-style: replays a deterministic even sample pair (4627000/4628001 kHz) through the real _xmrig_bench freq-write path and asserts the file contains 4627500 (no e+).
  • Black-box regression: a healthy ~4.6 GHz candidate whose clock jitters 1 kHz mid-window (FIFO-fed, deterministic even sample count) must not be flagged as throttled and stays eligible for adoption.

Both verified red against the unfixed writer (4.6275e+06 / falsely throttled: true), green after. make test: 1336 passed, 0 failed; shellcheck + shfmt clean.

Closes #266

🤖 Generated with Claude Code

…n tripped the #62 throttle guard

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@VijitSingh97
VijitSingh97 enabled auto-merge (squash) July 17, 2026 02:49
@VijitSingh97
VijitSingh97 merged commit 1116daf into develop Jul 17, 2026
9 checks passed
@VijitSingh97
VijitSingh97 deleted the fix/266-median-sci-notation branch July 17, 2026 03:29
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.

tune --bench: _median emits scientific notation for kHz clocks — the #62 throttle guard rejects healthy candidates as "0 MHz"

1 participant