Skip to content

Instantly share code, notes, and snippets.

@ferranbt
Last active March 4, 2022 11:15
Show Gist options
  • Save ferranbt/e58c3f5032941a4b3550ff009afdb859 to your computer and use it in GitHub Desktop.
Save ferranbt/e58c3f5032941a4b3550ff009afdb859 to your computer and use it in GitHub Desktop.
#!/bin/bash
tmp_dir=$(mktemp -d -t ci-XXXXXXXXXX)
URL=http://localhost:7071
STATUS_CODE=$(wget --spider -S "$URL" 2>&1 | grep "HTTP/" | awk '{print $2}')
if [[ -z $STATUS_CODE ]]; then
echo "Pprof server not found at $URL. Are you running Bor with --pprof?"
exit 1
fi
debug () {
wget --quiet -O $tmp_dir/$1 $URL/debug/pprof/$2
}
echo "Generating profile traces..."
# trace calls
debug trace.out trace?seconds=30
# cpu profile
debug profile.out profile?seconds=30
# heap profile
debug heap.out heap
name=$(hostname)-$(date '+%Y-%m-%d-%s')
tar -zcf "$name.tar.gz" -C $tmp_dir .
echo "Please send us the file '$name'"
@Leon-Africa
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment