Skip to content

mackas buildstats diff: wire up upstream buildstats-diff, don't reimplement #69

Description

@koenkooi

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions