Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion noir-projects/noir-protocol-circuits/scripts/flamegraph.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ DEST="$SCRIPT_DIR/../dest"
mkdir -p $DEST

# At last, generate the flamegraph.
$PROFILER gates-flamegraph --artifact-path "${ARTIFACT}" --backend-path "$SCRIPT_DIR/../../../barretenberg/cpp/build/bin/bb" --output "$DEST"
$PROFILER gates-flamegraph --artifact-path "${ARTIFACT}" --backend-path "$SCRIPT_DIR/../../../barretenberg/cpp/build/bin/bb" --output "$DEST" -- -h

# Serve the file over http if -s is set.
if $SERVE; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ pub(crate) struct GatesFlamegraphCommand {
#[clap(long, short)]
backend_path: String,

#[arg(trailing_var_arg = true, allow_hyphen_values = true)]
backend_extra_args: Vec<String>,

/// The output folder for the flamegraph svg files
#[clap(long, short)]
output: String,
Expand All @@ -27,7 +30,10 @@ pub(crate) struct GatesFlamegraphCommand {
pub(crate) fn run(args: GatesFlamegraphCommand) -> eyre::Result<()> {
run_with_provider(
&PathBuf::from(args.artifact_path),
&BackendGatesProvider { backend_path: PathBuf::from(args.backend_path) },
&BackendGatesProvider {
backend_path: PathBuf::from(args.backend_path),
extra_args: args.backend_extra_args,
},
&InfernoFlamegraphGenerator { count_name: "gates".to_string() },
&PathBuf::from(args.output),
)
Expand Down
12 changes: 10 additions & 2 deletions noir/noir-repo/tooling/profiler/src/gates_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,20 @@ pub(crate) trait GatesProvider {

pub(crate) struct BackendGatesProvider {
pub(crate) backend_path: PathBuf,
pub(crate) extra_args: Vec<String>,
}

impl GatesProvider for BackendGatesProvider {
fn get_gates(&self, artifact_path: &Path) -> eyre::Result<BackendGatesResponse> {
let backend_gates_response =
Command::new(&self.backend_path).arg("gates").arg("-b").arg(artifact_path).output()?;
let mut backend_gates_cmd = Command::new(&self.backend_path);

backend_gates_cmd.arg("gates").arg("-b").arg(artifact_path);

for arg in &self.extra_args {
backend_gates_cmd.arg(arg);
}

let backend_gates_response = backend_gates_cmd.output()?;

// Parse the backend gates command stdout as json
let backend_gates_response: BackendGatesResponse =
Expand Down