Skip to content
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

[PATCH v4] test: bench_misc: short and long time stamps #1956

Merged

Conversation

psavol
Copy link
Collaborator

@psavol psavol commented Nov 23, 2023

Time stamp value may affect result of some test cases. Also, test results are more consistent with fixed time stamp values than currrent time (changes between test runs). Added short (1 msec) and long (10 sec) time stamps, and use those in short/long time_to_nsec test cases.

@odpbuild odpbuild changed the title test: bench_misc: short and long time stamps [PATCH v1] test: bench_misc: short and long time stamps Nov 23, 2023
@@ -103,6 +113,12 @@ static void init_time_global(void)
for (i = 0; i < REPEAT_COUNT; i++)
t2[i] = odp_time_global();

for (i = 0; i < REPEAT_COUNT; i++)
t4[i] = odp_time_global_from_ns(ODP_TIME_MSEC_IN_NS);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I suggest having a separate init-functions for the time-from-ns tests so that the init function of other tests is not affected. Now the added array init is done for all tests that share the init function, even though they do not use the added t4 and t5 arrays. And since the init function is run after the measurement warmup, any side effects (like cache evictions of the actually used data) can affect the measurements. With separate init functions the actual test function could be exactly the same for the two added tests, which would be useful in making sure that the "short" and "long" tests test exactly the same thing.

The test warmup probably should be improved by having a test specific warmup round after the init phase, but that requires changes in the common bench API. In the mean time having a separate init and not introducing t4 and t5 would minimize the effect of this change to existing tests.

The warmup implementation in the common bench framework is also otherwise problematic: it runs all warmups before any test runs, which is too early. PR 1959 fixes that but leaves the init-after-warmup problem as is.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Changed in v2 initialization to happen only once in main thread startup.

@psavol psavol force-pushed the bench_misc-short-long-time-stamp branch from b8abe2a to 26dd89d Compare November 29, 2023 15:22
@odpbuild odpbuild changed the title [PATCH v1] test: bench_misc: short and long time stamps [PATCH v2] test: bench_misc: short and long time stamps Nov 29, 2023
@@ -698,7 +719,8 @@ bench_info_t test_suite[] = {
BENCH_INFO(time_diff, init_time_local, 0, "time_diff (local)"),
BENCH_INFO(time_diff_ns, init_time_global, 0, NULL),
BENCH_INFO(time_sum, init_time_global, 0, NULL),
BENCH_INFO(time_to_ns, init_time_global, 0, NULL),
BENCH_INFO(time_to_ns_short, init_time_global, 0, "time_to_ns (short)"),
BENCH_INFO(time_to_ns_long, init_time_global, 0, "time_to_ns (long)"),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since init function is not needed anymore in v2, the init function pointer should be set to NULL. With that change this looks ok, as long as PR 1959 goes in first (because init is no longer touching the source data, the improved warmup is needed to bring it to cache before the actual test run).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Init set to NULL in v3

@psavol psavol force-pushed the bench_misc-short-long-time-stamp branch from 26dd89d to c8e85a9 Compare December 1, 2023 13:57
@odpbuild odpbuild changed the title [PATCH v2] test: bench_misc: short and long time stamps [PATCH v3] test: bench_misc: short and long time stamps Dec 1, 2023
Time stamp value may affect result of some test cases.
Also, test results are more consistent with fixed time
stamp values than currrent time (changes between test
runs). Added short (1 msec) and long (10 sec) time stamps,
and use those in short/long time_to_nsec test cases.

Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com>
Reviewed-by: Janne Peltonen <janne.peltonen@nokia.com>
@psavol psavol force-pushed the bench_misc-short-long-time-stamp branch from c8e85a9 to 3bf1d5f Compare December 1, 2023 15:09
@odpbuild odpbuild changed the title [PATCH v3] test: bench_misc: short and long time stamps [PATCH v4] test: bench_misc: short and long time stamps Dec 1, 2023
@psavol psavol merged commit 899f192 into OpenDataPlane:master Dec 4, 2023
167 checks passed
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.

2 participants