Skip to content

Commit

Permalink
docs: add docs for aztec flamegraph (#11657)
Browse files Browse the repository at this point in the history
Co-authored-by: josh crites <[email protected]>
  • Loading branch information
saleel and critesjosh authored Jan 31, 2025
1 parent 20fc3e9 commit e333f29
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,30 @@ Total gates: 329,558
Here you can see the gate count of each private function call in the transaction along with the kernel circuits needed in between, and the total gate count.

This will help you understand which parts of your transaction are bottlenecks and optimize the contract logic accordingly.


## Flamegraph

While the `aztec-wallet` provides a way to profile the gate count of each private function in a transaction, flamegraph tool lets you visualize the gate count of each operation within a private function.

You can run the flamegraph tool by running the following command:

```bash
aztec flamegraph <artifact_path> <function_name>
```

For example, if you want to flamegraph the `cast_vote` function [aztec-starter](https://github.com/AztecProtocol/aztec-starter/blob/main/src/main.nr), you can do

```bash
aztec-nargo compile
aztec flamegraph target/easy_private_voting_contract-EasyPrivateVoting.json cast_vote
```

This will generate a flamegraph of the `cast_vote` function and save the output svg to the `target` directory. You can open the svg file in your browser to visualize the flamegraph.

You can also run the same command with `SERVE=1` to serve the flamegraph on a local server.

```bash
SERVE=1 aztec flamegraph target/easy_private_voting_contract-EasyPrivateVoting.json cast_vote
```
This will serve the flamegraph on `http://localhost:8000`.
7 changes: 7 additions & 0 deletions docs/docs/reference/developer_references/cli_reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,13 @@ Required option:

## Development and Debugging Tools

### flamegraph
Generates a flamegraph of the gate counts of a private function call.

```
[SERVE=1] aztec flamegraph <artifact_path> <function_name>
```

### codegen
Validates and generates an Aztec Contract ABI from Noir ABI.

Expand Down

0 comments on commit e333f29

Please sign in to comment.