1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
#!/bin/bash
# cleanup the profile directory before starting
rm -fr profile
# profile each supported package
for what in "list" "progress" "table"
do
echo "Profiling ${what} ..."
mkdir -p profile/${what}
go build -o profile/${what}/${what} cmd/profile-${what}/profile.go
(cd profile/${what} && \
./${what} && \
go tool pprof -pdf ${what} cpu.pprof > ../${what}.cpu.pdf && \
go tool pprof -pdf ${what} mem.pprof > ../${what}.mem.pdf)
echo "Profiling ${what} ... done!"
echo
done
ls -al profile/*.pdf
|