From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: linux-kselftest@vger.kernel.org,
Reinette Chatre <reinette.chatre@intel.com>,
Shuah Khan <shuah@kernel.org>,
Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>,
Fenghua Yu <fenghua.yu@intel.com>,
linux-kernel@vger.kernel.org
Cc: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Subject: [PATCH v3 18/19] selftests/resctrl: Pass the real number of tests to show_cache_info()
Date: Mon, 5 Jun 2023 21:01:44 +0300 [thread overview]
Message-ID: <20230605180145.112924-19-ilpo.jarvinen@linux.intel.com> (raw)
In-Reply-To: <20230605180145.112924-1-ilpo.jarvinen@linux.intel.com>
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>
---
tools/testing/selftests/resctrl/cache.c | 2 +-
tools/testing/selftests/resctrl/cat_test.c | 2 +-
tools/testing/selftests/resctrl/cmt_test.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/resctrl/cache.c b/tools/testing/selftests/resctrl/cache.c
index 385c01dd3ec6..5aa112e5fdd3 100644
--- a/tools/testing/selftests/resctrl/cache.c
+++ b/tools/testing/selftests/resctrl/cache.c
@@ -290,7 +290,7 @@ int show_cache_info(unsigned long sum_llc_val, int no_of_bits,
long avg_diff = 0;
int ret;
- avg_llc_val = sum_llc_val / (num_of_runs - 1);
+ avg_llc_val = sum_llc_val / num_of_runs;
avg_diff = (long)abs(cache_span - avg_llc_val);
diff_percent = ((float)cache_span - avg_llc_val) / cache_span * 100;
diff --git a/tools/testing/selftests/resctrl/cat_test.c b/tools/testing/selftests/resctrl/cat_test.c
index ed6c8e64ad11..3848dfb46aba 100644
--- a/tools/testing/selftests/resctrl/cat_test.c
+++ b/tools/testing/selftests/resctrl/cat_test.c
@@ -77,7 +77,7 @@ static int check_results(struct resctrl_val_param *param)
no_of_bits = count_bits(param->mask);
return show_cache_info(sum_llc_perf_miss, no_of_bits, param->span / 64,
- MAX_DIFF, MAX_DIFF_PERCENT, NUM_OF_RUNS,
+ MAX_DIFF, MAX_DIFF_PERCENT, runs - 1,
get_vendor() == ARCH_INTEL, false);
}
diff --git a/tools/testing/selftests/resctrl/cmt_test.c b/tools/testing/selftests/resctrl/cmt_test.c
index 0ac9d6bbd13d..cb2197647c6c 100644
--- a/tools/testing/selftests/resctrl/cmt_test.c
+++ b/tools/testing/selftests/resctrl/cmt_test.c
@@ -59,7 +59,7 @@ static int check_results(struct resctrl_val_param *param, int no_of_bits)
fclose(fp);
return show_cache_info(sum_llc_occu_resc, no_of_bits, param->span,
- MAX_DIFF, MAX_DIFF_PERCENT, NUM_OF_RUNS,
+ MAX_DIFF, MAX_DIFF_PERCENT, runs - 1,
true, true);
}
--
2.30.2
next prev parent reply other threads:[~2023-06-05 18:05 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-05 18:01 [PATCH v3 00/19] selftests/resctrl: Fixes and cleanups Ilpo Järvinen
2023-06-05 18:01 ` [PATCH v3 01/19] selftests/resctrl: Add resctrl.h into build deps Ilpo Järvinen
2023-06-05 18:01 ` [PATCH v3 02/19] selftests/resctrl: Don't leak buffer in fill_cache() Ilpo Järvinen
2023-06-05 18:01 ` [PATCH v3 03/19] selftests/resctrl: Unmount resctrl FS if child fails to run benchmark Ilpo Järvinen
2023-06-05 18:01 ` [PATCH v3 04/19] selftests/resctrl: Close perf value read fd on errors Ilpo Järvinen
2023-06-05 18:01 ` [PATCH v3 05/19] selftests/resctrl: Unmount resctrl FS before starting the first test Ilpo Järvinen
2023-06-05 18:01 ` [PATCH v3 06/19] selftests/resctrl: Move resctrl FS mount/umount to higher level Ilpo Järvinen
2023-06-05 18:01 ` [PATCH v3 07/19] selftests/resctrl: Refactor remount_resctrl(bool mum_resctrlfs) to mount_resctrl() Ilpo Järvinen
2023-06-05 18:01 ` [PATCH v3 08/19] selftests/resctrl: Remove mum_resctrlfs from struct resctrl_val_param Ilpo Järvinen
2023-06-05 18:01 ` [PATCH v3 09/19] selftests/resctrl: Convert span to size_t Ilpo Järvinen
2023-06-05 18:01 ` [PATCH v3 10/19] selftests/resctrl: Express span internally in bytes Ilpo Järvinen
2023-06-05 18:01 ` [PATCH v3 11/19] selftests/resctrl: Remove duplicated preparation for span arg Ilpo Järvinen
2023-06-05 18:01 ` [PATCH v3 12/19] selftests/resctrl: Remove "malloc_and_init_memory" param from run_fill_buf() Ilpo Järvinen
2023-06-05 18:01 ` [PATCH v3 13/19] selftests/resctrl: Remove unnecessary startptr global from fill_buf Ilpo Järvinen
2023-06-05 18:01 ` [PATCH v3 14/19] selftests/resctrl: Improve parameter consistency in fill_buf Ilpo Järvinen
2023-06-05 18:01 ` [PATCH v3 15/19] selftests/resctrl: Don't pass test name to fill_buf Ilpo Järvinen
2023-06-05 18:01 ` [PATCH v3 16/19] selftests/resctrl: Don't use variable argument list for ->setup() Ilpo Järvinen
2023-06-05 18:01 ` [PATCH v3 17/19] selftests/resctrl: Move CAT/CMT test global vars to function they are used in Ilpo Järvinen
2023-06-05 18:01 ` Ilpo Järvinen [this message]
2023-06-05 18:01 ` [PATCH v3 19/19] selftests/resctrl: Remove test type checks from cat_val() Ilpo Järvinen
2023-06-12 6:02 ` [PATCH v3 00/19] selftests/resctrl: Fixes and cleanups Shaopeng Tan (Fujitsu)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230605180145.112924-19-ilpo.jarvinen@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=fenghua.yu@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=reinette.chatre@intel.com \
--cc=shuah@kernel.org \
--cc=tan.shaopeng@jp.fujitsu.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox