Skip to content

Commit

Permalink
feat: flamegraph artifact cleanup (#7869)
Browse files Browse the repository at this point in the history
  • Loading branch information
benesjan authored Aug 9, 2024
1 parent f8b0de6 commit 6f70bba
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions noir-projects/noir-contracts/scripts/flamegraph.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
#!/usr/bin/env bash
set -eu

# Function to clean up and exit
cleanup_and_exit() {
echo "Cleaning up..."
rm -f "$SCRIPT_DIR/../target/$FUNCTION_ARTIFACT"
exit 0
}

# Trap SIGINT (Ctrl+C) and call cleanup_and_exit
trap cleanup_and_exit SIGINT

# If first arg is -h or --help, print usage
if [ "$1" == "-h" ] || [ "$1" == "--help" ]; then
echo "Usage: $0 <contract> <function>"
Expand Down Expand Up @@ -57,3 +67,6 @@ $PROFILER gates-flamegraph --artifact-path "$SCRIPT_DIR/../target/$FUNCTION_ARTI
# serve the file over http
echo "Serving flamegraph at http://0.0.0.0:8000/main_gates.svg"
python3 -m http.server --directory "$SCRIPT_DIR/../dest" 8000

# Clean up before exiting
cleanup_and_exit

0 comments on commit 6f70bba

Please sign in to comment.