resulttool: add 'durations' subcommand and selftests
cover resulttool: add 'durations' subcommand and selftests
This series is motivated by the need to compare durations for various test results (originally, ptest) as reported by the Autobuilder. In particular, I've been looking at the intermittent ptest issues seen on the AB for the qemuriscv64-ptest builders, but we needed a good way to compare per-package durations before and after commit 6d6aaf4204be ("qemu: backport RISC-V TLB page flushing patches"). I tested this change locally with coreutils (which showed roughly 38% improvement on my workstation) and other tests (e.g. libpng, which showed no meaningful change), and review on the upstream QEMU list confirmed it helped with boot and runtime performance for qemuriscv64.
This resulttool durations feature provides a means to quantify changes in duration across more packages at a scale beyond what my machines can handle, and might be useful to compare before and after other changes (e.g. toolchain tests) over time. I've also added a variety of test cases for oeqa selftests, covering everything from basic results parsing to making sure the tool respects thresholds. Each of those tests is added as a separate commit to make review easier.
I used Claude Code to help build this out. Design took some refinement, especially with:
- Comparing delta results for very short tests (i.e. those running for 5-10 seconds or less) were mostly noise, especially when fractional runtimes were calculated under the hood and ended up reporting "0" for both runtimes but large (68%, 350%, etc.) deltas. I don't think we have much use for tracking differences in such short tests, but I did provide a '-m/--min-duration' to tweak this (defaulting to 10) if we want to be able to look at those.
- Durations can vary small amounts (5-10 seconds) across consecutive tests even under little or no load, and higher when the host system is under heavy load (like the AB workers), so a '-t/--threshold' option is available to filter out any tests whose deltas are under a certain percentage. I didn't set a default here, but 10% is probably a reasonable one for people to use.
- A sort option '-s/--sort-by-delta' was an obvious add so that it can be used to check what the biggest changes are from run to run.
- Importantly, resulttool durations can compare more than two sources. This will be critical for tracking how results trend over time, but reporting deltas in this case seemed more debatable. For now I've left it at only reporting deltas between consecutive runs (so RUN1->RUN2 and RUN2->RUN3, but not RUN1->RUN3). If we need the overall delta then that should be an easy follow-up.
This has already been useful/promising for inspecting the AB experience with qemuriscv64-ptest since the aforementioned QEMU patch backport. For example, I ran the following yesterday to get the top 25 largest deltas for qemuriscv64-ptest:
1. resulttool report https://valkyrie.yocto.io/pub/non-release/20260922-113/testresults/qemuriscv64-ptest/testresults.json > 113.log
2. resulttool report https://valkyrie.yocto.io/pub/non-release/20260922-114/testresults/qemuriscv64-ptest/testresults.json > 114.log
3. resulttool durations -s -l 25 114.log 113.log
And here's what it showed:
|diffstat 96 34 -62 -65 |xz 14 5 -9 -64 |diffutils 44 16 -28 -64 |quilt 836 307 -529 -63 |busybox 94 35 -59 -63 |coreutils 2997 1166 -1831 -61 |dpkg 647 256 -391 -60 |gettext 1910 762 -1148 -60 |findutils 110 44 -66 -60 |m4 680 281 -399 -59 |util-linux 1522 643 -879 -58 |gawk 171 74 -97 -57 |elfutils 459 213 -246 -54 |bluez5 115 54 -61 -53 |libssh2 94 48 -46 -49 |logrotate 186 95 -91 -49 |sed 142 73 -69 -49 |opkg 199 113 -86 -43 |openssh 2846 1662 -1184 -42 |gdbm 27 17 -10 -37 |bzip2 300 409 109 36 |parted 473 311 -162 -34 |wayland 12 8 -4 -33
Interestingly, bzip2's runtime actually increased (a lot!). A proper analysis would require averaging the results over several runs, but there seems to be a trend with some compression and encryption packages that I'll be looking into. In the meantime, hopefully this feature for resulttools will prove useful to others too, even if they'd like to see further improvements. Note that I've tested it for non-ptest cases, and it works there too.
Using the following command and results:
- resulttool durations -s -t 10
- https://valkyrie.yocto.io/pub/non-release/20260923-8/testresults/qemux86-64/testresults.json
- https://valkyrie.yocto.io/pub/non-release/20260923-50/testresults/qemux86-64/testresults.json
I see:
|=== runtime/poky/qemux86-64/core-image-sato-sdk === |TESTCASE RUN1 RUN2 RUN1->RUN2 % |stap.StapTest.test_stap 7 13 5 73 |kernelmodule.KernelModuleTest.test_kernel_module 22 30 8 36 |buildcpio.BuildCpioTest.test_cpio 28 31 3 10 | |=== sdk/qemux86-64/i686/core-image-sato === |TESTCASE RUN1 RUN2 RUN1->RUN2 % |cmake.CMakeTest.test_assimp 71 83 12 17 | |=== sdk/qemux86-64/x86_64/core-image-sato === |TESTCASE RUN1 RUN2 RUN1->RUN2 % |rust.RustHostCompileTest.test_cargo_build 13 18 4 33 |cmake.CMakeTest.test_assimp 71 92 22 31 |autotools.AutotoolsTest.test_cpio 24 27 3 11 | |=== sdkext/qemux86-64/x86_64/core-image-minimal === |TESTCASE RUN1 RUN2 RUN1->RUN2 % |maturin.MaturinTest.test_maturin_list_python 4 21 18 459 |devtool.DevtoolTest.test_devtool_build_esdk_package 28 132 104 372 |python.Python3Test.test_python3 5 22 17 335 |devtool.DevtoolTest.test_extend_autotools_recipe_creation 82 319 238 291 |devtool.DevtoolTest.test_recipes_for_nodejs 15 25 9 61 |devtool.DevtoolTest.test_devtool_kernelmodule 433 580 147 34 |cmake.CMakeTest.test_assimp 75 95 21 27 |devtool.DevtoolTest.test_devtool_add_reset 12 15 3 26 |devtool.DevtoolTest.test_devtool_build_cmake 29 36 7 23 | |=== sdkext/qemux86-64/x86_64/core-image-sato === |TESTCASE RUN1 RUN2 RUN1->RUN2 % |devtool.DevtoolTest.test_devtool_build_cmake 30 236 206 686 |maturin.MaturinTest.test_maturin_list_python 4 22 18 469 |python.Python3Test.test_python3 5 22 17 377 |devtool.DevtoolTest.test_devtool_kernelmodule 429 1394 965 225 |devtool.DevtoolTest.test_devtool_add_reset 13 18 5 39 |maturin.MaturinDevelopTest.test_maturin_develop 24 32 9 36 |cmake.CMakeTest.test_assimp 73 97 24 33 |devtool.DevtoolTest.test_extend_autotools_recipe_creation 81 105 24 30 |devtool.DevtoolTest.test_recipes_for_nodejs 15 19 4 24 |devtool.DevtoolTest.test_devtool_build_make 33 39 6 17 |autotools.AutotoolsTest.test_cpio 24 27 3 11
Some other examples of use:
First five results when comparing two reports from 'resulttool report':
|tgamblin@megalith ~/workspace/ypbuilds/poky-qemuriscv64/build $ resulttool durations -l 5 tlb_before.log tlb_tweak.log | |=== qemuriscv64 PTest Result Summary (Libc: glibc) === |TESTCASE RUN1 RUN2 RUN1->RUN2 % |apr 50 48 -2 -4 |apr-util 13 11 -2 -15 |babeltrace2 1302 1042 -260 -20 |bc 82 82 0 0 |bluez5 115 71 -44 -38
First five results from the same reports when sorted by highest change:
|tgamblin@megalith ~/workspace/ypbuilds/poky-qemuriscv64/build $ resulttool durations -l 5 -s tlb_before.log tlb_tweak.log | |=== qemuriscv64 PTest Result Summary (Libc: glibc) === |TESTCASE RUN1 RUN2 RUN1->RUN2 % |libseccomp 3833 1686 -2147 -56 |quilt 836 438 -398 -48 |findutils 110 58 -52 -47 |diffstat 96 52 -44 -46 |diffutils 44 24 -20 -45
Raw (and truncated) testresults.json comparison for two sources from the Autobuilder:
|tgamblin@megalith ~/workspace/ypbuilds/poky-qemuriscv64/layers/openembedded-core ((no branch, rebasing master))$ resulttool durations https://valkyrie.yocto.io/pub/non-release/20260923-79/testresults/qemuriscv64-ptest/testresults.json https://valkyrie.yocto.io/pub/non-release/20260923-78/testresults/qemuriscv64-ptest/testresults.json | |=== runtime/poky/qemuriscv64/core-image-ptest-apr === |TESTCASE RUN1 RUN2 RUN1->RUN2 % |ptest.PtestRunnerTest.test_ptestrunner_expectfail 48 48 0 1 |ptestresult.sections.apr 46 47 1 2 | |=== runtime/poky/qemuriscv64/core-image-ptest-apr-util === |TESTCASE RUN1 RUN2 RUN1->RUN2 % |ptest.PtestRunnerTest.test_ptestrunner_expectfail 12 13 1 9 |ptestresult.sections.apr-util 11 11 0 0 | |=== runtime/poky/qemuriscv64/core-image-ptest-babeltrace2 === |TESTCASE RUN1 RUN2 RUN1->RUN2 % |ptest.PtestRunnerTest.test_ptestrunner_expectfail 981 1066 85 9 |ptestresult.sections.babeltrace2 973 1058 85 9
The same results with '-l 1' (one line max):
|tgamblin@megalith ~/workspace/ypbuilds/poky-qemuriscv64/layers/openembedded-core ((no branch, rebasing master))$ resulttool durations -l 1 https://valkyrie.yocto.io/pub/non-release/20260923-79/testresults/qemuriscv64-ptest/testresults.json https://valkyrie.yocto.io/pub/non-release/20260923-78/testresults/qemuriscv64-ptest/testresults.json | |=== runtime/poky/qemuriscv64/core-image-ptest-apr === |TESTCASE RUN1 RUN2 RUN1->RUN2 % |ptest.PtestRunnerTest.test_ptestrunner_expectfail 48 48 0 1 | |=== runtime/poky/qemuriscv64/core-image-ptest-apr-util === |TESTCASE RUN1 RUN2 RUN1->RUN2 % |ptest.PtestRunnerTest.test_ptestrunner_expectfail 12 13 1 9 | |=== runtime/poky/qemuriscv64/core-image-ptest-babeltrace2 === |TESTCASE RUN1 RUN2 RUN1->RUN2 % |ptest.PtestRunnerTest.test_ptestrunner_expectfail 981 1066 85 9
Trevor Gamblin (13):
scripts: resulttool: add 'durations' option
selftest: resulttooltests.py: add basic durations test
selftest: resulttooltests.py: add report-log Time(s) column test
selftest: resulttooltests.py: add zero-round pct suppression test
selftest: resulttooltests.py: add consecutive-pair delta test
selftest: resulttooltests.py: add threshold filtering test
selftest: resulttooltests.py: add threshold-disabled test
selftest: resulttooltests.py: add multi-pair threshold test
selftest: resulttooltests.py: add None-pct threshold test
selftest: resulttooltests.py: add sort-by-delta test
selftest: resulttooltests.py: add limit-after-sort test
selftest: resulttooltests.py: add short-tables ordering test
selftest: resulttooltests.py: add min-duration default test
.../oeqa/selftest/cases/resulttooltests.py | 201 ++++++++++++++++++ scripts/lib/resulttool/durations.py | 187 ++++++++++++++++ scripts/resulttool | 2 + 3 files changed, 390 insertions(+) create mode 100644 scripts/lib/resulttool/durations.py
Signature · 1 line
2.55.0
PATCH 1/13 scripts: resulttool: add 'durations' option
Extend resulttool with the ability to compare two or more sets of testresults for significant changes in runtime duration. The idea is to allow tracking of performance deltas in ptest/toolchain/etc. test suites over time, especially when upgrades or patches alter configurations for underlying tools/infrastructure (QEMU, meson, autotools, architecture tunings, and so on). This feature works with raw testresults.json files as reported by the Autobuilder and reports generated with 'resulttool report <source>', although the behaviour is different:
- For raw testresults.json files, it reports every target and applies the options to the test cases run against them.
- For report files it summarizes the overall runtimes (see the examples below).
Note that it is not designed to make any judgments about the usefulness of a given comparison - it only reports the differences between sources provided.
Options for the 'durations' command include:
- '--labels' to customize the column labels (defaults: 'RUN1', 'RUN2', 'RUN1->RUN2', etc.)
- '--sort-by-delta/-s' to list the largest differences first
- '--threshold/-t' for omitting test results without a percent delta meeting this value
- '--limit' to specify how a maximum number of rows (0 = no limit)
- '--min-duration' to omit tests where durations in all sources were less than the specified value (default: 10, 0 = disable)
- '--show-short' to print tests below --min-duration threshold in a follow-up table
AI-Generated: Uses Claude Sonnet 5
--- scripts/lib/resulttool/durations.py | 187 ++++++++++++++++++++++++++++ scripts/resulttool | 2 + 2 files changed, 189 insertions(+) create mode 100644 scripts/lib/resulttool/durations.py
scripts/lib/resulttool/durations.py new file +187 -0
@@ -0,0 +1,187 @@ +# resulttool - compare test durations between two or more runs +# +# SPDX-License-Identifier: GPL-2.0-only +# + +import os +import re +import resulttool.resultutils as resultutils + +# Matches the section titles "resulttool report" prints before each +# Recipe/Passed/Failed/Skipped/Time(s) table (see template/test_report_full_text.txt) +REPORT_SECTION_RE = re.compile( + r'^\S+ (?:PTest Result Summary \(Libc: [^)]+\)|Ltp Test Result Summary|Ltp Posix Result Summary)$') +REPORT_ROW_RE = re.compile( + r'^(?P<name>\S.*?)\s*\|\s*\d+\s*\|\s*\d+\s*\|\s*\d+\s*\|\s*(?P<duration>\d+(?:\.\d+)?)\s*T?\s*$') + +def parse_report_log(path): + """Parse the Recipe/Time(s) tables out of a 'resulttool report' text log""" + durations = {} + section = None + with open(path) as f: + for line in f: + line = line.rstrip('\n') + if REPORT_SECTION_RE.match(line.strip()): + section = line.strip() + continue + if not section: + continue + m = REPORT_ROW_RE.match(line) + if m: + durations.setdefault(section, {})[m.group('name').strip()] = float(m.group('duration')) + return durations + +def load_durations(source): + if os.path.isfile(source): + with open(source, errors='ignore') as f: + head = f.read(512).lstrip() + if not head.startswith('{'): + return parse_report_log(source) + return get_durations(resultutils.load_resultsdata(source, configmap=resultutils.store_map)) + +def get_durations(results): + """Flatten a loaded results dict into {testpath: {test_key: duration}}""" + durations = {} + for path, _, _, result in resultutils.test_run_results(results): + d = durations.setdefault(path, {}) + for k, v in result.items(): + if not isinstance(v, dict): + continue + if k.endswith(".sections"): + # ptestresult.sections/ltpresult.sections/ltpposixresult.sections: + # duration is per suite, not per testcase + for suite, info in v.items(): + dur = info.get('duration') if isinstance(info, dict) else None + if dur is None: + continue + if isinstance(dur, str): + dur = dur.split()[0] + try: + d['%s.%s' % (k, suite)] = float(dur) + except ValueError: + continue + elif 'duration' in v: + d[k] = float(v['duration']) + return durations + +def build_rows(testkeys, path, alldurations): + rows = [] + for k in testkeys: + vals = [d[path][k] for d in alldurations] + # one delta/pct per consecutive pair: (run1,run2), (run2,run3), ... + deltas = [] + for base, target in zip(vals, vals[1:]): + delta = target - base + # a percentage between two runs that both round to 0s is meaningless noise + if round(base) == 0 and round(target) == 0: + pct = None + else: + pct = (delta / base * 100) if base else 0.0 + deltas.append((delta, pct)) + rows.append((k, vals, deltas)) + return rows + +def filter_sort_rows(rows, args): + """Apply --threshold/--sort-by-delta/--limit to a table's rows""" + if args.threshold: + rows = [r for r in rows if any(pct is not None and abs(pct) >= args.threshold for _, pct in r[2])] + + sortkey = (lambda r: max((abs(pct) for _, pct in r[2] if pct is not None), default=0)) if args.sort_by_delta else (lambda r: r[0]) + rows = sorted(rows, key=sortkey, reverse=args.sort_by_delta) + if args.limit: + rows = rows[:args.limit] + return rows + +def print_table(title, rows, labels): + if not rows: + return + + width = max(len("TESTCASE"), min(70, max(len(r[0]) for r in rows))) + 2 + pair_labels = ["%s->%s" % pair for pair in zip(labels, labels[1:])] + pair_widths = [max(12, len(pl)) for pl in pair_labels] + + print("\n=== %s ===" % title) + print("%-*s%s %s" % (width, "TESTCASE", "".join("%12s" % l for l in labels), + " ".join("%*s%9s" % (pw, pl, "%") for pw, pl in zip(pair_widths, pair_labels)))) + for k, vals, deltas in rows: + # round() avoids -0.0 rendering as "-0" for small fractional deltas + pairstrs = ["%*d%9s" % (pw, round(delta), round(pct) if pct is not None else "") + for pw, (delta, pct) in zip(pair_widths, deltas)] + print("%-*s%s %s" % (width, k[:70], "".join("%12.0f" % v for v in vals), " ".join(pairstrs))) + +def build_tables(args, logger): + """ + Compute every (title, rows) table 'durations' prints, already filtered/sorted/limited, + in the order they should be printed: all normal tables first, then (if --show-short) + one short-tests table per test configuration. + Returns (labels, tables), or None if args were invalid. + """ + if len(args.sources) < 2: + logger.error("At least two sources are needed to compare durations") + return None + + labels = args.labels.split(',') if args.labels else ['RUN%d' % (i + 1) for i in range(len(args.sources))] + if len(labels) != len(args.sources): + logger.error("Number of --labels must match number of sources") + return None + + alldurations = [load_durations(s) for s in args.sources] + + testpaths = set.intersection(*(set(d) for d in alldurations)) + if not testpaths: + return labels, [] + + tables = [] + short_tables = [] + for path in sorted(testpaths): + testkeys = set.intersection(*(set(d[path]) for d in alldurations)) + rows = build_rows(testkeys, path, alldurations) + + long_rows = [r for r in rows if max(r[1]) >= args.min_duration] + short_rows = [r for r in rows if max(r[1]) < args.min_duration] + + tables.append((path, filter_sort_rows(long_rows, args))) + if args.show_short: + short_tables.append(("%s (under %gs, all sources)" % (path, args.min_duration), + filter_sort_rows(short_rows, args))) + + return labels, tables + short_tables + +def durations(args, logger): + result = build_tables(args, logger) + if result is None: + return 1 + labels, tables = result + if not tables: + print("No common test configurations found between the provided sources") + return 1 + + for title, rows in tables: + print_table(title, rows, labels) + return 0 + +def register_commands(subparsers): + """Register subcommands from this plugin""" + parser_build = subparsers.add_parser('durations', help='compare test durations across two or more runs', + description='compare oeqa/ptest test and suite durations across two or ' + 'more result sets, highlighting the biggest changes', + group='analysis') + parser_build.set_defaults(func=durations) + parser_build.add_argument('sources', nargs='+', + help='two or more sources to compare, in the order given: each is either a ' + 'testresults.json file/directory/URL, or a text log produced by ' + '"resulttool report"') + parser_build.add_argument('--labels', default='', + help='comma separated labels for each source (default: RUN1, RUN2, ...)') + parser_build.add_argument('-s', '--sort-by-delta', action='store_true', + help='sort by largest absolute change first (default: sorted by test name)') + parser_build.add_argument('-t', '--threshold', type=float, default=0.0, + help='only show tests where at least one consecutive pair of sources changed ' + 'by at least this percentage') + parser_build.add_argument('-l', '--limit', type=int, default=0, + help='limit output to this many rows per test configuration (0 = no limit)') + parser_build.add_argument('-m', '--min-duration', type=float, default=10.0, + help='omit tests whose duration was under this many seconds in every source ' + '(default: 10, use 0 to disable)') + parser_build.add_argument('--show-short', action='store_true', + help='also print tests below --min-duration, in a separate table')
scripts/resulttool +2 -0
@@ -44,6 +44,7 @@ import resulttool.merge import resulttool.store import resulttool.regression import resulttool.report +import resulttool.durations import resulttool.manualexecution import resulttool.log import resulttool.junit
@@ -64,6 +65,7 @@ def main(): subparsers.add_subparser_group('analysis', 'analysis', 100) resulttool.regression.register_commands(subparsers) resulttool.report.register_commands(subparsers) + resulttool.durations.register_commands(subparsers) resulttool.log.register_commands(subparsers) resulttool.junit.register_commands(subparsers)
Signature · 1 line
2.55.0
Re: [OE-core][PATCH 01/13] scripts: resulttool: add 'durations' option
scripts/lib/resulttool/durations.py line 15
Quoted 6 lines · Trevor Gamblin via lists.openembedded.org
scripts/lib/resulttool/durations.py new file +6
-0+# Matches the section titles "resulttool report" prints before each +# Recipe/Passed/Failed/Skipped/Time(s) table (see template/test_report_full_text.txt) +REPORT_SECTION_RE = re.compile( + r'^\S+ (?:PTest Result Summary \(Libc: [^)]+\)|Ltp Test Result Summary|Ltp Posix Result Summary)$') +REPORT_ROW_RE = re.compile( + r'^(?P<name>\S.*?)\s*\|\s*\d+\s*\|\s*\d+\s*\|\s*\d+\s*\|\s*(?P<duration>\d+(?:\.\d+)?)\s*T?\s*$')
Is there a use case for when you have resulttool, a textual summary, but not the JSON test data? I’m wondering if this functionality is useful enough to justify having a fragile regex-based parser on a file that we don’t commit to maintaining the format of.
Ross
Re: [OE-core][PATCH 01/13] scripts: resulttool: add 'durations' option
Quoted 12 lines · Ross Burton via lists.openembedded.org
scripts/lib/resulttool/durations.py line 15
Quoted 6 lines · Trevor Gamblin via lists.openembedded.org
scripts/lib/resulttool/durations.py new file +6
-0+# Matches the section titles "resulttool report" prints before each +# Recipe/Passed/Failed/Skipped/Time(s) table (see template/test_report_full_text.txt) +REPORT_SECTION_RE = re.compile( + r'^\S+ (?:PTest Result Summary \(Libc: [^)]+\)|Ltp Test Result Summary|Ltp Posix Result Summary)$') +REPORT_ROW_RE = re.compile( + r'^(?P<name>\S.*?)\s*\|\s*\d+\s*\|\s*\d+\s*\|\s*\d+\s*\|\s*(?P<duration>\d+(?:\.\d+)?)\s*T?\s*$')Is there a use case for when you have resulttool, a textual summary, but not the JSON test data? I’m wondering if this functionality is useful enough to justify having a fragile regex-based parser on a file that we don’t commit to maintaining the format of.
I'd add that the test cases for this are fragile. They hardcode the current report output whilst we really want to ensure that the current report output would work properly.
I do think having some duration support in resulttool would be nice but I suspect we don't need the report parsing piece. Most cases where you have the report you would have or can get the json results.
Cheers,
Richard
Re: [OE-core][PATCH 01/13] scripts: resulttool: add 'durations' option
Quoted 14 lines · Richard Purdie
Quoted 12 lines · Ross Burton via lists.openembedded.org
scripts/lib/resulttool/durations.py line 15
Quoted 6 lines · Trevor Gamblin via lists.openembedded.org
scripts/lib/resulttool/durations.py new file +6
-0+# Matches the section titles "resulttool report" prints before each +# Recipe/Passed/Failed/Skipped/Time(s) table (see template/test_report_full_text.txt) +REPORT_SECTION_RE = re.compile( + r'^\S+ (?:PTest Result Summary \(Libc: [^)]+\)|Ltp Test Result Summary|Ltp Posix Result Summary)$') +REPORT_ROW_RE = re.compile( + r'^(?P<name>\S.*?)\s*\|\s*\d+\s*\|\s*\d+\s*\|\s*\d+\s*\|\s*(?P<duration>\d+(?:\.\d+)?)\s*T?\s*$')Is there a use case for when you have resulttool, a textual summary, but not the JSON test data? I’m wondering if this functionality is useful enough to justify having a fragile regex-based parser on a file that we don’t commit to maintaining the format of.
Quoted 7 lines
I'd add that the test cases for this are fragile. They hardcode the current report output whilst we really want to ensure that the current report output would work properly.
I do think having some duration support in resulttool would be nice but I suspect we don't need the report parsing piece. Most cases where you have the report you would have or can get the json results.
Thanks for the feedback folks. Let's ignore this series for now and I'll look at a more concise submission sometime soon. My original motivation was to track AB test durations, which are now handled more automatically by
https://threexc.github.io/yocto-test-durations/, so I think whatever I do add for this to resulttool should be more minimal than this series is.
Trevor
Quoted 4 lines
Cheers,
Richard
PATCH 2/13 selftest: resulttooltests.py: add basic durations test
In reply to Trevor GamblinAdd imports for the resulttools durations.py module, then add a basic test for checking that testcase names and durations are properly extracted.
AI-Generated: Uses Claude Sonnet 5
--- .../oeqa/selftest/cases/resulttooltests.py | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+)
meta/lib/oeqa/selftest/cases/resulttooltests.py +28 -0
@@ -11,6 +11,7 @@ lib_path = basepath + '/scripts/lib' sys.path = sys.path + [lib_path] from resulttool.report import ResultsTextReport from resulttool import regression as regression +from resulttool import durations as durations from resulttool import resultutils as resultutils from oeqa.selftest.case import OESelftestTestCase
@@ -18,6 +19,8 @@ from resulttool.junit import junit_tree, PtestSummary import xml.etree.ElementTree as ET import logging import json +import tempfile +from types import SimpleNamespace class ResultToolTests(OESelftestTestCase):
@@ -669,3 +672,28 @@ class ResultToolTests(OESelftestTestCase): # Package testsuite should not exist (no ptestresult.sections) package_suite = testsuites_node.find(".//testsuite[@name='Package Tests']") self.assertIsNone(package_suite) + + def test_durations_get_durations_extracts_testcase_and_suite_durations(self): + results_data = {'result1': {'configuration': {"TEST_TYPE": "runtime", + "TESTSERIES": "series1", + "IMAGE_BASENAME": "image", + "IMAGE_PKGTYPE": "ipk", + "DISTRO": "mydistro", + "MACHINE": "qemux86"}, + 'result': { + 'test.Foo.test_bar': {'status': 'PASSED', 'duration': 12.345}, + 'test.Foo.test_no_duration': {'status': 'PASSED'}, + 'ptestresult.sections': { + 'bash': {'duration': '5', 'log': 'xxx'}, + # a timed-out suite has " T" appended to its duration + 'timedout': {'duration': '30 T'}, + }, + }}} + results = {} + resultutils.append_resultsdata(results, results_data) + flattened = durations.get_durations(results) + path = 'runtime/mydistro/qemux86/image' + self.assertEqual(flattened[path]['test.Foo.test_bar'], 12.345) + self.assertNotIn('test.Foo.test_no_duration', flattened[path]) + self.assertEqual(flattened[path]['ptestresult.sections.bash'], 5.0) + self.assertEqual(flattened[path]['ptestresult.sections.timedout'], 30.0)
Signature · 1 line
2.55.0
PATCH 3/13 selftest: resulttooltests.py: add report-log Time(s) column test
In reply to Trevor GamblinAdd a test for resulttool.durations.parse_report_log(), covering correct Time(s) column extraction from a 'resulttool report' text log, and confirming the unrelated percentage-based status summary table above it is not mistaken for a Time(s) table.
AI-Generated: Uses Claude Sonnet 5
--- .../oeqa/selftest/cases/resulttooltests.py | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+)
meta/lib/oeqa/selftest/cases/resulttooltests.py +33 -0
@@ -697,3 +697,36 @@ class ResultToolTests(OESelftestTestCase): self.assertNotIn('test.Foo.test_no_duration', flattened[path]) self.assertEqual(flattened[path]['ptestresult.sections.bash'], 5.0) self.assertEqual(flattened[path]['ptestresult.sections.timedout'], 30.0) + + def test_durations_parse_report_log_extracts_time_column(self): + content = ( + "==============================================================================================================\n" + "Test Result Status Summary (Counts/Percentages sorted by testseries, ID)\n" + "==============================================================================================================\n" + "qemux86 | someresultid | 6 (86%) | 0 (0%) | 1 (14%)\n" + "\n" + "==============================================================================================================\n" + "qemux86 PTest Result Summary (Libc: glibc)\n" + "==============================================================================================================\n" + "--------------------------------------------------------------------------------------------------------------\n" + "Recipe | Passed | Failed | Skipped | Time(s) \n" + "--------------------------------------------------------------------------------------------------------------\n" + "acl | 1 | 0 | 0 | 1\n" + "bash | 43 | 0 | 0 | 48\n" + "timedout-suite | 1 | 0 | 0 | 30 T\n" + "--------------------------------------------------------------------------------------------------------------\n" + ) + with tempfile.NamedTemporaryFile(mode='w', suffix='.log', delete=False) as f: + f.write(content) + logpath = f.name + try: + parsed = durations.parse_report_log(logpath) + finally: + os.remove(logpath) + section = 'qemux86 PTest Result Summary (Libc: glibc)' + self.assertIn(section, parsed) + self.assertEqual(parsed[section]['acl'], 1.0) + self.assertEqual(parsed[section]['bash'], 48.0) + self.assertEqual(parsed[section]['timedout-suite'], 30.0) + # the status-summary table above (percentages, not a Time(s) table) must not be picked up + self.assertNotIn('someresultid', str(parsed))
Signature · 1 line
2.55.0
PATCH 4/13 selftest: resulttooltests.py: add zero-round pct suppression test
In reply to Trevor GamblinAdd a test for resulttool.durations.build_rows(), covering suppression of delta/percentage reporting when durations round to zero. Times are reported in seconds and fractional times can be calculated, so we don't want to show (for example) RUN1 = RUN2 = 0 but a large delta because one run was many fractions of a second faster.
AI-Generated: Uses Claude Sonnet 5
--- meta/lib/oeqa/selftest/cases/resulttooltests.py | 12 ++++++++++++ 1 file changed, 12 insertions(+)
meta/lib/oeqa/selftest/cases/resulttooltests.py +12 -0
@@ -730,3 +730,15 @@ class ResultToolTests(OESelftestTestCase): self.assertEqual(parsed[section]['timedout-suite'], 30.0) # the status-summary table above (percentages, not a Time(s) table) must not be picked up self.assertNotIn('someresultid', str(parsed)) + + def test_durations_build_rows_suppresses_pct_when_both_runs_round_to_zero(self): + alldurations = [ + {'path': {'tiny': 0.2, 'big': 100.0}}, + {'path': {'tiny': 0.4, 'big': 150.0}}, + ] + rows = durations.build_rows(['tiny', 'big'], 'path', alldurations) + rowmap = {k: deltas for k, vals, deltas in rows} + # both runs round to 0s: no meaningful percentage to report + self.assertEqual(rowmap['tiny'], [(0.2, None)]) + # normal case: delta and percentage both reported + self.assertEqual(rowmap['big'], [(50.0, 50.0)])
Signature · 1 line
2.55.0
PATCH 5/13 selftest: resulttooltests.py: add consecutive-pair delta test
In reply to Trevor GamblinAdd a test for resulttool.durations.build_rows(), covering that comparisons are only generated for consecutive sources (e.g. RUN1->RUN2, RUN2->RUN3), never something like RUN1->RUN3.
AI-Generated: Uses Claude Sonnet 5
--- meta/lib/oeqa/selftest/cases/resulttooltests.py | 10 ++++++++++ 1 file changed, 10 insertions(+)
meta/lib/oeqa/selftest/cases/resulttooltests.py +10 -0
@@ -742,3 +742,13 @@ class ResultToolTests(OESelftestTestCase): self.assertEqual(rowmap['tiny'], [(0.2, None)]) # normal case: delta and percentage both reported self.assertEqual(rowmap['big'], [(50.0, 50.0)]) + + def test_durations_build_rows_computes_consecutive_pairs_only(self): + # 3 sources: deltas should be (run1,run2) and (run2,run3), never (run1,run3) + alldurations = [{'path': {'t': 10.0}}, {'path': {'t': 100.0}}, {'path': {'t': 11.0}}] + rows = durations.build_rows(['t'], 'path', alldurations) + k, vals, deltas = rows[0] + self.assertEqual(vals, [10.0, 100.0, 11.0]) + self.assertEqual(len(deltas), 2) + self.assertEqual(deltas[0], (90.0, 900.0)) + self.assertEqual(deltas[1][0], -89.0)
Signature · 1 line
2.55.0
PATCH 6/13 selftest: resulttooltests.py: add threshold filtering test
In reply to Trevor GamblinAdd a test for resulttool.durations.filter_sort_rows(), covering correct filtering when the '-t/--threshold' percentage is used to ignore result rows below it.
AI-Generated: Uses Claude Sonnet 5
--- meta/lib/oeqa/selftest/cases/resulttooltests.py | 10 ++++++++++ 1 file changed, 10 insertions(+)
meta/lib/oeqa/selftest/cases/resulttooltests.py +10 -0
@@ -752,3 +752,13 @@ class ResultToolTests(OESelftestTestCase): self.assertEqual(len(deltas), 2) self.assertEqual(deltas[0], (90.0, 900.0)) self.assertEqual(deltas[1][0], -89.0) + + def test_durations_filter_sort_rows_threshold_keeps_rows_above_it(self): + rows = [ + ('big_change', [10.0, 20.0], [(10.0, 100.0)]), + ('small_change', [10.0, 11.0], [(1.0, 10.0)]), + ('no_change', [10.0, 10.0], [(0.0, 0.0)]), + ] + args = SimpleNamespace(threshold=50.0, sort_by_delta=False, limit=0) + kept = [k for k, vals, deltas in durations.filter_sort_rows(rows, args)] + self.assertEqual(kept, ['big_change'])
Signature · 1 line
2.55.0
PATCH 7/13 selftest: resulttooltests.py: add threshold-disabled test
In reply to Trevor GamblinAdd a test for resulttool.durations.filter_sort_rows(), covering that a threshold of 0 (the default) disables filtering entirely, so all rows are kept regardless of their delta.
AI-Generated: Uses Claude Sonnet 5
--- meta/lib/oeqa/selftest/cases/resulttooltests.py | 9 +++++++++ 1 file changed, 9 insertions(+)
meta/lib/oeqa/selftest/cases/resulttooltests.py +9 -0
@@ -762,3 +762,12 @@ class ResultToolTests(OESelftestTestCase): args = SimpleNamespace(threshold=50.0, sort_by_delta=False, limit=0) kept = [k for k, vals, deltas in durations.filter_sort_rows(rows, args)] self.assertEqual(kept, ['big_change']) + + def test_durations_filter_sort_rows_threshold_zero_disables_filtering(self): + rows = [ + ('big_change', [10.0, 20.0], [(10.0, 100.0)]), + ('no_change', [10.0, 10.0], [(0.0, 0.0)]), + ] + args = SimpleNamespace(threshold=0.0, sort_by_delta=False, limit=0) + kept = [k for k, vals, deltas in durations.filter_sort_rows(rows, args)] + self.assertEqual(sorted(kept), ['big_change', 'no_change'])
Signature · 1 line
2.55.0
PATCH 8/13 selftest: resulttooltests.py: add multi-pair threshold test
In reply to Trevor GamblinAdd a test for resulttool.durations.filter_sort_rows(), covering that threshold filtering applies to all pairs when more than two sources are provided, not just the first pair.
AI-Generated: Uses Claude Sonnet 5
--- meta/lib/oeqa/selftest/cases/resulttooltests.py | 7 +++++++ 1 file changed, 7 insertions(+)
meta/lib/oeqa/selftest/cases/resulttooltests.py +7 -0
@@ -771,3 +771,10 @@ class ResultToolTests(OESelftestTestCase): args = SimpleNamespace(threshold=0.0, sort_by_delta=False, limit=0) kept = [k for k, vals, deltas in durations.filter_sort_rows(rows, args)] self.assertEqual(sorted(kept), ['big_change', 'no_change']) + + def test_durations_filter_sort_rows_threshold_checks_every_pair_not_just_first(self): + # 3 sources: only the 2nd pair crosses the threshold, the 1st doesn't + rows = [('t', [10.0, 11.0, 100.0], [(1.0, 10.0), (89.0, 809.0)])] + args = SimpleNamespace(threshold=50.0, sort_by_delta=False, limit=0) + kept = [k for k, vals, deltas in durations.filter_sort_rows(rows, args)] + self.assertEqual(kept, ['t'])
Signature · 1 line
2.55.0
PATCH 9/13 selftest: resulttooltests.py: add None-pct threshold test
In reply to Trevor GamblinAdd a test for resulttool.durations.filter_sort_rows(), ensuring that a 'None' percentage (i.e. when both runs round to 0) never satisfies a threshold.
AI-Generated: Uses Claude Sonnet 5
--- meta/lib/oeqa/selftest/cases/resulttooltests.py | 10 ++++++++++ 1 file changed, 10 insertions(+)
meta/lib/oeqa/selftest/cases/resulttooltests.py +10 -0
@@ -778,3 +778,13 @@ class ResultToolTests(OESelftestTestCase): args = SimpleNamespace(threshold=50.0, sort_by_delta=False, limit=0) kept = [k for k, vals, deltas in durations.filter_sort_rows(rows, args)] self.assertEqual(kept, ['t']) + + def test_durations_filter_sort_rows_threshold_ignores_suppressed_none_pct(self): + # a None pct (both runs round to 0s, see build_rows) must never satisfy a threshold + rows = [ + ('tiny', [0.2, 0.4], [(0.2, None)]), + ('big', [10.0, 20.0], [(10.0, 100.0)]), + ] + args = SimpleNamespace(threshold=1.0, sort_by_delta=False, limit=0) + kept = [k for k, vals, deltas in durations.filter_sort_rows(rows, args)] + self.assertEqual(kept, ['big'])
Signature · 1 line
2.55.0
PATCH 10/13 selftest: resulttooltests.py: add sort-by-delta test
In reply to Trevor GamblinAdd a test for resulttool.durations.filter_sort_rows(), covering that passing '-s/--sort-by-delta' correctly orders output by largest absolute change first.
AI-Generated: Uses Claude Sonnet 5
--- meta/lib/oeqa/selftest/cases/resulttooltests.py | 10 ++++++++++ 1 file changed, 10 insertions(+)
meta/lib/oeqa/selftest/cases/resulttooltests.py +10 -0
@@ -788,3 +788,13 @@ class ResultToolTests(OESelftestTestCase): args = SimpleNamespace(threshold=1.0, sort_by_delta=False, limit=0) kept = [k for k, vals, deltas in durations.filter_sort_rows(rows, args)] self.assertEqual(kept, ['big']) + + def test_durations_filter_sort_rows_sort_by_delta_orders_by_largest_change(self): + rows = [ + ('small', [10.0, 11.0], [(1.0, 10.0)]), + ('big', [10.0, 30.0], [(20.0, 200.0)]), + ('medium', [10.0, 15.0], [(5.0, 50.0)]), + ] + args = SimpleNamespace(threshold=0.0, sort_by_delta=True, limit=0) + ordered = [k for k, vals, deltas in durations.filter_sort_rows(rows, args)] + self.assertEqual(ordered, ['big', 'medium', 'small'])
Signature · 1 line
2.55.0
PATCH 11/13 selftest: resulttooltests.py: add limit-after-sort test
In reply to Trevor GamblinAdd a test for resulttool.durations.filter_sort_rows(), ensuring the '-l/--limit' option applies after '-s/--sort-by-delta', truncating the already-sorted rows rather than sorting a truncated set.
AI-Generated: Uses Claude Sonnet 5
--- meta/lib/oeqa/selftest/cases/resulttooltests.py | 10 ++++++++++ 1 file changed, 10 insertions(+)
meta/lib/oeqa/selftest/cases/resulttooltests.py +10 -0
@@ -798,3 +798,13 @@ class ResultToolTests(OESelftestTestCase): args = SimpleNamespace(threshold=0.0, sort_by_delta=True, limit=0) ordered = [k for k, vals, deltas in durations.filter_sort_rows(rows, args)] self.assertEqual(ordered, ['big', 'medium', 'small']) + + def test_durations_filter_sort_rows_limit_applies_after_sort(self): + rows = [ + ('small', [10.0, 11.0], [(1.0, 10.0)]), + ('big', [10.0, 30.0], [(20.0, 200.0)]), + ('medium', [10.0, 15.0], [(5.0, 50.0)]), + ] + args = SimpleNamespace(threshold=0.0, sort_by_delta=True, limit=2) + ordered = [k for k, vals, deltas in durations.filter_sort_rows(rows, args)] + self.assertEqual(ordered, ['big', 'medium'])
Signature · 1 line
2.55.0
PATCH 12/13 selftest: resulttooltests.py: add short-tables ordering test
In reply to Trevor GamblinAdd a test for resulttool.durations.build_tables(), ensuring that the '--show-short' tables are returned after every other table, rather than interleaved per test configuration.
AI-Generated: Uses Claude Sonnet 5
--- .../oeqa/selftest/cases/resulttooltests.py | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+)
meta/lib/oeqa/selftest/cases/resulttooltests.py +47 -0
@@ -808,3 +808,50 @@ class ResultToolTests(OESelftestTestCase): args = SimpleNamespace(threshold=0.0, sort_by_delta=True, limit=2) ordered = [k for k, vals, deltas in durations.filter_sort_rows(rows, args)] self.assertEqual(ordered, ['big', 'medium']) + + def _duration_result(self, machine, long_duration, short_duration): + return {'configuration': {"TEST_TYPE": "runtime", + "TESTSERIES": "series1", + "IMAGE_BASENAME": "image", + "IMAGE_PKGTYPE": "ipk", + "DISTRO": "mydistro", + "MACHINE": machine}, + 'result': { + 'ptestresult.sections': { + 'longsuite': {'duration': str(long_duration)}, + 'shortsuite': {'duration': str(short_duration)}, + }, + }} + + def _write_json(self, data): + f = tempfile.NamedTemporaryFile(mode='w', suffix='.json', delete=False) + json.dump(data, f) + f.close() + return f.name + + def test_durations_build_tables_orders_short_tables_after_all_main_tables(self): + # Two machines, each with one test >= min_duration and one under it + run1 = self._write_json({'qemux86_result': self._duration_result('qemux86', 50, 2), + 'qemux86-64_result': self._duration_result('qemux86-64', 50, 2)}) + run2 = self._write_json({'qemux86_result': self._duration_result('qemux86', 80, 3), + 'qemux86-64_result': self._duration_result('qemux86-64', 80, 3)}) + try: + args = SimpleNamespace(sources=[run1, run2], labels='', sort_by_delta=False, + threshold=0.0, limit=0, min_duration=10.0, show_short=True) + result = durations.build_tables(args, self.logger) + finally: + os.remove(run1) + os.remove(run2) + + self.assertIsNotNone(result) + labels, tables = result + titles = [title for title, rows in tables] + self.assertEqual(len(titles), 4, msg="expected one main and one short table per machine: %s" % titles) + main_titles, short_titles = titles[:2], titles[2:] + self.assertTrue(all("under" not in t for t in main_titles), msg=titles) + self.assertTrue(all("under" in t for t in short_titles), msg=titles) + # the main tables only contain the long test, the short tables only the short one + for title, rows in tables[:2]: + self.assertEqual([k for k, vals, deltas in rows], ['ptestresult.sections.longsuite']) + for title, rows in tables[2:]: + self.assertEqual([k for k, vals, deltas in rows], ['ptestresult.sections.shortsuite'])
Signature · 1 line
2.55.0
PATCH 13/13 selftest: resulttooltests.py: add min-duration default test
In reply to Trevor GamblinAdd a test for resulttool.durations.build_tables(), ensuring that short results are hidden by default according to the default '-m/--min-duration' threshold of 10s.
AI-Generated: Uses Claude Sonnet 5
--- meta/lib/oeqa/selftest/cases/resulttooltests.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
meta/lib/oeqa/selftest/cases/resulttooltests.py +15 -0
@@ -855,3 +855,18 @@ class ResultToolTests(OESelftestTestCase): self.assertEqual([k for k, vals, deltas in rows], ['ptestresult.sections.longsuite']) for title, rows in tables[2:]: self.assertEqual([k for k, vals, deltas in rows], ['ptestresult.sections.shortsuite']) + + def test_durations_build_tables_hides_short_tests_by_default(self): + run1 = self._write_json({'result': self._duration_result('qemux86', 50, 2)}) + run2 = self._write_json({'result': self._duration_result('qemux86', 80, 3)}) + try: + args = SimpleNamespace(sources=[run1, run2], labels='', sort_by_delta=False, + threshold=0.0, limit=0, min_duration=10.0, show_short=False) + labels, tables = durations.build_tables(args, self.logger) + finally: + os.remove(run1) + os.remove(run2) + + self.assertEqual(len(tables), 1) + title, rows = tables[0] + self.assertEqual([k for k, vals, deltas in rows], ['ptestresult.sections.longsuite'])
Signature · 1 line
2.55.0
Quoted 180 lines · Trevor Gamblin
This series is motivated by the need to compare durations for various test results (originally, ptest) as reported by the Autobuilder. In particular, I've been looking at the intermittent ptest issues seen on the AB for the qemuriscv64-ptest builders, but we needed a good way to compare per-package durations before and after commit
6d6aaf4204be("qemu: backport RISC-V TLB page flushing patches"). I tested this change locally with coreutils (which showed roughly 38% improvement on my workstation) and other tests (e.g. libpng, which showed no meaningful change), and review on the upstream QEMU list confirmed it helped with boot and runtime performance for qemuriscv64.This resulttool durations feature provides a means to quantify changes in duration across more packages at a scale beyond what my machines can handle, and might be useful to compare before and after other changes (e.g. toolchain tests) over time. I've also added a variety of test cases for oeqa selftests, covering everything from basic results parsing to making sure the tool respects thresholds. Each of those tests is added as a separate commit to make review easier.
I used Claude Code to help build this out. Design took some refinement, especially with:
- Comparing delta results for very short tests (i.e. those running for 5-10 seconds or less) were mostly noise, especially when fractional runtimes were calculated under the hood and ended up reporting "0" for both runtimes but large (68%, 350%, etc.) deltas. I don't think we have much use for tracking differences in such short tests, but I did provide a '-m/--min-duration' to tweak this (defaulting to 10) if we want to be able to look at those.
- Durations can vary small amounts (5-10 seconds) across consecutive tests even under little or no load, and higher when the host system is under heavy load (like the AB workers), so a '-t/--threshold' option is available to filter out any tests whose deltas are under a certain percentage. I didn't set a default here, but 10% is probably a reasonable one for people to use.
- A sort option '-s/--sort-by-delta' was an obvious add so that it can be used to check what the biggest changes are from run to run.
- Importantly, resulttool durations can compare more than two sources. This will be critical for tracking how results trend over time, but reporting deltas in this case seemed more debatable. For now I've left it at only reporting deltas between consecutive runs (soRUN1->RUN2andRUN2->RUN3, but notRUN1->RUN3). If we need the overall delta then that should be an easy follow-up.This has already been useful/promising for inspecting the AB experience with qemuriscv64-ptest since the aforementioned QEMU patch backport. For example, I ran the following yesterday to get the top 25 largest deltas for qemuriscv64-ptest:
1. resulttool report https://valkyrie.yocto.io/pub/non-release/20260922-113/testresults/qemuriscv64-ptest/testresults.json > 113.log
2. resulttool report https://valkyrie.yocto.io/pub/non-release/20260922-114/testresults/qemuriscv64-ptest/testresults.json > 114.log
3. resulttool durations -s -l 25 114.log 113.logAnd here's what it showed:
|diffstat 96 34 -62 -65 |xz 14 5 -9 -64 |diffutils 44 16 -28 -64 |quilt 836 307 -529 -63 |busybox 94 35 -59 -63 |coreutils 2997 1166 -1831 -61 |dpkg 647 256 -391 -60 |gettext 1910 762 -1148 -60 |findutils 110 44 -66 -60 |m4 680 281 -399 -59 |util-linux 1522 643 -879 -58 |gawk 171 74 -97 -57 |elfutils 459 213 -246 -54 |bluez5 115 54 -61 -53 |libssh2 94 48 -46 -49 |logrotate 186 95 -91 -49 |sed 142 73 -69 -49 |opkg 199 113 -86 -43 |openssh 2846 1662 -1184 -42 |gdbm 27 17 -10 -37 |bzip2 300 409 109 36 |parted 473 311 -162 -34 |wayland 12 8 -4 -33Interestingly, bzip2's runtime actually increased (a lot!). A proper analysis would require averaging the results over several runs, but there seems to be a trend with some compression and encryption packages that I'll be looking into. In the meantime, hopefully this feature for resulttools will prove useful to others too, even if they'd like to see further improvements. Note that I've tested it for non-ptest cases, and it works there too.
Using the following command and results:
- resulttool durations -s -t 10
- https://valkyrie.yocto.io/pub/non-release/20260923-8/testresults/qemux86-64/testresults.json
- https://valkyrie.yocto.io/pub/non-release/20260923-50/testresults/qemux86-64/testresults.jsonI see:
|=== runtime/poky/qemux86-64/core-image-sato-sdk === |TESTCASE RUN1 RUN2 RUN1->RUN2 % |stap.StapTest.test_stap 7 13 5 73 |kernelmodule.KernelModuleTest.test_kernel_module 22 30 8 36 |buildcpio.BuildCpioTest.test_cpio 28 31 3 10 | |=== sdk/qemux86-64/i686/core-image-sato === |TESTCASE RUN1 RUN2 RUN1->RUN2 % |cmake.CMakeTest.test_assimp 71 83 12 17 | |=== sdk/qemux86-64/x86_64/core-image-sato === |TESTCASE RUN1 RUN2 RUN1->RUN2 % |rust.RustHostCompileTest.test_cargo_build 13 18 4 33 |cmake.CMakeTest.test_assimp 71 92 22 31 |autotools.AutotoolsTest.test_cpio 24 27 3 11 | |=== sdkext/qemux86-64/x86_64/core-image-minimal === |TESTCASE RUN1 RUN2 RUN1->RUN2 % |maturin.MaturinTest.test_maturin_list_python 4 21 18 459 |devtool.DevtoolTest.test_devtool_build_esdk_package 28 132 104 372 |python.Python3Test.test_python3 5 22 17 335 |devtool.DevtoolTest.test_extend_autotools_recipe_creation 82 319 238 291 |devtool.DevtoolTest.test_recipes_for_nodejs 15 25 9 61 |devtool.DevtoolTest.test_devtool_kernelmodule 433 580 147 34 |cmake.CMakeTest.test_assimp 75 95 21 27 |devtool.DevtoolTest.test_devtool_add_reset 12 15 3 26 |devtool.DevtoolTest.test_devtool_build_cmake 29 36 7 23 | |=== sdkext/qemux86-64/x86_64/core-image-sato === |TESTCASE RUN1 RUN2 RUN1->RUN2 % |devtool.DevtoolTest.test_devtool_build_cmake 30 236 206 686 |maturin.MaturinTest.test_maturin_list_python 4 22 18 469 |python.Python3Test.test_python3 5 22 17 377 |devtool.DevtoolTest.test_devtool_kernelmodule 429 1394 965 225 |devtool.DevtoolTest.test_devtool_add_reset 13 18 5 39 |maturin.MaturinDevelopTest.test_maturin_develop 24 32 9 36 |cmake.CMakeTest.test_assimp 73 97 24 33 |devtool.DevtoolTest.test_extend_autotools_recipe_creation 81 105 24 30 |devtool.DevtoolTest.test_recipes_for_nodejs 15 19 4 24 |devtool.DevtoolTest.test_devtool_build_make 33 39 6 17 |autotools.AutotoolsTest.test_cpio 24 27 3 11Some other examples of use:
First five results when comparing two reports from 'resulttool report':
|tgamblin@megalith ~/workspace/ypbuilds/poky-qemuriscv64/build $ resulttool durations -l 5 tlb_before.log tlb_tweak.log | |=== qemuriscv64 PTest Result Summary (Libc: glibc) === |TESTCASE RUN1 RUN2 RUN1->RUN2 % |apr 50 48 -2 -4 |apr-util 13 11 -2 -15 |babeltrace2 1302 1042 -260 -20 |bc 82 82 0 0 |bluez5 115 71 -44 -38First five results from the same reports when sorted by highest change:
|tgamblin@megalith ~/workspace/ypbuilds/poky-qemuriscv64/build $ resulttool durations -l 5 -s tlb_before.log tlb_tweak.log | |=== qemuriscv64 PTest Result Summary (Libc: glibc) === |TESTCASE RUN1 RUN2 RUN1->RUN2 % |libseccomp 3833 1686 -2147 -56 |quilt 836 438 -398 -48 |findutils 110 58 -52 -47 |diffstat 96 52 -44 -46 |diffutils 44 24 -20 -45Raw (and truncated) testresults.json comparison for two sources from the Autobuilder:
|tgamblin@megalith ~/workspace/ypbuilds/poky-qemuriscv64/layers/openembedded-core ((no branch, rebasing master))$ resulttool durations https://valkyrie.yocto.io/pub/non-release/20260923-79/testresults/qemuriscv64-ptest/testresults.json https://valkyrie.yocto.io/pub/non-release/20260923-78/testresults/qemuriscv64-ptest/testresults.json | |=== runtime/poky/qemuriscv64/core-image-ptest-apr === |TESTCASE RUN1 RUN2 RUN1->RUN2 % |ptest.PtestRunnerTest.test_ptestrunner_expectfail 48 48 0 1 |ptestresult.sections.apr 46 47 1 2 | |=== runtime/poky/qemuriscv64/core-image-ptest-apr-util === |TESTCASE RUN1 RUN2 RUN1->RUN2 % |ptest.PtestRunnerTest.test_ptestrunner_expectfail 12 13 1 9 |ptestresult.sections.apr-util 11 11 0 0 | |=== runtime/poky/qemuriscv64/core-image-ptest-babeltrace2 === |TESTCASE RUN1 RUN2 RUN1->RUN2 % |ptest.PtestRunnerTest.test_ptestrunner_expectfail 981 1066 85 9 |ptestresult.sections.babeltrace2 973 1058 85 9The same results with '-l 1' (one line max):
Quoted 13 lines
|tgamblin@megalith ~/workspace/ypbuilds/poky-qemuriscv64/layers/openembedded-core ((no branch, rebasing master))$ resulttool durations -l 1 https://valkyrie.yocto.io/pub/non-release/20260923-79/testresults/qemuriscv64-ptest/testresults.json https://valkyrie.yocto.io/pub/non-release/20260923-78/testresults/qemuriscv64-ptest/testresults.json | |=== runtime/poky/qemuriscv64/core-image-ptest-apr === |TESTCASE RUN1 RUN2 RUN1->RUN2 % |ptest.PtestRunnerTest.test_ptestrunner_expectfail 48 48 0 1 | |=== runtime/poky/qemuriscv64/core-image-ptest-apr-util === |TESTCASE RUN1 RUN2 RUN1->RUN2 % |ptest.PtestRunnerTest.test_ptestrunner_expectfail 12 13 1 9 | |=== runtime/poky/qemuriscv64/core-image-ptest-babeltrace2 === |TESTCASE RUN1 RUN2 RUN1->RUN2 % |ptest.PtestRunnerTest.test_ptestrunner_expectfail 981 1066 85 9
Realizing I didn't provide an example of the three-sources case. This is what the raw output looks like:
|TESTCASE RUN1 RUN2 RUN3 RUN1->RUN2 % RUN2->RUN3 % |ptestresult.sections.util-linux 1522 643 935 -879 -58 292 45 |ptest.PtestRunnerTest.test_ptestrunner_expectfail 1525 645 937 -880 -58 292 45 | |=== runtime/poky/qemuriscv64/core-image-ptest-wayland === |TESTCASE RUN1 RUN2 RUN3 RUN1->RUN2 % RUN2->RUN3 % |ptestresult.sections.wayland 12 8 10 -4 -33 2 25 |ptest.PtestRunnerTest.test_ptestrunner_expectfail 14 10 11 -5 -33 2 19 | |=== runtime/poky/qemuriscv64/core-image-ptest-xz === |TESTCASE RUN1 RUN2 RUN3 RUN1->RUN2 % RUN2->RUN3 % |ptestresult.sections.xz 14 5 9 -9 -64 4 80 |ptest.PtestRunnerTest.test_ptestrunner_expectfail 16 7 10 -9 -57 3 41
And using reports:
|tgamblin@megalith ~/workspace/ypbuilds/poky-qemuriscv64/layers/openembedded-core (tgamblin/resulttool-durations)$ resulttool durations -s -t 10 114.log 113.log 64.log | |=== qemuriscv64 PTest Result Summary (Libc: glibc) === |TESTCASE RUN1 RUN2 RUN3 RUN1->RUN2 % RUN2->RUN3 % |xz 14 5 9 -9 -64 4 80 |flex 33 11 19 -22 -67 8 73 |libseccomp 3833 1098 1766 -2735 -71 668 61 |busybox 94 35 58 -59 -63 23 66 |diffstat 96 34 55 -62 -65 21 62
Trevor
Quoted 21 lines
Trevor Gamblin (13):
scripts: resulttool: add 'durations' option
selftest:resulttooltests.py: add basic durations test
selftest:resulttooltests.py: add report-log Time(s) column test
selftest:resulttooltests.py: add zero-round pct suppression test
selftest:resulttooltests.py: add consecutive-pair delta test
selftest:resulttooltests.py: add threshold filtering test
selftest:resulttooltests.py: add threshold-disabled test
selftest:resulttooltests.py: add multi-pair threshold test
selftest:resulttooltests.py: add None-pct threshold test
selftest:resulttooltests.py: add sort-by-delta test
selftest:resulttooltests.py: add limit-after-sort test
selftest:resulttooltests.py: add short-tables ordering test
selftest:resulttooltests.py: add min-duration default test.../oeqa/selftest/cases/resulttooltests.py | 201 ++++++++++++++++++ scripts/lib/resulttool/durations.py | 187 ++++++++++++++++ scripts/resulttool | 2 + 3 files changed, 390 insertions(+) create mode 100644 scripts/lib/resulttool/durations.py