Skip to content

Add MemBrowse memory tracking - #153

Open
michael-membrowse wants to merge 1 commit into
tweedegolf:masterfrom
michael-membrowse:add-membrowse
Open

michael-membrowse wants to merge 1 commit into
tweedegolf:masterfrom
michael-membrowse:add-membrowse

Conversation

@michael-membrowse

Copy link
Copy Markdown

As discussed in #104, @diondokter was interested in a PR adding MemBrowse memory tracking. Sorry it took me so long to open it! It addresses the three problems with the current binary-size comments:

  • One comment per PR, updated in place. The comment is posted once and edited on every later push, so there's a single notification per PR instead of one per push.
  • Comments work on PRs from forks. The report workflow uploads without needing secrets on fork PRs. A separate workflow_run workflow then posts the comment with the base repo's token, so the comment appears no matter who opens the PR.
  • Tracking over time, not just one diff. Every push to master is recorded, so you can follow FLASH and RAM across history, compare any two commits, and see which symbols, crates and source files changed. Memory budgets can optionally flag PRs that grow too much.

Addresses #104

What's in this PR

  • membrowse-report.yml builds the nRF52840 example with the same nightly and build-std setup as the binary-size job, on pushes to master and on PRs. It also writes a linker map, so sizes are attributed to crates and object files.
  • membrowse-comment.yml posts or updates the PR comment once the report finishes.
  • membrowse-onboard.yml is a manual workflow that backfills history.
  • A MemBrowse badge is added to the README.

Setup

  1. Create an account. Go to membrowse.com and sign up.
  2. Create a project. In the portal, click New Project, enter a name and description, and click Create. The API key is shown right after the project is created. Copy it, because it's only displayed once. It can be regenerated later under Project Settings → API Key.
  3. Add the GitHub secret. In this repository, go to Settings → Secrets and variables → Actions → New repository secret. Name it MEMBROWSE_API_KEY and paste the API key as the value.
  4. Enable public access, which the README badge needs. In Project Settings, set the GitHub repository URL to https://github.com/tweedegolf/sequential-storage, then toggle Public Access on.
  5. Optionally backfill history. Run Actions → Onboard to MemBrowse. Commits before November 2025 won't build on current nightly, because the example then used the old panic_immediate_abort build-std feature, so history effectively starts there.

Until the secret is set, the MemBrowse report job will fail on pushes to master and the comment workflow skips itself. The other CI jobs are not affected.

Preview

This is running on my fork, for the nRF52840 example: https://membrowse.com/public/michael-membrowse/sequential-storage/target/nrf52840-example

The current example uses 18,428 bytes of FLASH (1.8%) and 1,752 bytes of RAM (0.7%).

Build the nRF52840 example on pushes to master and on pull requests and
upload a memory report to MemBrowse. PRs, including ones from forks, get
a single comment that is updated on later pushes, posted by a
workflow_run-triggered workflow. An onboard workflow backfills history
on demand. Add the MemBrowse badge to the README.
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