Skip to content

Commit 4feb3e6

Browse files
committed
Read disposable performance from JSON
For: QubesOS/qubes-issues#1512
1 parent 4392e8a commit 4feb3e6

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

extra-files/system-tests/dom0.sls

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ dom0-packages:
1818
- btrfs-progs
1919
- python3-nose2
2020
- python3-objgraph
21+
- python3-deepmerge
2122
- patch
2223
- qubes-video-companion-dom0
2324
- split-gpg2-dom0

utils/lib/openqa_api.py

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -341,15 +341,24 @@ def get_performance_data(self):
341341

342342

343343
if 'dispvm_perf' in json_data['job']['name']:
344-
for line in perf_data.split("\n"):
345-
if not line:
346-
continue
347-
data = line.split(" ")
348-
name = data[0]
349-
value = data[1]
350-
data_dict = dict(item.split("=", maxsplit=1) for item in data[2:])
351-
key = name + "(avg:" + data_dict["average"] + ")"
352-
result[key] = float(value)
344+
try:
345+
data = json.loads(perf_data)
346+
for key, value in data.items():
347+
name = value["name"]
348+
mean = value["mean"]
349+
total = value["total"]
350+
key += "(mean:" + str(mean) + ")"
351+
result[key] = float(total)
352+
except json.decoder.JSONDecodeError:
353+
for line in perf_data.split("\n"):
354+
if not line:
355+
continue
356+
data = line.split(" ")
357+
name = data[0]
358+
total = data[1]
359+
data_dict = dict(v.split("=", maxsplit=1) for v in data[2:])
360+
key = name + "(mean:" + data_dict["average"] + ")"
361+
result[key] = float(total)
353362
return result
354363

355364
if 'qrexec_perf' in json_data['job']['name']:

0 commit comments

Comments
 (0)