-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
numa_prealloc_handling: Basic preallocation handling
Creates a new case that measures the time that needs QEMU to preallocate the memory with and without thread-context. Signed-off-by: mcasquer <[email protected]>
- Loading branch information
Showing
2 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
- numa_prealloc_handling: | ||
no RHEL.6 RHEL.7 RHEL.8 | ||
no Host_RHEL.m6 Host_RHEL.m7 Host_RHEL.m8 | ||
required_qemu = [7.2,) | ||
type = numa_prealloc_handling | ||
virt_test_type = qemu | ||
not_preprocess = yes | ||
vms = "" | ||
cmd_time_taskset = "/usr/bin/time -f %%e taskset -c 0" | ||
cmd_qemu_options = "-nographic -sandbox on,resourcecontrol=deny -monitor stdio -cpu host -object memory-backend-ram,id=mem0,size=20G,prealloc=on,prealloc-threads=4" | ||
cmd_option_tc = ",prealloc-context=tc1 -object thread-context,id=tc1,cpu-affinity=1-7" | ||
cmd_without_tc = "${cmd_time_taskset} %s ${cmd_qemu_options} 2>&1 | tail -1" | ||
cmd_with_tc = "${cmd_time_taskset} %s ${cmd_qemu_options}${cmd_option_tc} 2>&1 | tail -1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from avocado.utils import process | ||
from virttest import utils_misc | ||
|
||
|
||
def run(test, params, env): | ||
""" | ||
numa_prealloc_handling test | ||
1) Measures the time takes QEMU to preallocate the memory | ||
2) Checks the timing is shorter when thread-context is used | ||
:param test: QEMU test object | ||
:param params: Dictionary with the test parameters | ||
:param env: Dictionary with test environment | ||
""" | ||
qemu_path = utils_misc.get_qemu_binary(params) | ||
|
||
cmd_without_tc = params.get("cmd_without_tc") % qemu_path | ||
cmd_with_tc = params.get("cmd_with_tc") % qemu_path | ||
|
||
execution_time = float(process.getoutput(cmd_without_tc, | ||
ignore_status=True, | ||
shell=True)) | ||
test.log.debug("Execution time without thread_context: %f" % execution_time) | ||
|
||
execution_time_tc = float(process.getoutput(cmd_with_tc, | ||
ignore_status=True, | ||
shell=True)) | ||
test.log.debug("Execution time with thread_context: %f" % execution_time_tc) | ||
|
||
if execution_time <= execution_time_tc: | ||
test.fail("There is no boot time speedup when using thread-context!") |