X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=resources%2Flibraries%2Fpython%2FPerfUtil.py;h=4c286b455eaa3034e1ce76b6f83c141e90679013;hb=273d2ea03c4fa35ea5b656872f06f6e6d2e6f851;hp=51832dee4823be776de263fc0d5384a078ee60d8;hpb=a40195bdda6ec06af8479cfe7d3b3e11d4c9778f;p=csit.git 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