Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
tp-qemu
提交
799254ae
T
tp-qemu
项目概览
openeuler
/
tp-qemu
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
tp-qemu
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
799254ae
编写于
9月 28, 2018
作者:
Q
Qianqian Zhu
提交者:
GitHub
9月 28, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1228 from sitoliu/timedrift_longtime
timedrift: delete redundant command for adding host load
上级
6c48237b
e0031b11
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
34 addition
and
17 deletion
+34
-17
generic/tests/cfg/timedrift.cfg
generic/tests/cfg/timedrift.cfg
+7
-2
qemu/tests/timedrift.py
qemu/tests/timedrift.py
+27
-15
未找到文件。
generic/tests/cfg/timedrift.cfg
浏览文件 @
799254ae
...
...
@@ -20,11 +20,16 @@
used_cpus = 100
variants:
- default_load:
host_load_instances = 0
guest_load_instances = 2
- full_load:
# Windows guest is so slow when host and guest both
# in high load, so disable Windows guest
no Windows
test_duration = 28800
interval_gettime = 1800
pre_command = touch /tmp/host_load_timedrift; for (( I=0; I<`grep -c 'processor' /proc/cpuinfo`; I++ )); do echo $I;taskset -c $I /bin/bash -c 'while [ -e /tmp/host_load_timedrift ]; do :; done&'; done
post_command = rm -f /tmp/host_load_timedrift
host_load_instances =
guest_load_instances =
- with_migration:
type = timedrift_with_migration
migration_iterations = 3
...
...
qemu/tests/timedrift.py
浏览文件 @
799254ae
...
...
@@ -4,8 +4,10 @@ import time
import
aexpect
from
avocado.utils
import
process
from
avocado.utils
import
cpu
from
virttest
import
utils_test
from
virttest.compat_52lts
import
decode_to_text
def
run
(
test
,
params
,
env
):
...
...
@@ -37,17 +39,17 @@ def run(test, params, env):
:param mask: The CPU affinity mask.
:return: A dict containing the previous mask for each thread.
"""
tids
=
process
.
system_output
(
"ps -L --pid=%s -o lwp="
%
pid
,
verbose
=
False
,
ignore_status
=
True
).
split
()
tids
=
decode_to_text
(
process
.
system_output
(
"ps -L --pid=%s -o lwp="
%
pid
,
verbose
=
False
,
ignore_status
=
True
)
).
split
()
prev_masks
=
{}
for
tid
in
tids
:
prev_mask
=
process
.
system_output
(
"taskset -p %s"
%
tid
,
verbose
=
False
).
split
()[
-
1
]
prev_mask
=
decode_to_text
(
process
.
system_output
(
"taskset -p %s"
%
tid
,
verbose
=
False
)
).
split
()[
-
1
]
prev_masks
[
tid
]
=
prev_mask
process
.
system
(
"taskset -p %s %s"
%
(
mask
,
tid
),
verbose
=
False
)
children
=
process
.
system_output
(
"ps --ppid=%s -o pid="
%
pid
,
verbose
=
False
,
ignore_status
=
True
).
split
()
children
=
decode_to_text
(
process
.
system_output
(
"ps --ppid=%s -o pid="
%
pid
,
verbose
=
False
,
ignore_status
=
True
)
).
split
()
for
child
in
children
:
prev_masks
.
update
(
set_cpu_affinity
(
child
,
mask
))
return
prev_masks
...
...
@@ -73,7 +75,7 @@ def run(test, params, env):
args_added
=
boot_option_added
)
timeout
=
int
(
params
.
get
(
"login_timeout"
,
360
))
session
=
vm
.
wait_for_login
(
timeout
=
timeout
)
session
=
vm
.
wait_for_
serial_
login
(
timeout
=
timeout
)
# Collect test parameters:
# Command to run to get the current time
...
...
@@ -85,10 +87,16 @@ def run(test, params, env):
guest_load_command
=
params
[
"guest_load_command"
]
guest_load_stop_command
=
params
[
"guest_load_stop_command"
]
host_load_command
=
params
[
"host_load_command"
]
guest_load_instances
=
int
(
params
.
get
(
"guest_load_instances"
,
"1"
))
host_load_instances
=
int
(
params
.
get
(
"host_load_instances"
,
"0"
))
guest_load_instances
=
params
[
"guest_load_instances"
]
host_load_instances
=
params
[
"host_load_instances"
]
if
not
guest_load_instances
and
not
host_load_instances
:
host_load_instances
=
cpu
.
total_cpus_count
()
guest_load_instances
=
vm
.
get_cpu_count
()
else
:
host_load_instances
=
int
(
host_load_instances
)
guest_load_instances
=
int
(
guest_load_instances
)
# CPU affinity mask for taskset
cpu_mask
=
params
.
get
(
"cpu_mask"
,
"0xFF"
)
cpu_mask
=
int
(
params
.
get
(
"cpu_mask"
,
"0xFF"
),
16
)
load_duration
=
float
(
params
.
get
(
"load_duration"
,
"30"
))
rest_duration
=
float
(
params
.
get
(
"rest_duration"
,
"10"
))
drift_threshold
=
float
(
params
.
get
(
"drift_threshold"
,
"200"
))
...
...
@@ -107,7 +115,7 @@ def run(test, params, env):
# Open shell sessions with the guest
logging
.
info
(
"Starting load on guest..."
)
for
i
in
range
(
guest_load_instances
):
load_session
=
vm
.
login
(
)
load_session
=
vm
.
wait_for_login
(
timeout
=
timeout
)
# Set output func to None to stop it from being called so we
# can change the callback function and the parameters it takes
# with no problems
...
...
@@ -125,8 +133,12 @@ def run(test, params, env):
time_format
)
# Run some load on the guest
for
load_session
in
guest_load_sessions
:
load_session
.
sendline
(
guest_load_command
)
if
params
[
"os_type"
]
==
"linux"
:
for
i
,
load_session
in
enumerate
(
guest_load_sessions
):
load_session
.
sendline
(
guest_load_command
%
i
)
else
:
for
load_session
in
guest_load_sessions
:
load_session
.
sendline
(
guest_load_command
)
# Run some load on the host
logging
.
info
(
"Starting load on host..."
)
...
...
@@ -138,7 +150,7 @@ def run(test, params, env):
host_load_sessions
.
append
(
load_cmd
)
# Set the CPU affinity of the load process
pid
=
load_cmd
.
get_pid
()
set_cpu_affinity
(
pid
,
cpu_mask
)
set_cpu_affinity
(
pid
,
cpu_mask
<<
i
)
# Sleep for a while (during load)
logging
.
info
(
"Sleeping for %s seconds..."
,
load_duration
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录