-
Notifications
You must be signed in to change notification settings - Fork 174
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 <mcasquer@redhat.com>
- 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,14 @@ | ||
- 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 = "{ time taskset -c 0" | ||
cmd_qemu_binary_path = "/usr/libexec/qemu-kvm" | ||
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} ${cmd_qemu_binary_path} ${cmd_qemu_options} ; } 2>&1 | grep real" | ||
cmd_with_tc = "${cmd_time_taskset} ${cmd_qemu_binary_path} ${cmd_qemu_options},${cmd_option_tc} ; } 2>&1 | grep real" |
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,29 @@ | ||
import re | ||
from avocado.utils import process | ||
|
||
|
||
def get_qemu_exec_time(cmd_line): | ||
result = process.run(cmd_line, ignore_status=True, shell=True) | ||
result = str(result.stdout).split("\\t")[-1].split("\\n")[0] | ||
execution_time = int(re.sub("\\D", "", result)) | ||
return execution_time | ||
|
||
|
||
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 | ||
""" | ||
cmd_without_tc = params.get("cmd_without_tc") | ||
cmd_with_tc = params.get("cmd_with_tc") | ||
|
||
execution_time = get_qemu_exec_time(cmd_without_tc) | ||
|
||
execution_time_tc = get_qemu_exec_time(cmd_with_tc) | ||
|
||
if execution_time <= execution_time_tc: | ||
test.fail("There is no boot time speedup when using thread-context!") |