On 04/09/12 04:19, Prem Karat wrote:
The set of functions implemented here will return the cgroup controller
mount points from /etc/cgconfig.conf file which will help in building
the path for various cgroup stat files
Signed-off-by: Prem Karat<[email protected]>
---
client/base_utils.py | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 96 insertions(+)
diff --git a/client/base_utils.py b/client/base_utils.py
index 3e435fa..0a69488 100644
--- a/client/base_utils.py
+++ b/client/base_utils.py
@@ -755,6 +755,102 @@ def process_is_alive(name_pattern):
ignore_status=True) == 0
+def get_cgroup_cpuacct_mntpt():
+ """
+ Get cgroup cpuacct controller mount point from /etc/cgconfig.conf file
+ This would help in building the path of domain specific
+ cpuacct.usage_percpu and other domain specific cgroup stat files
+ """
+ f_cgcon = open("/etc/cgconfig.conf", "rU")
As far as I know, we do not need configure "/etc/cgconfig.conf" on
fedora17 with default,
but we can stiil use cgroup.:-( Just as follow comments:
...
#
# By default, we expect systemd mounts everything on boot,
# so there is not much to do.
...
If you need to use this function with different os test, maybe you
should think about it.
Just for a reference.^^
thanks
Yu
+ cgconf_txt = f_cgcon.read()
+ f_cgcon.close()
+ cpuact_mntpt = re.findall(r"(?<!#)cpuacct\s*=\s*(.*);", cgconf_txt)
+ return cpuact_mntpt[0]
+
+
+def get_cgroup_cpu_mntpt():
+ """
+ Get cgroup cpu controller mount point from /etc/cgconfig.conf file
+ This would help in building the path of domain specific cpu stat files.
+ """
+ f_cgcon = open("/etc/cgconfig.conf", "rU")
+ cgconf_txt = f_cgcon.read()
+ f_cgcon.close()
+ cpu_mntpt = re.findall(r"(?<!#)cpu\s*=\s*(.*);", cgconf_txt)
+ return cpu_mntpt[0]
+
+
+def get_cgroup_memory_mntpt():
+ """
+ Get cgroup memory controller mount point from /etc/cgconfig.conf file
+ This would help in building the path of domain specific mem files
+ """
+ f_cgcon = open("/etc/cgconfig.conf", "rU")
+ cgconf_txt = f_cgcon.read()
+ f_cgcon.close()
+ mem_mntpt = re.findall(r"(?<!#)memory\s*=\s*(.*);", cgconf_txt)
+ return mem_mntpt[0]
+
+
+def get_cgroup_cpuset_mntpt():
+ """
+ Get cgroup cpuset controller mount point from /etc/cgconfig.conf file
+ This would help in building the path of domain specific cpuset files.
+ """
+ f_cgcon = open("/etc/cgconfig.conf", "rU")
+ cgconf_txt = f_cgcon.read()
+ f_cgcon.close()
+ cpuset_mntpt = re.findall(r"(?<!#)cpuset\s*=\s*(.*);", cgconf_txt)
+ return cpuset_mntpt[0]
+
+
+def get_cgroup_devices_mntpt():
+ """
+ Get cgroup device controller mount point from /etc/cgconfig.conf file
+ This would help in building the path of domain specific dev files.
+ """
+ f_cgcon = open("/etc/cgconfig.conf", "rU")
+ cgconf_txt = f_cgcon.read()
+ f_cgcon.close()
+ devices_mntpt = re.findall(r"(?<!#)devices\s*=\s*(.*);", cgconf_txt)
+ return devices_mntpt[0]
+
+
+def get_cgroup_freezer_mntpt():
+ """
+ Get cgroup freezer controller mount point from /etc/cgconfig.conf file
+ This would help in building the path of domain specific freezer stats.
+ """
+ f_cgcon = open("/etc/cgconfig.conf", "rU")
+ cgconf_txt = f_cgcon.read()
+ f_cgcon.close()
+ freezer_mntpt = re.findall(r"(?<!#)freezer\s*=\s*(.*);", cgconf_txt)
+ return freezer_mntpt[0]
+
+
+def get_cgroup_blkio_mntpt():
+ """
+ Get cgroup blkio controller mount point from /etc/cgconfig.conf file
+ This would help in building the path of domain specfc blkio stat files
+ """
+ f_cgcon = open("/etc/cgconfig.conf", "rU")
+ cgconf_txt = f_cgcon.read()
+ f_cgcon.close()
+ blkio_mntpt = re.findall(r"(?<!#)blkio\s*=\s*(.*);", cgconf_txt)
+ return blkio_mntpt[0]
+
+
+def get_cgroup_netcls_mntpt():
+ """
+ Get cgroup net_cls controller mount point from /etc/cgconfig.conf file
+ """
+ f_cgcon = open("/etc/cgconfig.conf", "rU")
+ cgconf_txt = f_cgcon.read()
+ f_cgcon.close()
+ netcls_mntpt = re.findall(r"(?<!#)net_cls\s*=\s*(.*);", cgconf_txt)
+ return netcls_mntpt[0]
+
+
def get_hwclock_seconds(utc=True):
"""
Return the hardware clock in seconds as a floating point value.
--
Best Regards
Yu Mingfei
_______________________________________________
Autotest-kernel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/autotest-kernel