X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=tests%2Frun-report.py;fp=tests%2Frun-report.py;h=5e8a0cfabe554521053d07fbdfc54ca428baa808;hb=1db84787a06a9dcea6ebad95ebefc4e449507ea6;hp=2e897475a15b854dd9dde8b31228565869f47cf0;hpb=4ed5c01eca0a952825962abfc405ba01bba9b52c;p=lttng-tools.git diff --git a/tests/run-report.py b/tests/run-report.py index 2e897475a..5e8a0cfab 100755 --- a/tests/run-report.py +++ b/tests/run-report.py @@ -46,10 +46,12 @@ def cpu_create_usage_dict(top_line): top_line = top_line.replace(",","") words = top_line.split()[1:] - for word in words: - index = word.find('%') + + for key in top_dict: + index = words.index(key) # Add the value to the dictionnary - top_dict[word[index + 1:]] = float(word[:index]) + val = words[index-1] + top_dict[key] = float(val) return top_dict @@ -87,7 +89,7 @@ def cpu_sample_usage(pid=None): # Spawn top process top = subprocess.Popen(args, stdout = subprocess.PIPE) - grep = subprocess.Popen(["grep", "^Cpu"], stdin = top.stdout, + grep = subprocess.Popen(["grep", "Cpu"], stdin = top.stdout, stdout = subprocess.PIPE) top.stdout.close()