未验证 提交 2d2db432 编写于 作者: P Praveen K Pandey

Merge branch 'perf_api_1' of https://github.com/nasastry/avocado into nasastry-perf_api_1

Signed-off-by: Praveen K Pandey praveen@linux.vnet.ibm.com
...@@ -1641,3 +1641,21 @@ def get_owner_id(pid): ...@@ -1641,3 +1641,21 @@ def get_owner_id(pid):
return os.stat('/proc/%d/' % pid).st_uid return os.stat('/proc/%d/' % pid).st_uid
except OSError: except OSError:
return None return None
def get_perf_events(pattern):
"""
Run 'perf list' command, with the matching pattern create a
list and return it.
:param pattern: Pattern to search.
:type pattern: str.
:return: list of events matching the 'pattern'.
:rtype: list of str.
"""
list_of_events = []
for line in system_output("perf list").split('\n'):
if pattern in line:
list_of_events.append(line)
return list_of_events
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册