selftests/resctrl: Calculate resctrl FS derived mem bw over sleep(1) only
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Mon, 10 Jun 2024 15:14:43 +0000 (18:14 +0300)
committerShuah Khan <skhan@linuxfoundation.org>
Thu, 11 Jul 2024 17:23:53 +0000 (11:23 -0600)
commitda50de0a92f31605423e39e6ccf3ce7508e88a7a
treeed0913e36d1751e6823660eaaaba95df609716c9
parentc44000b6535dc9806b9128d1aed403862b2adab9
selftests/resctrl: Calculate resctrl FS derived mem bw over sleep(1) only

For MBM/MBA tests, measure_vals() calls get_mem_bw_imc() that performs
the measurement over a duration of sleep(1) call. The memory bandwidth
numbers from IMC are derived over this duration. The resctrl FS derived
memory bandwidth, however, is calculated inside measure_vals() and only
takes delta between the previous value and the current one which
besides the actual test, also samples inter-test noise.

Rework the logic in measure_vals() and get_mem_bw_imc() such that the
resctrl FS memory bandwidth section covers much shorter duration
closely matching that of the IMC perf counters to improve measurement
accuracy.

For the second read after rewind() to return a fresh value, also
newline has to be consumed by the fscanf().

Suggested-by: Reinette Chatre <reinette.chatre@intel.com>
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>
tools/testing/selftests/resctrl/resctrl_val.c