-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Allow specifying number of iterations via --benchmark_min_time. #1525
Conversation
Make the flag accept two new suffixes: + <integer>x: number of iterations + <floag>s: minimum number of seconds. This matches the internal benchmark API.
@dmah42 Let me know if we should rename the flag in this patch too? Thanks! |
aside from the broken build, this is also a breaking change. before it's merged we should do a release and then release right after it's merged with clear documentation about the behaviour change. i haven't checked the code yet.. but does it also accept the old behaviour (ie if the "s" is missing")? |
Yes - if suffixes are omitted, then we'd assume it's the number of seconds for backward compat (But we do issue a warning just to encourage users to use the new format) |
adding tests - please hold off on the review. Will ping when ready. Thanks! |
Hi @LebedevRI, any thought on this? Thanks! |
bool has_suffix = value.back() == 's'; | ||
if (!has_suffix) { | ||
BM_VLOG(0) << "Value passed to --benchmark_min_time should have a suffix. " | ||
"Eg., `30s` for 30-seconds."; |
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.
This makes it look like other suffixes (ms
?) are supported
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.
Yes, we could extend the suffixes support later - but for the first iteration, let's keep it simple. (And I'd like to get the interface in place first)
Hi, if there's no further objection, can we please get this rolling? Thanks! |
i'd like @LebedevRI to approve too |
|
||
// After a successfull parse, p_end should point to the suffix 's' | ||
// or the end of the string, if the suffix was omitted. | ||
BM_CHECK(errno == 0 && p_end != nullptr && |
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.
This check is present in release builds, right?
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.
no, it acts like assert
and is disabled in NDEBUG
builds
Consider this rubber-stamped. |
(also, what about warm-up option, should it also be affected?) |
No, this will not affect the warm-up option. |
some valid linker errors: |
Hmm, any idea why the definition is not seen? (The function is defined in benchmark_runner.cc - and moreover,t he same code built in other configurations .... what's difference about these "shared" runs? 🤔 ) |
Ok - now the tests all PASSED in Debug builds but FAILED in Release builds (due to "failed to die"). |
Ah, found it! |
any more comments here before we rebase and squash and merge? |
|
wonderful. thank you. |
Make the flag accept two new suffixes:
This matches the internal benchmark API.