Skip to content

v2.1.0

Latest

Choose a tag to compare

@alubbock alubbock released this 26 Apr 12:31
· 4 commits to main since this release
223ad40

New features

  • MBResourceUsage mixin: captures POSIX getrusage() data: user and
    system CPU time, peak RSS (in bytes, normalised across platforms), minor and
    major page faults, block I/O operations, and voluntary/involuntary context
    switches. Results are stored as a list in resource_usage, one entry per
    timed iteration, aligned index-for-index with call.durations and
    call.returncode. Added as a default CLI mixin so every CLI run captures
    it automatically.

    • CLI mode: on POSIX, uses os.wait4() to capture the exact rusage of each
      individual child process as reported by the kernel, including a reliable
      maxrss per iteration regardless of --iterations or --warmup count.
    • Python API mode: uses RUSAGE_SELF with a before/after delta around each
      individual call – one entry per timed iteration, aligned with
      call.durations. Warmup calls are excluded. maxrss is omitted (lifetime
      process HWM, not per-call). Use MBPeakMemory for per-call peak memory.

    On platforms where the stdlib resource module is unavailable, the
    resource_usage key is omitted from the record entirely.

Enhancements

  • --mixin defaults keyword (CLI): defaults can be used as a mixin
    name to expand to the standard default set (python-info, host-info,
    slurm-info, loaded-modules, working-dir, resource-usage). This
    makes it easy to add one or more extra mixins without listing all six
    defaults explicitly:
    microbench --mixin defaults file-hash -- ./job.sh.

  • file-hash mixin – automatic argument file scanning (CLI): the
    default hash list now includes not only the command executable (cmd[0])
    but also any command-line arguments (cmd[1:]) that resolve to existing
    files on disk prior to command execution. Passing --hash-file still
    overrides the default entirely; the Python API is unaffected. The hash
    algorithm name is now stored under mb.file_hash_algorithm.

Bug fixes

  • MBResourceUsage – pre_run_triggers/post_run_triggers now forward
    via super()
    : composing MBResourceUsage with another mixin that also
    implements pre_run_triggers or post_run_triggers previously caused the
    second mixin's hooks to be silently skipped. Both methods now propagate
    correctly through the MRO.

Documentation

  • cli_compatible class attribute removed from built-in mixins: this
    attribute was never read at runtime; CLI availability is governed solely
    by the MIXIN_REGISTRY in cli/registry.py. The extending guide example
    has been updated to drop it; custom mixins that set it can safely remove
    it without any behavioural change.

  • Fix documentation on writing custom mixins to note that they must be
    added to the registry if they are to be detected by the CLI.

Full list of changes

  • docs: fix link in README by @alubbock in #106
  • refactor: remove cli_compatible class attribute from mixins by @alubbock in #107
  • feat(file-hash): auto-hash files found in CLI command arguments by @alubbock in #108
  • feat: add defaults keyword for --mixin by @alubbock in #109
  • ci: tighten workflow permissions by @alubbock in #111
  • chore(deps): update astral-sh/ruff-action action to v4 by @renovate[bot] in #112
  • feat: add MBResourceUsage mixin with POSIX getrusage() capture by @alubbock in #110
  • fix(resource-usage): forward pre/post_run_triggers via super() for correct MRO chaining by @alubbock in #113
  • docs: remove stale cli_compatible from extending guide and note in CHANGELOG by @alubbock in #114
  • chore(release): v2.1.0 by @alubbock in #115

Full Changelog: v2.0.0...v2.1.0