-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
tests: kernel: timer: timer_behavior: Tweak expected std deviation #74939
tests: kernel: timer: timer_behavior: Tweak expected std deviation #74939
Conversation
I like the change, agree with @golowanow the calculation should be done once before the TC_PRINT and zaasert usage |
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.
Seems reasonable. FWIW, an alternate technique would be to do the tracking and math in cycle space and not microseconds and just clamp the minimum to "1", which IMHO would be clearer but require more rework.
If frequency of the system clock is lower then deviation may exceed default value (10us). Instead of adjusting the default value, test is rounding up expected standard deviation to a single clock cycle. Signed-off-by: Krzysztof Chruściński <[email protected]>
9ac743e
to
ebc0a71
Compare
@@ -283,7 +285,7 @@ static void do_test_using(void (*sample_collection_fn)(void), const char *mechan | |||
", \"CONFIG_SYS_CLOCK_TICKS_PER_SEC\":%d" | |||
", \"CONFIG_TIMER_TEST_PERIOD\":%d" | |||
", \"CONFIG_TIMER_TEST_SAMPLES\":%d" | |||
", \"CONFIG_TIMER_TEST_MAX_STDDEV\":%d" | |||
", \"MAX STD DEV\":%d" |
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.
same recording output change should be in pytest/test_timer.py as well
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.
done
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.
why the record name is different now ?
@andyross @peter-mitsis please review |
ebc0a71
to
4536c4f
Compare
Like in C test. If MAX STDDEV is lower than single clock cycle then set it to a single clock cycle. Signed-off-by: Krzysztof Chruściński <[email protected]>
4536c4f
to
5e700e6
Compare
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
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.
Still looks fine to me. One nitpick.
@@ -37,7 +37,10 @@ def do_analysis(test, stats, stats_count, config, sys_clock_hw_cycles_per_sec): | |||
max_bound = (test_period + period_max_drift * test_period + | |||
expected_period_drift) / 1_000_000 | |||
|
|||
cyc_us = 1000000 / sys_clock_hw_cycles_per_sec |
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.
Naming whine: many platforms have cycle rates > 1MHz, making this value a zero. Giving it a name that looks and sounds like "cycles per microsecond" is likely to end up in a divide-by-zero as the code evolves. It's used as a clamp, so e.g. "min_cyc = ...; /* Minimum possible cycles that can be measured */
' might be better?
If frequency of the system clock is lower then deviation may exceed default value (10us). Instead of adjusting the default value, test is rounding up expected standard deviation to a single clock cycle.
Fixes #71863.