-
Notifications
You must be signed in to change notification settings - Fork 715
Added blockreplay profiler #6682
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Added blockreplay profiler #6682
Conversation
aaronb-stacks
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, I just think we should further separate the cfg flag dependent code into a new struct so that the actual logic of the RPC endpoint is free of flags.
adriano-stacks
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am comment (instead of approving) just because of the Clippy warnings. Everything else is nits, feel free to address or ignore.
| txs_receipts.push(tx_result.receipt); | ||
| txs_receipts.push(( | ||
| tx_result.receipt, | ||
| profiler_result.cpu_instructions, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a nit: do we consider the profiler results "receipts"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also is there a reason to pass the three members instead of profiler_result?
| events, | ||
| post_condition_aborted: receipt.post_condition_aborted, | ||
| vm_error: receipt.vm_error.clone(), | ||
| cpu_instructions: cpu_instructions.clone(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like Clippy doesn't like these lines :)
Description
Add a profiler based on linux perf_events api (only x86-64 for now). This is the base for starting the optimization work on the clarity vm.
The patch exposes a new rust feature for the stackslib crate.
cargo build --features stackslib/profilerWill add to the blockreplay endpoint the ability to profile the cpu costs of every transaction in a block (currently the number of cpu instructions, cycles and ref cycles are reported)
To enable the feature you need to pass ?profiler=1 in the query string of the endpoint.
Note that the endpoint is protected by authentication.
Note 2: the linux perf_events api could be protected on your system. To allow non-privileged use you can run:
(this will allow unprivileged access to the perf_event api)
Note 3: currently the system works only on linux x86-64
Applicable issues
Additional info (benefits, drawbacks, caveats)
Checklist
docs/rpc/openapi.yamlandrpc-endpoints.mdfor v2 endpoints,event-dispatcher.mdfor new events)clarity-benchmarkingrepo