All of lore.kernel.org
 help / color / mirror / Atom feed
* [libevl][PATCH] tests: sched-quota: Synchronize all threads before readings stats
@ 2026-08-31 13:30 Jan Kiszka
  2026-09-04  9:21 ` Philippe Gerum
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Kiszka @ 2026-08-31 13:30 UTC (permalink / raw)
  To: Xenomai, Philippe Gerum

From: Jan Kiszka <jan.kiszka@siemens.com>

The quota threads may complete their work in a random order. Wait for
them all first before starting to read out their stats. This avoids
inconsistencies.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 tests/sched-quota-accuracy.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tests/sched-quota-accuracy.c b/tests/sched-quota-accuracy.c
index 2a2dc38..1bf5eb9 100644
--- a/tests/sched-quota-accuracy.c
+++ b/tests/sched-quota-accuracy.c
@@ -275,8 +275,9 @@ static struct accuracy_results run_quota(void)
 	 * number of loops we should be able to run during the
 	 * allotted quota, even in case of runtime disruption.
 	 */
-	for (n = 0, loops_at_calibration = 0; n < nrthreads; n++) {
+	for (n = 0; n < nrthreads; n++)
 		__Tcall_assert(ret, evl_get_sem(&ready));
+	for (n = 0, loops_at_calibration = 0; n < nrthreads; n++) {
 		do_trace("CPU%d: calibration: quota_thread[%d]: %llu loops",
 			test_cpu, n, threads[n].loops);
 		loops_at_calibration += threads[n].loops;
@@ -292,8 +293,9 @@ static struct accuracy_results run_quota(void)
 	 * Wait for the accuracy measurement to end, then collect the
 	 * numbers.
 	 */
-	for (n = 0, loops_at_accuracy = 0; n < nrthreads; n++) {
+	for (n = 0; n < nrthreads; n++)
 		__Tcall_assert(ret, evl_get_sem(&ready));
+	for (n = 0, loops_at_accuracy = 0; n < nrthreads; n++) {
 		do_trace("CPU%d: accuracy: quota_thread[%d]: %llu loops",
 			test_cpu, n, threads[n].loops);
 		loops_at_accuracy += threads[n].loops;
-- 
2.47.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [libevl][PATCH] tests: sched-quota: Synchronize all threads before readings stats
  2026-08-31 13:30 [libevl][PATCH] tests: sched-quota: Synchronize all threads before readings stats Jan Kiszka
@ 2026-09-04  9:21 ` Philippe Gerum
  0 siblings, 0 replies; 2+ messages in thread
From: Philippe Gerum @ 2026-09-04  9:21 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Xenomai

Jan Kiszka <jan.kiszka@siemens.com> writes:

> From: Jan Kiszka <jan.kiszka@siemens.com>
>
> The quota threads may complete their work in a random order. Wait for
> them all first before starting to read out their stats. This avoids
> inconsistencies.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
>  tests/sched-quota-accuracy.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/tests/sched-quota-accuracy.c b/tests/sched-quota-accuracy.c
> index 2a2dc38..1bf5eb9 100644
> --- a/tests/sched-quota-accuracy.c
> +++ b/tests/sched-quota-accuracy.c
> @@ -275,8 +275,9 @@ static struct accuracy_results run_quota(void)
>  	 * number of loops we should be able to run during the
>  	 * allotted quota, even in case of runtime disruption.
>  	 */
> -	for (n = 0, loops_at_calibration = 0; n < nrthreads; n++) {
> +	for (n = 0; n < nrthreads; n++)
>  		__Tcall_assert(ret, evl_get_sem(&ready));
> +	for (n = 0, loops_at_calibration = 0; n < nrthreads; n++) {
>  		do_trace("CPU%d: calibration: quota_thread[%d]: %llu loops",
>  			test_cpu, n, threads[n].loops);
>  		loops_at_calibration += threads[n].loops;
> @@ -292,8 +293,9 @@ static struct accuracy_results run_quota(void)
>  	 * Wait for the accuracy measurement to end, then collect the
>  	 * numbers.
>  	 */
> -	for (n = 0, loops_at_accuracy = 0; n < nrthreads; n++) {
> +	for (n = 0; n < nrthreads; n++)
>  		__Tcall_assert(ret, evl_get_sem(&ready));
> +	for (n = 0, loops_at_accuracy = 0; n < nrthreads; n++) {
>  		do_trace("CPU%d: accuracy: quota_thread[%d]: %llu loops",
>  			test_cpu, n, threads[n].loops);
>  		loops_at_accuracy += threads[n].loops;

Merged, thanks.

-- 
Philippe.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-04  9:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-31 13:30 [libevl][PATCH] tests: sched-quota: Synchronize all threads before readings stats Jan Kiszka
2026-09-04  9:21 ` Philippe Gerum

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.