summaryrefslogtreecommitdiffstats
path: root/testsuites/vstf/vstf_scripts/vstf/agent/perf/sar.py
diff options
context:
space:
mode:
Diffstat (limited to 'testsuites/vstf/vstf_scripts/vstf/agent/perf/sar.py')
-rw-r--r--testsuites/vstf/vstf_scripts/vstf/agent/perf/sar.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/testsuites/vstf/vstf_scripts/vstf/agent/perf/sar.py b/testsuites/vstf/vstf_scripts/vstf/agent/perf/sar.py
index 0231d5c1..72d0082d 100644
--- a/testsuites/vstf/vstf_scripts/vstf/agent/perf/sar.py
+++ b/testsuites/vstf/vstf_scripts/vstf/agent/perf/sar.py
@@ -20,13 +20,17 @@ LOG = logging.getLogger(__name__)
class Sar(object):
+
def __init__(self):
self.sar_cmd_str = "sar -u %(interval)s"
self.child_process = {}
def start(self, interval=2):
cmd = self.sar_cmd_str % {'interval': interval}
- child = my_popen(cmd.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ child = my_popen(
+ cmd.split(),
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
time.sleep(1)
if child.poll() is not None:
print child.poll()
@@ -55,7 +59,9 @@ class Sar(object):
data = {}
for h, d in zip(head, average):
data[h.strip('%')] = float(d)
- cpu_num = check_output('cat /proc/cpuinfo | grep processor | wc -l', shell=True).strip()
+ cpu_num = check_output(
+ 'cat /proc/cpuinfo | grep processor | wc -l',
+ shell=True).strip()
data.update({'cpu_num': int(cpu_num)})
return data