[PATCH] D114770: [LNT] Combine perf data metrics from several files
Pavel Kosov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 29 22:23:27 PST 2021
kpdev42 created this revision.
kpdev42 added reviewers: cmatthews, thopre, danilaml.
kpdev42 added a project: LLVM.
Herald added a subscriber: dkolesnichenko.
kpdev42 requested review of this revision.
Metrics are recorded to files test.perf_data, test.perf_data1, …
Parse all these files into a single dictionary.
OS Laboratory. Huawei Russian Research Institute. Saint-Petersburg
Repository:
rLNT LNT
https://reviews.llvm.org/D114770
Files:
lnt/testing/profile/perf.py
Index: lnt/testing/profile/perf.py
===================================================================
--- lnt/testing/profile/perf.py
+++ lnt/testing/profile/perf.py
@@ -5,6 +5,7 @@
import os
import traceback
+import glob
try:
from . import cPerf # type: ignore # mypy cannot process Cython modules
@@ -12,6 +13,18 @@
pass
+def mergeRecursively(dct1, dct2):
+ for k, v in dct2.items():
+ if k in dct1:
+ if isinstance(dct1[k], dict) and isinstance(v, dict):
+ mergeRecursively(dct1[k], v)
+ elif isinstance(dct1[k], list) and isinstance(v, list):
+ dct1[k].extend(v)
+ else:
+ assert False
+ else:
+ dct1[k] = v
+
class LinuxPerfProfile(ProfileImpl):
def __init__(self):
pass
@@ -31,7 +44,10 @@
return None
try:
- data = cPerf.importPerf(f, objdump, binaryCacheRoot)
+ data = {}
+ for fname in glob.glob("%s*" % f):
+ cur_data = cPerf.importPerf(fname, objdump, binaryCacheRoot)
+ mergeRecursively(data, cur_data)
# Go through the data and convert counter values to percentages.
for f in data['functions'].values():
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114770.390571.patch
Type: text/x-patch
Size: 1276 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211130/6a984b8a/attachment.bin>
More information about the llvm-commits
mailing list