New features
-
MBResourceUsagemixin: captures POSIXgetrusage()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 inresource_usage, one entry per
timed iteration, aligned index-for-index withcall.durationsand
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
maxrssper iteration regardless of--iterationsor--warmupcount. - Python API mode: uses
RUSAGE_SELFwith a before/after delta around each
individual call – one entry per timed iteration, aligned with
call.durations. Warmup calls are excluded.maxrssis omitted (lifetime
process HWM, not per-call). UseMBPeakMemoryfor per-call peak memory.
On platforms where the stdlib
resourcemodule is unavailable, the
resource_usagekey is omitted from the record entirely. - CLI mode: on POSIX, uses
Enhancements
-
--mixin defaultskeyword (CLI):defaultscan 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-hashmixin – 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-filestill
overrides the default entirely; the Python API is unaffected. The hash
algorithm name is now stored undermb.file_hash_algorithm.
Bug fixes
MBResourceUsage–pre_run_triggers/post_run_triggersnow forward
viasuper(): composingMBResourceUsagewith another mixin that also
implementspre_run_triggersorpost_run_triggerspreviously caused the
second mixin's hooks to be silently skipped. Both methods now propagate
correctly through the MRO.
Documentation
-
cli_compatibleclass attribute removed from built-in mixins: this
attribute was never read at runtime; CLI availability is governed solely
by theMIXIN_REGISTRYincli/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