Skip to content

Commit

Permalink
Benchmark: plot go pprof profiles for a given directory
Browse files Browse the repository at this point in the history
Co-authored-by: Martin Evgeniev <[email protected]>
Co-authored-by: pancho horrilo <[email protected]>
  • Loading branch information
suizman and panchoh committed Dec 4, 2018
1 parent 16be7e3 commit 57be27b
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
42 changes: 42 additions & 0 deletions tests/make_graph
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env sh

# Copyright 2018 Banco Bilbao Vizcaya Argentaria, S.A.

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

# http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

pattern="$1"
dir="$2"
metric="$3"

case $3 in
cum|c)
parse='$6'
;;
flat|f)
parse='$5'
PPROF_EXTRA_ARGS='-unit ms'
;;
*)
echo "Usage: $0 pattern metrics_dir percent|time"
exit 1
;;
esac

profiles='cpu'

(for prof in $(find $dir -type f -name "*$profiles*.pb.gz" | sort )
do
x=$(echo "$prof" | cut -d- -f2)
y=$(go tool pprof -top $PPROF_EXTRA_ARGS -show "$pattern" "$prof" 2>/dev/null | awk "/^Showing nodes accounting for / { print $parse }" | tr -d '%,' )
echo $x $y
done) | gnuplot -e 'set terminal dumb; plot "-" using 1:2 with lines; pause -1'
2 changes: 1 addition & 1 deletion tests/stress
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@


./start_server
./start_profiler
./start_profiler &

go run riot.go "$@"

Expand Down

0 comments on commit 57be27b

Please sign in to comment.