Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests/resctrl: Keep results from first test run

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 <reinette.chatre@intel.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>

authored by

Reinette Chatre and committed by
Shuah Khan
295b8984 501cfdba

+8 -17
+2 -3
tools/testing/selftests/resctrl/cmt_test.c
··· 99 99 } 100 100 101 101 /* Field 3 is llc occ resc value */ 102 - if (runs > 0) 103 - sum_llc_occu_resc += strtoul(token_array[3], NULL, 0); 102 + sum_llc_occu_resc += strtoul(token_array[3], NULL, 0); 104 103 runs++; 105 104 } 106 105 fclose(fp); 107 106 108 107 return show_results_info(sum_llc_occu_resc, no_of_bits, span, 109 - MAX_DIFF, MAX_DIFF_PERCENT, runs - 1, true); 108 + MAX_DIFF, MAX_DIFF_PERCENT, runs, true); 110 109 } 111 110 112 111 static void cmt_test_cleanup(void)
+3 -7
tools/testing/selftests/resctrl/mba_test.c
··· 86 86 int avg_diff_per; 87 87 float avg_diff; 88 88 89 - /* 90 - * The first run is discarded due to inaccurate value from 91 - * phase transition. 92 - */ 93 - for (runs = NUM_OF_RUNS * allocation + 1; 89 + for (runs = NUM_OF_RUNS * allocation; 94 90 runs < NUM_OF_RUNS * allocation + NUM_OF_RUNS ; runs++) { 95 91 sum_bw_imc += bw_imc[runs]; 96 92 sum_bw_resc += bw_resc[runs]; 97 93 } 98 94 99 - avg_bw_imc = sum_bw_imc / (NUM_OF_RUNS - 1); 100 - avg_bw_resc = sum_bw_resc / (NUM_OF_RUNS - 1); 95 + avg_bw_imc = sum_bw_imc / NUM_OF_RUNS; 96 + avg_bw_resc = sum_bw_resc / NUM_OF_RUNS; 101 97 if (avg_bw_imc < THROTTLE_THRESHOLD || avg_bw_resc < THROTTLE_THRESHOLD) { 102 98 ksft_print_msg("Bandwidth below threshold (%d MiB). Dropping results from MBA schemata %u.\n", 103 99 THROTTLE_THRESHOLD,
+3 -7
tools/testing/selftests/resctrl/mbm_test.c
··· 22 22 int runs, ret, avg_diff_per; 23 23 float avg_diff = 0; 24 24 25 - /* 26 - * Discard the first value which is inaccurate due to monitoring setup 27 - * transition phase. 28 - */ 29 - for (runs = 1; runs < NUM_OF_RUNS ; runs++) { 25 + for (runs = 0; runs < NUM_OF_RUNS; runs++) { 30 26 sum_bw_imc += bw_imc[runs]; 31 27 sum_bw_resc += bw_resc[runs]; 32 28 } 33 29 34 - avg_bw_imc = sum_bw_imc / 4; 35 - avg_bw_resc = sum_bw_resc / 4; 30 + avg_bw_imc = sum_bw_imc / NUM_OF_RUNS; 31 + avg_bw_resc = sum_bw_resc / NUM_OF_RUNS; 36 32 avg_diff = (float)labs(avg_bw_resc - avg_bw_imc) / avg_bw_imc; 37 33 avg_diff_per = (int)(avg_diff * 100); 38 34