diff options
| author | Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> | 2024-06-10 18:14:50 +0300 |
|---|---|---|
| committer | Shuah Khan <skhan@linuxfoundation.org> | 2024-07-11 11:23:54 -0600 |
| commit | 0e251816995a1972062fc7ad32047c1aee9cd704 (patch) | |
| tree | 63cb4337a08e0668585dbb4250b4f4c5fc7b9578 /tools/testing/selftests/resctrl/cmt_test.c | |
| parent | 711d27b05a97cd5c8e62c858c2c940d79f8445e1 (diff) | |
selftests/resctrl: Add ->measure() callback to resctrl_val_param
The measurement done in resctrl_val() varies depending on test type.
The decision for how to measure is decided based on the string compare
to test name which is quite inflexible.
Add ->measure() callback into the struct resctrl_val_param to allow
each test to provide necessary code as a function which simplifies what
resctrl_val() has to do.
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Tested-by: Babu Moger <babu.moger@amd.com>
Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'tools/testing/selftests/resctrl/cmt_test.c')
| -rw-r--r-- | tools/testing/selftests/resctrl/cmt_test.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/testing/selftests/resctrl/cmt_test.c b/tools/testing/selftests/resctrl/cmt_test.c index 0105afec6188..f6cb258f873d 100644 --- a/tools/testing/selftests/resctrl/cmt_test.c +++ b/tools/testing/selftests/resctrl/cmt_test.c @@ -29,6 +29,13 @@ static int cmt_setup(const struct resctrl_test *test, return 0; } +static int cmt_measure(const struct user_params *uparams, + struct resctrl_val_param *param, pid_t bm_pid) +{ + sleep(1); + return measure_llc_resctrl(param->filename, bm_pid); +} + static int show_results_info(unsigned long sum_llc_val, int no_of_bits, unsigned long cache_span, unsigned long max_diff, unsigned long max_diff_percent, unsigned long num_of_runs, @@ -133,6 +140,7 @@ static int cmt_run_test(const struct resctrl_test *test, const struct user_param .mask = ~(long_mask << n) & long_mask, .num_of_runs = 0, .setup = cmt_setup, + .measure = cmt_measure, }; span = cache_portion_size(cache_total_size, param.mask, long_mask); |