[PATCH] D114770: [LNT] Combine perf data metrics from several files
Pavel Kosov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 2 15:26:25 PST 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rLNT3f6e19818b68: [LNT] Combine perf data metrics from several files (authored by kpdev42).
Repository:
rLNT LNT
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D114770/new/
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,25 @@
pass
+def merge_recursively(dct1, dct2):
+ # type: (dict, dict) -> None
+ """Add the content of dct2 to dct1.
+ :param dct1: merge to.
+ :param dct2: merge from.
+ """
+ for k, v in dct2.items():
+ if k in dct1:
+ if isinstance(dct1[k], dict) and isinstance(v, dict):
+ merge_recursively(dct1[k], v)
+ elif isinstance(dct1[k], list) and isinstance(v, list):
+ dct1[k].extend(v)
+ else:
+ raise TypeError("Values for the key {} must be the same type (dict or list), "
+ "but got {} and {}".format(k, type(dct1[k]), type(v)))
+ else:
+ dct1[k] = v
+
+
class LinuxPerfProfile(ProfileImpl):
def __init__(self):
pass
@@ -31,7 +51,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)
+ merge_recursively(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.412562.patch
Type: text/x-patch
Size: 1577 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220302/6ae947f5/attachment.bin>
More information about the llvm-commits
mailing list