aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/PerfUtil.py
diff options
context:
space:
mode:
authorpmikus <pmikus@cisco.com>2020-08-21 09:53:24 +0000
committerPeter Mikus <pmikus@cisco.com>2020-08-24 06:42:43 +0000
commit273d2ea03c4fa35ea5b656872f06f6e6d2e6f851 (patch)
tree22d82abfdd6591eac7179e81eab04d0f409c34d6 /resources/libraries/python/PerfUtil.py
parent00460a1ba11a6112a08256d39d927f2a309b1b99 (diff)
Framework: Qemu alignments
Signed-off-by: pmikus <pmikus@cisco.com> Change-Id: I2781e85f44acffb4f8d7f02326ba2ca668dad0c5
Diffstat (limited to 'resources/libraries/python/PerfUtil.py')
-rw-r--r--resources/libraries/python/PerfUtil.py22
1 files changed, 15 insertions, 7 deletions
diff --git a/resources/libraries/python/PerfUtil.py b/resources/libraries/python/PerfUtil.py
index 51832dee48..4c286b455e 100644
--- a/resources/libraries/python/PerfUtil.py
+++ b/resources/libraries/python/PerfUtil.py
@@ -35,13 +35,21 @@ class PerfUtil:
:type duration: int
"""
cpu = cpu_list if cpu_list else u"0-$(($(nproc) - 1))"
- command = (
- u"perf stat"
- f" --cpu {cpu} --no-aggr"
- f" --event '{{{Constants.PERF_STAT_EVENTS}}}'"
- f" --interval-print 1000 "
- f" -- sleep {int(duration)}"
- )
+ if Constants.PERF_STAT_EVENTS:
+ command = (
+ u"perf stat"
+ f" --cpu {cpu} --no-aggr"
+ f" --event '{{{Constants.PERF_STAT_EVENTS}}}'"
+ f" --interval-print 1000 "
+ f" -- sleep {int(duration)}"
+ )
+ else:
+ command = (
+ u"perf stat"
+ f" --cpu {cpu} --no-aggr"
+ f" --interval-print 1000 "
+ f" -- sleep {int(duration)}"
+ )
exec_cmd(node, command, sudo=True)
@staticmethod