Signed-off-by: Satheesh Rajendran <[email protected]>
Signed-off-by: pradeep K Surisetty <[email protected]>
new file: client/tests/kvm/tests/perf_kvm.py
modified: client/virt/subtests.cfg.sample
---
client/tests/kvm/tests/perf_kvm.py | 58 ++++++++++++++++++++++++++++++++++++
client/virt/subtests.cfg.sample | 10 +++++++
2 files changed, 68 insertions(+)
create mode 100644 client/tests/kvm/tests/perf_kvm.py
diff --git a/client/tests/kvm/tests/perf_kvm.py
b/client/tests/kvm/tests/perf_kvm.py
new file mode 100644
index 0000000..f93676f
--- /dev/null
+++ b/client/tests/kvm/tests/perf_kvm.py
@@ -0,0 +1,58 @@
+import os, commands, glob
+from autotest.client.shared import error
+from autotest.client.virt import virt_utils, virt_vm
+from autotest.client import utils
+
[email protected]_aware
+def run_perf_kvm(test, params, env):
+ """
+ run perf tool to get kvm events info
+
+ @param test: kvm test object
+ @param params: Dictionary with the test parameters
+ @param env: Dictionary with test environment.
+ """
+
+
+ # Collect test parameters
+ test_timeout = int(params.get("test_timeout", 240))
+ login_timeout = float(params.get("login_timeout", 360))
+ transfer_timeout = int(params.get("transfer_timeout"))
+ perf_record_timeout = int(params.get("perf_record_timeout"))
+ vm_kallsyms_path = params.get("vm_kallsyms_path")
+ vm_modules_path = params.get("vm_modules_path")
+
+ # Checking the main vm is alive
+ vm = env.get_vm(params["main_vm"])
+ vm.create()
+ session = vm.wait_for_login(timeout=login_timeout)
+
+ # Prepare test environment in guest
+ error.context("copying the symbols path")
+ session.cmd(params.get("kallsyms_cmd"))
+
+ error.context("copying the modules path")
+ session.cmd(params.get("modules_cmd"))
+
+ error.context(" trasfering kallsyms from guest to host")
+ vm.copy_files_from("/tmp/guest_kallsyms", "/tmp", timeout=transfer_timeout)
+
+ error.context(" trasfering modules from guest to host")
+ vm.copy_files_from("/tmp/guest_modules", "/tmp", timeout=transfer_timeout)
+
+ # Building perf record command
+ perf_record_cmd = "perf kvm --host --guest --guestkallsyms=%s" %
(vm_kallsyms_path)
+ perf_record_cmd += " --guestmodules=%s record -a -o /tmp/perf.data sleep
%s " % (vm_modules_path,
+
perf_record_timeout)
+ # Building perf report command
+ perf_report_cmd = "perf kvm --host --guest --guestkallsyms=%s" %
(vm_kallsyms_path)
+ perf_report_cmd += " --guestmodules=%s report -i /tmp/perf.data --force "
% (vm_modules_path)
+
+ error.context("Recording perf events")
+ utils.system(perf_record_cmd)
+
+ error.context("Reporting perf events")
+ utils.system(perf_report_cmd)
+
+ # Closing the session
+ session.close()
diff --git a/client/virt/subtests.cfg.sample b/client/virt/subtests.cfg.sample
index ebfbff5..6318a15 100644
--- a/client/virt/subtests.cfg.sample
+++ b/client/virt/subtests.cfg.sample
@@ -911,6 +911,16 @@ variants:
type = smbios_table
start_vm = no
+ - perf_kvm: install setup image_copy unattended_install.cdrom
+ only linux
+ type = perf_kvm
+ vm_kallsyms_path = "/tmp/guest_kallsyms"
+ vm_modules_path = "/tmp/guest_modules"
+ kallsyms_cmd = "cat /proc/kallsyms > /tmp/guest_kallsyms"
+ modules_cmd = "cat /proc/modules > /tmp/guest_modules"
+ transfer_timeout = 100
+ perf_record_timeout = 50
+
- softlockup: install setup unattended_install.cdrom
only Linux
type = softlockup
--
1.7.10
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest