Skip to content

fix: use calibrated TSC frequencies for scheduler budgets - #550

Open
thweetkomputer wants to merge 3 commits into
mainfrom
agent/use-absl-tsc-frequency
Open

fix: use calibrated TSC frequencies for scheduler budgets#550
thweetkomputer wants to merge 3 commits into
mainfrom
agent/use-absl-tsc-frequency

Conversation

@thweetkomputer

@thweetkomputer thweetkomputer commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • replace Data Substrate's own x86 sleep_for()-based TSC calibration with Abseil's calibrated raw TSC frequency
  • add absl::base to the standalone txservice target's explicit dependencies
  • update the EloqStore submodule to eloqdata/eloqstore#495
  • link absl::base into the data_substrate-defined eloqstore integration target

Root cause

Both Data Substrate and EloqStore divided elapsed TSC ticks by the requested sleep_for() duration. sleep_for(1000us) is allowed to return later when the initializing thread is descheduled. Using 1000 rather than the actual monotonic elapsed time therefore overestimates the frequency. Repeated stable samples do not eliminate this systematic error when scheduler delay is similar between samples.

An overestimated frequency makes the derived microsecond clock advance too slowly, so scheduler, cooperative-yield, work-loop, and delayed-request budgets can run late.

Abseil's calibration pairs raw TSC samples with actual monotonic-clock readings and retries with increasing measurement intervals. Its NominalCPUFrequency() corresponds to the raw rdtsc value used by both implementations.

Build integration

Data Substrate defines its own txservice and embedded EloqStore targets. Both now declare the direct absl::base dependency needed by NominalCPUFrequency(); the ARM cntfrq_el0 paths remain unchanged.

Dependency

Impact

Data Substrate's scheduler clock and embedded EloqStore's work-loop clock are calibrated against actual elapsed time rather than requested sleep duration.

Validation

Local tests were intentionally not run; GitHub CI is expected to validate the amd64 and arm64 integrations.

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The PR adds a private absl::base link to eloqstore and updates the eloqstore submodule to a newer commit.

Changes

EloqStore linkage update

Layer / File(s) Summary
Update EloqStore build linkage
store_handler/eloq_data_store_service/build_eloq_store.cmake, store_handler/eloq_data_store_service/eloqstore
The eloqstore target privately links absl::base. The eloqstore submodule pointer moves to commit 11106441b37f020e4b2a99ae34c38d581b1e9aee.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Possibly related PRs

Suggested reviewers: liunyl, mrguin

Poem

A rabbit links the store with care,
Adds Abseil base to the pair.
The submodule hops ahead,
New commit beneath its tread.
Build bells ring through every lair.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the root cause, implementation, dependency, impact, and validation status, but it omits most required template sections. Rewrite the description using the required headings and add behavior changes, design decisions, risk, rollback, reviewer guidance, and follow-up details.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly describes the calibrated TSC change and its scheduler-budget impact, which matches the pull request objectives.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/use-absl-tsc-frequency

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@thweetkomputer thweetkomputer changed the title fix: consume calibrated EloqStore TSC frequency fix: use calibrated TSC frequencies for scheduler budgets Aug 9, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
store_handler/eloq_data_store_service/build_eloq_store.cmake (1)

135-135: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Document why absl::base is required.

The new private dependency is not self-explanatory. Add a short CMake comment that links it to EloqStore’s TSC-frequency calibration path in the selected upstream revision.

Proposed documentation
+# Required by EloqStore TSC-frequency calibration.
 target_link_libraries(eloqstore PRIVATE ${URING_LIB} ${BOOST_CONTEXT_TARGET} glog::glog jsoncpp_lib ${CURL_LIBRARIES} ${ZSTD_LIBRARY} ${AWSSDK_LINK_LIBRARIES} absl::base

As per coding guidelines, document non-obvious operational and compatibility constraints, and explain why rather than restating syntax.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@store_handler/eloq_data_store_service/build_eloq_store.cmake` at line 135,
Add a concise CMake comment immediately above the absl::base entry in
target_link_libraries for eloqstore, documenting that it is required by
EloqStore’s TSC-frequency calibration path and tied to the selected upstream
revision. Keep the dependency and linking behavior unchanged.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@store_handler/eloq_data_store_service/build_eloq_store.cmake`:
- Line 135: Add a concise CMake comment immediately above the absl::base entry
in target_link_libraries for eloqstore, documenting that it is required by
EloqStore’s TSC-frequency calibration path and tied to the selected upstream
revision. Keep the dependency and linking behavior unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a4ab4aba-064f-4415-b803-96bcaff5ffe9

📥 Commits

Reviewing files that changed from the base of the PR and between d342a5c and 7d98488.

📒 Files selected for processing (2)
  • store_handler/eloq_data_store_service/build_eloq_store.cmake
  • store_handler/eloq_data_store_service/eloqstore

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.

1 participant