This function will return the percpu stats of a domain from cgroup
cpuacct controller file. The return value is a list of percpu stats
in nano seconds

Signed-off-by: Prem Karat <[email protected]>
---
 client/virt/utils_test.py |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/client/virt/utils_test.py b/client/virt/utils_test.py
index c43b594..e5c2393 100644
--- a/client/virt/utils_test.py
+++ b/client/virt/utils_test.py
@@ -946,6 +946,20 @@ def get_memory_info(lvms):
     return meminfo
 
 
+def domstat_cgroup_cpuacct_percpu(domain):
+    """
+    Get a list of domain-specific percpu stats from cgroup cpuacct controller
+    @param domain: Domain name
+    """
+    percpu_act_file = utils.get_cgroup_cpuacct_mntpt() \
+                      + "/libvirt/qemu/" + domain \
+                      + "/cpuacct.usage_percpu"
+    f_percpu_act = open(percpu_act_file, "rU")
+    cpuacct_usage_percpu = f_percpu_act.readline().split()
+    f_percpu_act.close()
+    return cpuacct_usage_percpu
+
+
 def run_file_transfer(test, params, env):
     """
     Transfer a file back and forth between host and guest.
-- 
1.7.10.4

-- 
        -prem

_______________________________________________
Autotest-kernel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/autotest-kernel

Reply via email to