Skip to content

feat: Add --log-compute-units flag for compute unit logs#4222

Open
swaroop-osec wants to merge 3 commits intosolana-foundation:masterfrom
swaroop-osec:feat/log-compute-units
Open

feat: Add --log-compute-units flag for compute unit logs#4222
swaroop-osec wants to merge 3 commits intosolana-foundation:masterfrom
swaroop-osec:feat/log-compute-units

Conversation

@swaroop-osec
Copy link
Copy Markdown
Collaborator

  • Adds a --log-compute-units CLI flag that inserts sol_remaining_compute_units() calls at strategic points in Anchor-generated code, enabling developers to profile compute unit consumption.

  • Users can also log compute units anywhere in their program code using sol_remaining_compute_units()

    Usage

 anchor build --log-compute-units
 anchor test --log-compute-units

Closes #151

@vercel
Copy link
Copy Markdown

vercel bot commented Feb 5, 2026

@swaroop-osec is attempting to deploy a commit to the Solana Foundation Team on Vercel.

A member of the Team first needs to authorize it.

@swaroop-osec
Copy link
Copy Markdown
Collaborator Author

Failing tests will be fixed by #4210 and #4203

@jamie-osec
Copy link
Copy Markdown
Collaborator

For reference, previous attempt inserted these at every line. This seems much simpler and covers the main important points

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.

cli, lang: Add compute units logging

2 participants