Skip to content

Record wall time and peak memory growth per module - #930

Draft
DonnchaC wants to merge 1 commit into
mainfrom
feat/module-run-stats
Draft

DonnchaC wants to merge 1 commit into
mainfrom
feat/module-run-stats

Conversation

@DonnchaC

@DonnchaC DonnchaC commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator

What

Command.run() records, for every module it runs, the wall time and how much the process's peak resident set size grew while the module ran. Each is logged at INFO in one line and the list is written to info.json under module_stats, in run order:

"module_stats": [
    {"module": "Manifest", "seconds": 0.12, "peak_rss_growth_mb": 3},
    ...
]

Why

An analysis run on a memory-constrained host grew to the host's whole RAM and stalled it, and nothing in the run said which module cost what. With the numbers in every run's info file, a regression in a new or changed module shows up in CI (comparing module_stats against the previous run on main) and in any case run.

ru_maxrss is the process peak, so a module's number is how much it raised the high-water mark, which is what matters on a host without swap; a module running after a bigger one reports 0. On Windows resource is unavailable and the growth is reported as 0.

Not in this change

A CI gate comparing the numbers against main, a per-module budget with a warning when exceeded, and a way to bound a run (thread count for parallel parsers, a memory limit a command applies to itself). Those need baselines from real runs first; this change produces them.

Tried on a real run

A full check-sysdiagnose over a 545 MB test-device sysdiagnose with private modules loaded, 74 modules: the stats put 2087 MB of the 2268 MB total peak growth on the one module that triggers the shared unified-log parse, and no other module above 145 MB. That is the attribution the issue wanted; the overhead of the accounting itself is not measurable against the run's 55 s.

Command.run() times every module and measures how much the process's
peak resident set size grew while it ran. Both are logged at INFO in
one line per module and written to info.json under module_stats, in
run order, so any run says which module cost what and CI can compare a
branch against main.

ru_maxrss is the process peak, so a module's growth is how much it
raised the high-water mark, which is what matters on a host without
swap; a module running after a bigger one reports 0. Where the resource
module is unavailable the growth is reported as 0.
@github-actions

Copy link
Copy Markdown
Contributor

Coverage

Coverage Report •
FileStmtsMissCoverMissing
src/mvt/common
   command.py3952394%44–45, 119–123, 217, 226–227, 233–237, 451, 454, 562, 698, 750, 778, 782–783, 789–794
TOTAL9694229276% 

Tests Skipped Failures Errors Time
470 1 💤 0 ❌ 0 🔥 16.109s ⏱️

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant