buildstats analyze summarises exactly one build. resolve_buildstats_dir() enumerates every build dir under PATH and throws all but the lexically greatest away; the data for a two-build comparison is already enumerated by list_buildstats_dirs() and discarded.
Upstream oe-core ships the comparator: scripts/buildstats-diff runs unmodified on host Python (confirmed live against a synthetic two-build tree on this Mac) -- no container, no bitbake, no bb import (scripts/lib/buildstats.py imports only json/logging/os/re/collections/statistics). Its cputime is rusage + child_rusage, numerically identical to what mackas-buildstats-analyze computes, so a diff would agree with the summary.
mackas's own retrieve shape already makes this usable: each retrieval nests under its own timestamp, so the host artifacts tree accumulates builds even though clear_buildstats_before_build keeps the guest to one. retrieve buildstats twice and the diff has two real operands.
Scope: mackas buildstats diff [PATH] [--from DIR --to DIR], defaulting to the last two entries of list_buildstats_dirs, shelling out to $MACKAS_WORK/.../scripts/buildstats-diff on host Python, degrading with an info (not a warn) when there's no checkout or fewer than two builds -- the same skip-vs-warn discipline as the SVG chart. Wire it up, don't reimplement upstream's parsing.
Two things to design around rather than discover later:
- Upstream's parser is less tolerant than mackas's own:
BSTask.from_file does an unguarded line.split(':', 1) and raises BSError for any task lacking Started/Ended, and split_nevr() will AttributeError on a recipe dir name it can't parse -- a truncated task file that mackas-buildstats-analyze shrugs off can take the diff down.
- The comparison is only meaningful between like-for-like builds -- with sstate, a scratch-vs-incremental pair is nearly all +/- task rows. Use upstream's own floors as-is (3s cputime / 5s walltime
--min-val, 1s / 2s --min-absdiff) rather than inventing new thresholds, and warn when the two operands' task counts differ wildly.
buildstats analyzesummarises exactly one build.resolve_buildstats_dir()enumerates every build dir under PATH and throws all but the lexically greatest away; the data for a two-build comparison is already enumerated bylist_buildstats_dirs()and discarded.Upstream oe-core ships the comparator:
scripts/buildstats-diffruns unmodified on host Python (confirmed live against a synthetic two-build tree on this Mac) -- no container, no bitbake, nobbimport (scripts/lib/buildstats.pyimports onlyjson/logging/os/re/collections/statistics). Itscputimeisrusage + child_rusage, numerically identical to whatmackas-buildstats-analyzecomputes, so a diff would agree with the summary.mackas's own retrieve shape already makes this usable: each retrieval nests under its own timestamp, so the host artifacts tree accumulates builds even though
clear_buildstats_before_buildkeeps the guest to one.retrieve buildstatstwice and the diff has two real operands.Scope:
mackas buildstats diff [PATH] [--from DIR --to DIR], defaulting to the last two entries oflist_buildstats_dirs, shelling out to$MACKAS_WORK/.../scripts/buildstats-diffon host Python, degrading with aninfo(not a warn) when there's no checkout or fewer than two builds -- the same skip-vs-warn discipline as the SVG chart. Wire it up, don't reimplement upstream's parsing.Two things to design around rather than discover later:
BSTask.from_filedoes an unguardedline.split(':', 1)and raisesBSErrorfor any task lackingStarted/Ended, andsplit_nevr()willAttributeErroron a recipe dir name it can't parse -- a truncated task file thatmackas-buildstats-analyzeshrugs off can take the diff down.--min-val, 1s / 2s--min-absdiff) rather than inventing new thresholds, and warn when the two operands' task counts differ wildly.