-
-
Notifications
You must be signed in to change notification settings - Fork 10
fix: start timing after setup and warmup complete #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+33
−12
Conversation
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
This fixes the inaccurate throughput calculation caused by including setup time (state/setup methods) in the benchmark duration. Changes: - Add Clock::new_paused() to create a clock in paused state - Use a barrier to synchronize all workers after setup and warmup - Start the clock only when all workers are ready to run main iterations - Update cli.rs to create clock in paused state initially This ensures that: 1. The --duration parameter accurately reflects actual benchmark time 2. Throughput calculations only include time from actual iterations 3. Setup time from state()/setup() methods is excluded from metrics Co-authored-by: wfxr <[email protected]>
Since the internal state is protected by Arc<Mutex<>>, these methods don't need &mut self. Using &self is more idiomatic and safer for concurrent access patterns. Co-authored-by: wfxr <[email protected]>
Copilot
AI
changed the title
[WIP] Fix timing for --duration parameter in runner
fix: start timing after setup and warmup complete
Nov 27, 2025
Owner
|
@copilot Clock::start_at 和 Clock::new_paused 除了 InnerClock 的 status 字段不同,其他逻辑都是一样的,重构一下,消除这些重复逻辑 |
…method Co-authored-by: wfxr <[email protected]>
Contributor
Author
wfxr
approved these changes
Nov 27, 2025
Owner
wfxr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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.
state()andsetup()methods complete, causing setup time to be included in throughput calculationssetup()and warmup methods completeClockto support paused initialization withnew_paused()Runnerto use barrier synchronization and start clock after setup and warmupcli.rsto create clock in paused state initiallycargo testand manual verificationClock::pause()andClock::resume()to take&selfinstead of&mut selfnew()method to eliminate duplicate code betweenstart_at()andnew_paused()Summary
This PR fixes issue #20 where the load test summary includes setup time, leading to inaccurate throughput calculations.
Changes Made
Clock::new_paused()to create a clock in paused state initiallytokio::sync::Barrierto wait for all workers to complete setup and warmupClock::pause()andClock::resume()to take&self(more idiomatic since state is mutex-protected)Clock::start_at()andClock::new_paused()to share common construction logic via privatenew()methodTesting
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.