File tree Expand file tree Collapse file tree 1 file changed +16
-19
lines changed
Expand file tree Collapse file tree 1 file changed +16
-19
lines changed Original file line number Diff line number Diff line change 1717 enable_pprof :
1818 description : ' Generate CPU/Memory pprof for benchmarks (true/false)'
1919 required : false
20- default : ' false'
21- type : string
20+ default : ' true'
21+ type : choice
22+ options :
23+ - ' true'
24+ - ' false'
2225
2326jobs :
2427 ci :
@@ -62,23 +65,17 @@ jobs:
6265 - name : Run Benchmarks
6366 run : |
6467 echo "=== Running Benchmarks ==="
65- go test -bench='${{ inputs.benchmark_pattern }}' \
66- -benchmem \
67- -count=${{ inputs.benchmark_count }} \
68- -cpu=1,2 \
69- ./... | tee benchmark-results.txt
70-
71- - name : Run Benchmarks with pprof
72- if : ${{ inputs.enable_pprof == 'true' }}
73- run : |
74- echo "=== Running Benchmarks with pprof ==="
75- go test -run='^$' -bench='${{ inputs.benchmark_pattern }}' \
76- -benchmem \
77- -count=1 \
78- -cpuprofile=cpu.pprof \
79- -memprofile=mem.pprof \
80- -cpu=1,2 \
81- .
68+ if [ "${{ inputs.enable_pprof }}" = "true" ]; then
69+ COUNT=1
70+ PKG="."
71+ ARGS=(-run "^$" -cpuprofile=cpu.pprof -memprofile=mem.pprof)
72+ else
73+ COUNT="${{ inputs.benchmark_count }}"
74+ PKG="./..."
75+ ARGS=()
76+ fi
77+ ARGS+=(-bench='${{ inputs.benchmark_pattern }}' -benchmem -count="${COUNT}" -cpu=1,2 "${PKG}")
78+ go test "${ARGS[@]}" | tee benchmark-results.txt
8279
8380 - name : Upload Benchmark Results
8481 uses : actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
You can’t perform that action at this time.
0 commit comments