Skip to content

Commit 3dad011

Browse files
ij-intelshuahkh
authored andcommitted
selftests/resctrl: Pass the real number of tests to show_cache_info()
Results include warm-up test which is discarded before passing the sum to show_cache_info(). show_cache_info() handles this by subtracting one from the number of tests in divisor. It is a trappy construct to have sum and number of tests parameters to disagree like this. A more logical place for subtracting the skipped tests is where the sum is calculated so move it there. Pass the correct number of tests to show_cache_info() so it can be used directly as the divisor for calculating the average. Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Reviewed-by: Reinette Chatre <reinette.chatre@intel.com> Tested-by: Babu Moger <babu.moger@amd.com> Tested-by: Shaopeng Tan (Fujitsu) <tan.shaopeng@fujitsu.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
1 parent 85b7344 commit 3dad011

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

tools/testing/selftests/resctrl/cache.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ int show_cache_info(unsigned long sum_llc_val, int no_of_bits,
294294
long avg_diff = 0;
295295
int ret;
296296

297-
avg_llc_val = sum_llc_val / (num_of_runs - 1);
297+
avg_llc_val = sum_llc_val / num_of_runs;
298298
avg_diff = (long)abs(cache_span - avg_llc_val);
299299
diff_percent = ((float)cache_span - avg_llc_val) / cache_span * 100;
300300

tools/testing/selftests/resctrl/cat_test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ static int check_results(struct resctrl_val_param *param)
7777
no_of_bits = count_bits(param->mask);
7878

7979
return show_cache_info(sum_llc_perf_miss, no_of_bits, param->span / 64,
80-
MAX_DIFF, MAX_DIFF_PERCENT, NUM_OF_RUNS,
80+
MAX_DIFF, MAX_DIFF_PERCENT, runs - 1,
8181
get_vendor() == ARCH_INTEL, false);
8282
}
8383

tools/testing/selftests/resctrl/cmt_test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ static int check_results(struct resctrl_val_param *param, int no_of_bits)
5959
fclose(fp);
6060

6161
return show_cache_info(sum_llc_occu_resc, no_of_bits, param->span,
62-
MAX_DIFF, MAX_DIFF_PERCENT, NUM_OF_RUNS,
62+
MAX_DIFF, MAX_DIFF_PERCENT, runs - 1,
6363
true, true);
6464
}
6565

0 commit comments

Comments
 (0)