rust: Call _coz_add_delays() after counter increments#270
Merged
emeryberger merged 1 commit intoplasma-umass:masterfrom Feb 23, 2026
Merged
rust: Call _coz_add_delays() after counter increments#270emeryberger merged 1 commit intoplasma-umass:masterfrom
emeryberger merged 1 commit intoplasma-umass:masterfrom
Conversation
The Rust crate was not calling `_coz_add_delays()` after incrementing progress counters. The C `COZ_INCREMENT_COUNTER` macro in `coz.h` calls `_call_coz_add_delays()` after every increment — this is required for the profiler to inject virtual delays for causal profiling experiments. Without this call, the profiler detects 0 experiments despite counters being incremented correctly. Also changes the atomic ordering from SeqCst to Relaxed to match the C implementation (`__ATOMIC_RELAXED`), which is sufficient since libcoz uses its own synchronization. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
emeryberger
reviewed
Feb 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Rust crate was not calling
_coz_add_delays()after incrementing progress counters, causing the profiler to detect 0 experiments despite counters being incremented correctly.The C
COZ_INCREMENT_COUNTERmacro incoz.hcalls_call_coz_add_delays()after every increment — this is how the profiler injects virtual delays for causal profiling experiments. The Rust crate was missing this critical call.This PR:
coz_add_delays()function that dynamically loads_coz_add_delaysviadlsym(matching the existing pattern for_coz_get_counter)coz_add_delays()after every counter increment inCounter::increment()SeqCsttoRelaxedto match the C implementation (__ATOMIC_RELAXED)Testing
Tested by profiling
rustdoc(the Rust documentation tool) with coz on thestm32f4crate (~224k LOC, ~35s documentation time):throughput_pointentries correctly recorded🤖 Generated with Claude Code