Skip to contentSkip to conversation

tests: sched-quota: Perform calibration without quota again

PATCH Applied Jan Kiszka 2 participants 2 messages Aug 31 – Sep 4

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 tests: sched-quota: Perform calibration without quota again

From: Jan Kiszka <[email protected]>

It defeats the purpose of the test when we calibrate under quota as we can no longer compare the actual cap against the configured value.

---
 tests/sched-quota-accuracy.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
tests/sched-quota-accuracy.c +8 -6
index 1bf5eb9..ac04449 100644
@@ -171,15 +171,15 @@ static void *quota_thread(void *arg)
 	__Tcall_assert(t->efd, evl_attach_self("quota-runner:%d.%d",
 						getpid(), serial));
 
+	wait_phase(calibration_phase);
+
+	do_work(t, PERIOD_NS * NR_PERIODS);
+
 	attrs.sched_policy = SCHED_QUOTA;
 	attrs.sched_priority = QUOTA_PRIO;
 	attrs.sched_quota_group = tgid;
 	__Tcall_assert(ret, evl_set_schedattr(t->efd, &attrs));
 
-	wait_phase(calibration_phase);
-
-	do_work(t, PERIOD_NS * NR_PERIODS);
-
 	wait_phase(accuracy_measurement_phase);
 
 	do_work(t, PERIOD_NS * NR_PERIODS);
@@ -338,7 +338,8 @@ static struct accuracy_results run_quota(void)
 	 * expressed as a percentage. The closest to the QUOTA_PERCENT
 	 * target, the better.
 	 */
-	results.accuracy = ((double)loops_at_accuracy * 100.0) / (double)loops_at_calibration;
+	results.accuracy = 100.0 *
+		((double)loops_at_accuracy * 100.0 / QUOTA_PERCENT) / (double)loops_at_calibration;
 
 	/*
 	 * Level of noise observed for the disrupted run compared to
@@ -346,7 +347,8 @@ static struct accuracy_results run_quota(void)
 	 * run was faster than the calibration one, which would still
 	 * be correct.
 	 */
-	results.noise = 100.0 - (((double)loops_with_disruption * 100.0) / (double)loops_at_calibration);
+	results.noise = 100.0 - (100.0 *
+		((double)loops_with_disruption * 100.0 / QUOTA_PERCENT) / (double)loops_at_calibration);
 
 	__Tcall_assert(ret, cleanup_group());
 
Signature · 1 line
2.47.3
#1 lore raw
Quoted 45 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

It defeats the purpose of the test when we calibrate under quota as we can no longer compare the actual cap against the configured value.

---
 tests/sched-quota-accuracy.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
tests/sched-quota-accuracy.c +6 -5
index 1bf5eb9..ac04449 100644
@@ -171,15 +171,15 @@ static void *quota_thread(void *arg)
 	__Tcall_assert(t->efd, evl_attach_self("quota-runner:%d.%d",
 						getpid(), serial));
 
+	wait_phase(calibration_phase);
+
+	do_work(t, PERIOD_NS * NR_PERIODS);
+
 	attrs.sched_policy = SCHED_QUOTA;
 	attrs.sched_priority = QUOTA_PRIO;
 	attrs.sched_quota_group = tgid;
 	__Tcall_assert(ret, evl_set_schedattr(t->efd, &attrs));
 
-	wait_phase(calibration_phase);
-
-	do_work(t, PERIOD_NS * NR_PERIODS);
-
 	wait_phase(accuracy_measurement_phase);
 
 	do_work(t, PERIOD_NS * NR_PERIODS);
@@ -338,7 +338,8 @@ static struct accuracy_results run_quota(void)
 	 * expressed as a percentage. The closest to the QUOTA_PERCENT
 	 * target, the better.
 	 */
-	results.accuracy = ((double)loops_at_accuracy * 100.0) / (double)loops_at_calibration;
+	results.accuracy = 100.0 *
+		((double)loops_at_accuracy * 100.0 / QUOTA_PERCENT) / (double)loops_at_calibration;
 
 	/*
 	 * Level of noise observed for the disrupted run compared to

tests/sched-quota-accuracy.c static struct accuracy_results run_quota(void) · line 353

Quoted 8 lines
tests/sched-quota-accuracy.c +2 -1
@@ -346,7 +347,8 @@ static struct accuracy_results run_quota(void)
 	 * run was faster than the calibration one, which would still
 	 * be correct.
 	 */
-	results.noise = 100.0 - (((double)loops_with_disruption * 100.0) / (double)loops_at_calibration);
+	results.noise = 100.0 - (100.0 *
+		((double)loops_with_disruption * 100.0 / QUOTA_PERCENT) / (double)loops_at_calibration);
 
 	__Tcall_assert(ret, cleanup_group());

Merged, thanks.

Signature · 1 line
Philippe.