From 7d7558ea11ae8b381d858c4d66f4b7217f807c5a Mon Sep 17 00:00:00 2001 From: Hiromi Suenaga <5401333+hiromis@users.noreply.github.com> Date: Wed, 11 Aug 2021 15:26:28 -0500 Subject: [PATCH] Minor updates for the existing benchmark process (#486) * Minor updates for the existing process. Signed-off-by: Hiromi Suenaga * Updating make clean to delete benchmark output folders Signed-off-by: Hiromi Suenaga * Removing `MODE=0` from `make integration` Signed-off-by: Hiromi Suenaga --- .gitignore | 2 ++ Makefile | 16 +++++++++------- benchmarks/README.md | 10 ++++++++++ build/do_benchmarks.sh | 3 +++ build/integration.sh | 2 +- 5 files changed, 25 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index b8f3fd263e..7996a18f43 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,5 @@ examples/dyplomat/dyplomat # Benchmarking artifacts *.gz *.pprof +/benchmarks/reports +/benchmarks/pngs diff --git a/Makefile b/Makefile index b60c1c007c..ef0dd7e3d7 100644 --- a/Makefile +++ b/Makefile @@ -20,6 +20,8 @@ clean: @rm -rf $(BINDIR) @rm -rf *.log @rm -rf *.pprof + @rm -rf benchmarks/reports + @rm -rf benchmarks/pngs # TODO(mattklein123): See the note in TestLinearConcurrentSetWatch() for why we set -parallel here # This should be removed. @@ -63,22 +65,22 @@ $(BINDIR)/test: integration: integration.xds integration.ads integration.rest integration.xds.mux integration.xds.delta integration.ads.delta integration.ads: $(BINDIR)/test $(BINDIR)/upstream - env XDS=ads MODE=0 build/integration.sh + env XDS=ads build/integration.sh integration.xds: $(BINDIR)/test $(BINDIR)/upstream - env XDS=xds MODE=0 build/integration.sh + env XDS=xds build/integration.sh integration.rest: $(BINDIR)/test $(BINDIR)/upstream - env XDS=rest MODE=0 build/integration.sh + env XDS=rest build/integration.sh integration.xds.mux: $(BINDIR)/test $(BINDIR)/upstream - env XDS=xds MODE=0 build/integration.sh -mux + env XDS=xds build/integration.sh -mux integration.xds.delta: $(BINDIR)/test $(BINDIR)/upstream - env XDS=delta MODE=0 build/integration.sh + env XDS=delta build/integration.sh integration.ads.delta: $(BINDIR)/test $(BINDIR)/upstream - env XDS=delta-ads MODE=0 build/integration.sh + env XDS=delta-ads build/integration.sh #------------------------------------------------------------------------------ @@ -86,7 +88,7 @@ integration.ads.delta: $(BINDIR)/test $(BINDIR)/upstream #------------------------------------------------------------------------------ .PHONY: benchmark docker_benchmarks benchmark: $(BINDIR)/test $(BINDIR)/upstream - env XDS=xds MODE=$(MODE) build/integration.sh + env XDS=xds build/integration.sh docker_benchmarks: docker build --pull -f Dockerfile.ci . -t gcp_ci && \ diff --git a/benchmarks/README.md b/benchmarks/README.md index 3c64c0d708..ea9489ca3c 100644 --- a/benchmarks/README.md +++ b/benchmarks/README.md @@ -38,6 +38,16 @@ const ( ``` To specifiy the mode, use `MODE` environment variable that corresponds to the output you wish to evaluate. +The output file will be stored at the project root with .pprof extension (e.g. `cpu.pprof`). + +Run `pprof` tool like so which will open up a shell. From there, you can run command such as `web` to visualize the result: + +```bash +go tool pprof cpu.pprof +(pprof) web +``` +For more information, run `help`. + ## Running With Docker To run the benchmarks, we just require the prerequisite of docker and go. diff --git a/build/do_benchmarks.sh b/build/do_benchmarks.sh index e8ed854287..5257a3bad9 100755 --- a/build/do_benchmarks.sh +++ b/build/do_benchmarks.sh @@ -21,6 +21,9 @@ make benchmark MODE=2 make benchmark MODE=3 make benchmark MODE=4 +mkdir -p benchmarks/reports +mkdir -p benchmarks/pngs + # generate our consumable pprof profiles pprof -text bin/test cpu.pprof > benchmarks/reports/cpu_text.txt pprof -tree bin/test cpu.pprof > benchmarks/reports/cpu_tree.txt diff --git a/build/integration.sh b/build/integration.sh index 936ec01a25..a1e8184dfb 100755 --- a/build/integration.sh +++ b/build/integration.sh @@ -14,7 +14,7 @@ MESSAGE=$'Hi, there!\n' XDS=${XDS:-ads} # pprof profiler mode -MODE=${MODE:0} +MODE=${MODE:-0} # Number of RTDS layers. if [ "$XDS" = "ads" ]; then