Skip to content

Commit

Permalink
Profiler now creates a result dir per IP addr
Browse files Browse the repository at this point in the history
  • Loading branch information
suizman committed Apr 8, 2019
1 parent 032a44e commit 1e16a79
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions tests/start_profiler
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
echo "export PROFILING_RATE_HZ=30 (in seconds) env variable to set the default profiling delay. Default profiling rate is 30. Output: results/cpu|mem.pb.gz"
IP=$1
: ${IP:=127.0.0.1}
DIR=results/${IP}

check_profiling() {
while ps ux | grep [p]prof > /dev/null
Expand All @@ -33,17 +34,17 @@ profiler_cmd() {
(BALLOON_VERSION=$(curl -s http://${IP}:6060/debug/vars | awk -F '"version": ' '/balloon_stats/ {print $2}' | tr -d '},')
# Avoid empty version because preload process is not already started...
: ${BALLOON_VERSION:=0}
go tool pprof -proto -sample_index=alloc_objects -output results/$(date +%s)-${BALLOON_VERSION}-mem-alloc-objects.pb.gz http://${IP}:6060/debug/pprof/heap
go tool pprof -proto -sample_index=alloc_space -output results/$(date +%s)-${BALLOON_VERSION}-mem-alloc-space-top.pb.gz http://${IP}:6060/debug/pprof/heap
go tool pprof -proto -sample_index=inuse_objects -output results/$(date +%s)-${BALLOON_VERSION}-mem-inuse-objects.pb.gz http://${IP}:6060/debug/pprof/heap
go tool pprof -proto -sample_index=inuse_space -output results/$(date +%s)-${BALLOON_VERSION}-mem-inuse-space-top.pb.gz http://${IP}:6060/debug/pprof/heap
go tool pprof -proto -seconds 60 -output results/$(date +%s)-${BALLOON_VERSION}-cpu-profile.pb.gz http://${IP}:6060) 2>&1 > /dev/null
go tool pprof -proto -sample_index=alloc_objects -output ${DIR}/$(date +%s)-${BALLOON_VERSION}-mem-alloc-objects.pb.gz http://${IP}:6060/debug/pprof/heap
go tool pprof -proto -sample_index=alloc_space -output ${DIR}/$(date +%s)-${BALLOON_VERSION}-mem-alloc-space-top.pb.gz http://${IP}:6060/debug/pprof/heap
go tool pprof -proto -sample_index=inuse_objects -output ${DIR}/$(date +%s)-${BALLOON_VERSION}-mem-inuse-objects.pb.gz http://${IP}:6060/debug/pprof/heap
go tool pprof -proto -sample_index=inuse_space -output ${DIR}/$(date +%s)-${BALLOON_VERSION}-mem-inuse-space-top.pb.gz http://${IP}:6060/debug/pprof/heap
go tool pprof -proto -seconds 60 -output ${DIR}/$(date +%s)-${BALLOON_VERSION}-cpu-profile.pb.gz http://${IP}:6060) 2>&1 > /dev/null
sleep $PROFILING_RATE_HZ
done
}

: ${PROFILING_RATE_HZ:=30}
mkdir -p results
mkdir -p ${DIR}
echo "PROFILING_RATE_HZ=${PROFILING_RATE_HZ}s"
echo "IP=$IP"
profiler_cmd
Expand Down

0 comments on commit 1e16a79

Please sign in to comment.