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