]> Git Repo - linux.git/commitdiff
selftests/resctrl: Keep results from first test run
authorReinette Chatre <[email protected]>
Thu, 24 Oct 2024 21:18:51 +0000 (14:18 -0700)
committerShuah Khan <[email protected]>
Tue, 5 Nov 2024 00:02:03 +0000 (17:02 -0700)
The resctrl selftests drop the results from every first test run
to avoid (per comment) "inaccurate due to monitoring setup transition
phase" data. Previously inaccurate data resulted from workloads needing
some time to "settle" and also the measurements themselves to
account for earlier measurements to measure across needed timeframe.

commit da50de0a92f3 ("selftests/resctrl: Calculate resctrl FS derived mem
bw over sleep(1) only")

ensured that measurements accurately measure just the time frame of
interest. The default "fill_buf" benchmark since separated the buffer
prepare phase from the benchmark run phase reducing the need for the
tests themselves to accommodate the benchmark's "settle" time.

With these enhancements there are no remaining portions needing
to "settle" and the first test run can contribute to measurements.

Signed-off-by: Reinette Chatre <[email protected]>
Reviewed-by: Ilpo Järvinen <[email protected]>
Signed-off-by: Shuah Khan <[email protected]>
tools/testing/selftests/resctrl/cmt_test.c
tools/testing/selftests/resctrl/mba_test.c
tools/testing/selftests/resctrl/mbm_test.c

index 4c3cf2c25a38fee10a6e33d474580a507ac5c32c..3bbf3042fb06e2f24a6e922a8c61500c96490a23 100644 (file)
@@ -99,14 +99,13 @@ static int check_results(struct resctrl_val_param *param, size_t span, int no_of
                }
 
                /* Field 3 is llc occ resc value */
-               if (runs > 0)
-                       sum_llc_occu_resc += strtoul(token_array[3], NULL, 0);
+               sum_llc_occu_resc += strtoul(token_array[3], NULL, 0);
                runs++;
        }
        fclose(fp);
 
        return show_results_info(sum_llc_occu_resc, no_of_bits, span,
-                                MAX_DIFF, MAX_DIFF_PERCENT, runs - 1, true);
+                                MAX_DIFF, MAX_DIFF_PERCENT, runs, true);
 }
 
 static void cmt_test_cleanup(void)
index 5b4f0aa7a3a47847e5c57e125e516aacc44836b0..4e6645b172e3c6cd4f375425ea280f8e5dc57cdf 100644 (file)
@@ -86,18 +86,14 @@ static bool show_mba_info(unsigned long *bw_imc, unsigned long *bw_resc)
                int avg_diff_per;
                float avg_diff;
 
-               /*
-                * The first run is discarded due to inaccurate value from
-                * phase transition.
-                */
-               for (runs = NUM_OF_RUNS * allocation + 1;
+               for (runs = NUM_OF_RUNS * allocation;
                     runs < NUM_OF_RUNS * allocation + NUM_OF_RUNS ; runs++) {
                        sum_bw_imc += bw_imc[runs];
                        sum_bw_resc += bw_resc[runs];
                }
 
-               avg_bw_imc = sum_bw_imc / (NUM_OF_RUNS - 1);
-               avg_bw_resc = sum_bw_resc / (NUM_OF_RUNS - 1);
+               avg_bw_imc = sum_bw_imc / NUM_OF_RUNS;
+               avg_bw_resc = sum_bw_resc / NUM_OF_RUNS;
                if (avg_bw_imc < THROTTLE_THRESHOLD || avg_bw_resc < THROTTLE_THRESHOLD) {
                        ksft_print_msg("Bandwidth below threshold (%d MiB). Dropping results from MBA schemata %u.\n",
                                       THROTTLE_THRESHOLD,
index 4224f8ce353854802b4a81870776d49a6fd10f1b..315b2ef3b3bcb935a5fd5e8c81430d6f375f7367 100644 (file)
@@ -22,17 +22,13 @@ show_bw_info(unsigned long *bw_imc, unsigned long *bw_resc, size_t span)
        int runs, ret, avg_diff_per;
        float avg_diff = 0;
 
-       /*
-        * Discard the first value which is inaccurate due to monitoring setup
-        * transition phase.
-        */
-       for (runs = 1; runs < NUM_OF_RUNS ; runs++) {
+       for (runs = 0; runs < NUM_OF_RUNS; runs++) {
                sum_bw_imc += bw_imc[runs];
                sum_bw_resc += bw_resc[runs];
        }
 
-       avg_bw_imc = sum_bw_imc / 4;
-       avg_bw_resc = sum_bw_resc / 4;
+       avg_bw_imc = sum_bw_imc / NUM_OF_RUNS;
+       avg_bw_resc = sum_bw_resc / NUM_OF_RUNS;
        avg_diff = (float)labs(avg_bw_resc - avg_bw_imc) / avg_bw_imc;
        avg_diff_per = (int)(avg_diff * 100);
 
This page took 0.053488 seconds and 4 git commands to generate.