mirror of
https://github.com/gravitational/teleport.git
synced 2026-10-11 22:49:54 +00:00
[v17][tools] add benchstat tool (#63893)
Backports #63694 to branch/v17
This commit is contained in:
@@ -976,16 +976,18 @@ endif
|
||||
.PHONY: test-go-bench
|
||||
test-go-bench: PACKAGES = $(shell grep --exclude-dir api --include "*_test.go" -lr testing.B . | xargs dirname | xargs go list | sort -u)
|
||||
test-go-bench: BENCHMARK_SKIP_PATTERN = "^BenchmarkRoot"
|
||||
test-go-bench: BENCH_OUTPUT ?= $(TEST_LOG_DIR)/bench.txt
|
||||
test-go-bench: | $(TEST_LOG_DIR)
|
||||
go test -run ^$$ -bench . -skip $(BENCHMARK_SKIP_PATTERN) -benchtime 1x $(PACKAGES) \
|
||||
| tee $(TEST_LOG_DIR)/bench.txt
|
||||
| tee $(BENCH_OUTPUT)
|
||||
|
||||
test-go-bench-root: PACKAGES = $(shell grep --exclude-dir api --include "*_test.go" -lr BenchmarkRoot . | xargs dirname | xargs go list | sort -u)
|
||||
test-go-bench-root: BENCHMARK_PATTERN = "^BenchmarkRoot"
|
||||
test-go-bench-root: BENCHMARK_SKIP_PATTERN = ""
|
||||
test-go-bench-root: BENCH_OUTPUT ?= $(TEST_LOG_DIR)/bench.txt
|
||||
test-go-bench-root: | $(TEST_LOG_DIR)
|
||||
go test -run ^$$ -bench $(BENCHMARK_PATTERN) -skip $(BENCHMARK_SKIP_PATTERN) -benchtime 1x $(PACKAGES) \
|
||||
| tee $(TEST_LOG_DIR)/bench.txt
|
||||
| tee $(BENCH_OUTPUT)
|
||||
|
||||
# Make sure untagged vnetdaemon code build/tests.
|
||||
.PHONY: test-go-vnet-daemon
|
||||
@@ -1937,3 +1939,10 @@ gen-docs:
|
||||
$(MAKE) -C integrations/terraform docs
|
||||
$(MAKE) -C integrations/operator crd-docs
|
||||
$(MAKE) -C examples/chart render-chart-ref
|
||||
|
||||
.PHONY: benchstat
|
||||
benchstat:
|
||||
ifndef BENCH_FILES
|
||||
$(error "Please provide BENCH_FILES=<file1> <file2> ...")
|
||||
endif
|
||||
@$(BENCHSTAT) $(BENCH_FILES) | tee test-logs/benchstat.txt
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
module github.com/gravitational/teleport/build.assets/tools/benchstat
|
||||
|
||||
go 1.25.7
|
||||
|
||||
tool golang.org/x/perf/cmd/benchstat
|
||||
|
||||
require (
|
||||
github.com/aclements/go-moremath v0.0.0-20241023150245-c8bbc672ef66 // indirect
|
||||
golang.org/x/perf v0.0.0-20260211190930-8161c38c6cdc // indirect
|
||||
)
|
||||
@@ -0,0 +1,4 @@
|
||||
github.com/aclements/go-moremath v0.0.0-20241023150245-c8bbc672ef66 h1:siNQlUMcFUDZWCOt0p+RHl7et5Nnwwyq/sFZmr4iG1I=
|
||||
github.com/aclements/go-moremath v0.0.0-20241023150245-c8bbc672ef66/go.mod h1:FDw7qicTbJ1y1SZcNnOvym2BogPdC3lY9Z1iUM4MVhw=
|
||||
golang.org/x/perf v0.0.0-20260211190930-8161c38c6cdc h1:sIFroTtzaCeprqS7v3ElN+EmHd/s6c1csQ9AcPq/zWU=
|
||||
golang.org/x/perf v0.0.0-20260211190930-8161c38c6cdc/go.mod h1:z/K43VgoJkBLXbImpHAD2mvxECFj2bgN5phU37hHDoA=
|
||||
@@ -117,3 +117,4 @@ TOOLS_DIR := $(abspath $(COMMON_MK_DIR)/build.assets/tools)
|
||||
GOTESTSUM = "$$( GOWORK=off go -C $(TOOLS_DIR)/gotestsum tool -n gotestsum )"
|
||||
GCI = "$$( GOWORK=off go -C $(TOOLS_DIR)/gci tool -n gci )"
|
||||
GODA = "$$( GOWORK=off go -C $(TOOLS_DIR)/goda tool -n goda )"
|
||||
BENCHSTAT = "$$( GOWORK=off go -C $(TOOLS_DIR)/benchstat tool -n benchstat )"
|
||||
|
||||
Reference in New Issue
Block a user