Skip to content

Commit 295b898

Browse files
rchatreshuahkh
authored andcommitted
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 da50de0 ("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]>
1 parent 501cfdb commit 295b898

File tree

3 files changed

+8
-17
lines changed

3 files changed

+8
-17
lines changed

tools/testing/selftests/resctrl/cmt_test.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,13 @@ static int check_results(struct resctrl_val_param *param, size_t span, int no_of
9999
}
100100

101101
/* 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);
104103
runs++;
105104
}
106105
fclose(fp);
107106

108107
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);
110109
}
111110

112111
static void cmt_test_cleanup(void)

tools/testing/selftests/resctrl/mba_test.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,18 +86,14 @@ static bool show_mba_info(unsigned long *bw_imc, unsigned long *bw_resc)
8686
int avg_diff_per;
8787
float avg_diff;
8888

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;
9490
runs < NUM_OF_RUNS * allocation + NUM_OF_RUNS ; runs++) {
9591
sum_bw_imc += bw_imc[runs];
9692
sum_bw_resc += bw_resc[runs];
9793
}
9894

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;
10197
if (avg_bw_imc < THROTTLE_THRESHOLD || avg_bw_resc < THROTTLE_THRESHOLD) {
10298
ksft_print_msg("Bandwidth below threshold (%d MiB). Dropping results from MBA schemata %u.\n",
10399
THROTTLE_THRESHOLD,

tools/testing/selftests/resctrl/mbm_test.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,13 @@ show_bw_info(unsigned long *bw_imc, unsigned long *bw_resc, size_t span)
2222
int runs, ret, avg_diff_per;
2323
float avg_diff = 0;
2424

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++) {
3026
sum_bw_imc += bw_imc[runs];
3127
sum_bw_resc += bw_resc[runs];
3228
}
3329

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;
3632
avg_diff = (float)labs(avg_bw_resc - avg_bw_imc) / avg_bw_imc;
3733
avg_diff_per = (int)(avg_diff * 100);
3834

0 commit comments

Comments
 (0)