Skip to content
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

feat: flamegraph artifact cleanup #7869

Merged
merged 1 commit into from
Aug 9, 2024
Merged
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
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
Loading