[LTP] [PATCH v3 22/29] fuzzy_sync: Convert to runtime
Li Wang
liwang@redhat.com
Fri May 13 11:13:31 CEST 2022
Cyril Hrubis <chrubis@suse.cz> wrote:
>
> diff --git a/include/tst_fuzzy_sync.h b/include/tst_fuzzy_sync.h
> index 4f09ed416..bef424002 100644
> --- a/include/tst_fuzzy_sync.h
> +++ b/include/tst_fuzzy_sync.h
> @@ -160,15 +160,6 @@ struct tst_fzsync_pair {
> int b_cntr;
> /** Internal; Used by tst_fzsync_pair_exit() and
> fzsync_pair_wait() */
> int exit;
> - /**
> - * The maximum desired execution time as a proportion of the
> timeout
> - *
> - * A value x so that 0 < x < 1 which decides how long the test
> should
> - * be run for (assuming the loop limit is not exceeded first).
> - *
> - * Defaults to 0.5 (~150 seconds with default timeout).
> - */
> - float exec_time_p;
> /** Internal; The test time remaining on tst_fzsync_pair_reset() */
> float exec_time_start;
> /**
> @@ -214,7 +205,6 @@ static inline void tst_fzsync_pair_init(struct
> tst_fzsync_pair *pair)
> CHK(avg_alpha, 0, 1, 0.25);
> CHK(min_samples, 20, INT_MAX, 1024);
> CHK(max_dev_ratio, 0, 1, 0.1);
> - CHK(exec_time_p, 0, 1, 0.5);
> CHK(exec_loops, 20, INT_MAX, 3000000);
>
> if (tst_ncpus_available() <= 1)
> @@ -291,7 +281,7 @@ static inline void tst_fzsync_pair_reset(struct
> tst_fzsync_pair *pair,
> if (run_b)
> SAFE_PTHREAD_CREATE(&pair->thread_b, 0, run_b, 0);
>
> - pair->exec_time_start = (float)tst_timeout_remaining();
> + pair->exec_time_start = (float)tst_remaining_runtime();
> }
>
> /**
> @@ -644,10 +634,9 @@ static inline void tst_fzsync_wait_b(struct
> tst_fzsync_pair *pair)
> */
> static inline int tst_fzsync_run_a(struct tst_fzsync_pair *pair)
> {
> - float rem_p = 1 - tst_timeout_remaining() / pair->exec_time_start;
> + float rem_p = 1 - tst_remaining_runtime() / pair->exec_time_start;
>
> - if ((pair->exec_time_p * SAMPLING_SLICE < rem_p)
> - && (pair->sampling > 0)) {
> + if ((SAMPLING_SLICE < rem_p) && (pair->sampling > 0)) {
> tst_res(TINFO, "Stopped sampling at %d (out of %d)
> samples, "
> "sampling time reached 50%% of the total time
> limit",
> pair->exec_loop, pair->min_samples);
> @@ -655,7 +644,7 @@ static inline int tst_fzsync_run_a(struct
> tst_fzsync_pair *pair)
> tst_fzsync_pair_info(pair);
> }
>
> - if (pair->exec_time_p < rem_p) {
> + if (rem_p >= 1) {
>
I hit a new problem while testing new pty03, that seems here
will fall into an infinite loop and test timed out finally. The printf
shows rem_p will be overflow I haven't figured out why.
But with comparing with 0.9, it always gets passed on to the same system.
--- a/include/tst_fuzzy_sync.h
+++ b/include/tst_fuzzy_sync.h
@@ -644,7 +644,7 @@ static inline int tst_fzsync_run_a(struct
tst_fzsync_pair *pair)
tst_fzsync_pair_info(pair);
}
- if (rem_p >= 1) {
+ if (rem_p >= 0.9) {
tst_res(TINFO,
"Exceeded execution time, requesting exit");
tst_atomic_store(1, &pair->exit);
----------------------
# ./pty03
...
../../../include/tst_fuzzy_sync.h:295: TINFO: start_a - start_b: { avg =
-90ns, avg_dev = 8ns, dev_ratio = 0.09 }
../../../include/tst_fuzzy_sync.h:295: TINFO: end_a - start_a : { avg =
2606ns, avg_dev = 127ns, dev_ratio = 0.05 }
../../../include/tst_fuzzy_sync.h:295: TINFO: end_b - start_b : { avg =
8785ns, avg_dev = 600ns, dev_ratio = 0.07 }
../../../include/tst_fuzzy_sync.h:295: TINFO: end_a - end_b : { avg =
-6269ns, avg_dev = 566ns, dev_ratio = 0.09 }
../../../include/tst_fuzzy_sync.h:295: TINFO: spins : { avg =
3269 , avg_dev = 200 , dev_ratio = 0.06 }
Test timeouted, sending SIGKILL!
tst_test.c:1573: TINFO: If you are running on slow machine, try exporting
LTP_TIMEOUT_MUL > 1
tst_test.c:1575: TBROK: Test killed! (timeout?)
--
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20220513/8114bc62/attachment.htm>
More information about the ltp
mailing list