From 8312bd4367395fdba877f084d1f72590f10c44c7 Mon Sep 17 00:00:00 2001 From: Martin Klozik Date: Mon, 7 Sep 2015 00:44:50 +0100 Subject: Sysmetrics implementation update New sysmetrics implementation is based on pidstat command line tool from sysstat package. Old non-functional implementation was removed. Reporting was refactored to generate report after each TC from values already available in memory. Following files were affected: modified: conf/01_testcases.conf modified: conf/02_vswitch.conf modified: conf/05_collector.conf deleted: core/collector_controller.py modified: core/component_factory.py modified: docs/NEWS.rst modified: packages.txt modified: requirements.txt modified: testcases/testcase.py modified: tools/collectors/collector/collector.py modified: tools/collectors/sysmetrics/__init__.py deleted: tools/collectors/sysmetrics/linuxmetrics.py new file: tools/collectors/sysmetrics/pidstat.py modified: tools/report/report.jinja modified: tools/report/report.py modified: tools/systeminfo.py modified: vsperf JIRA: VSPERF-67 Change-Id: I25a79f2afef405b9ac46ae85c18044af167a62a4 Signed-off-by: Martin Klozik (martinx.klozik@intel.com) Reviewed-by: Billy O Mahony Reviewed-by: Maryam Tahhan Reviewed-by: Al Morton Reviewed-by: Gurpreet Singh Reviewed-by: Tv Rao --- tools/systeminfo.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'tools/systeminfo.py') diff --git a/tools/systeminfo.py b/tools/systeminfo.py index 19c5d16e..287a74d2 100644 --- a/tools/systeminfo.py +++ b/tools/systeminfo.py @@ -137,3 +137,25 @@ def get_memory_bytes(): return int(mem) +def get_pids(proc_names_list): + """ Get pid(s) of process(es) with given name(s) + + :returns: list with pid(s) of given processes or None if processes + with given names are not running + """ + + try: + pids = subprocess.check_output(['pidof'] + proc_names_list) + except: + # such process isn't running + return None + + return list(map(str, map(int, pids.split()))) + +def get_pid(proc_name_str): + """ Get pid(s) of process with given name + + :returns: list with pid(s) of given process or None if process + with given name is not running + """ + return get_pids([proc_name_str]) -- cgit 1.2.3-korg