cmd/bench: emit builder name as benchmark key

The purpose of emitting the builder name is to help group results
together further down the pipeline, specifically to produce a useful
geomean.

Change-Id: I99c04012ba48e795768b824d073f84af303dcfc3
Reviewed-on: https://go-review.googlesource.com/c/benchmarks/+/627516
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
diff --git a/cmd/bench/main.go b/cmd/bench/main.go
index 7da8fe9..cdb9b7c 100644
--- a/cmd/bench/main.go
+++ b/cmd/bench/main.go
@@ -31,6 +31,7 @@
 	repository        = flag.String("repository", "", "repository name of the commits we're testing against (default $BENCH_REPOSITORY or 'go')")
 	subRepoExperiment = flag.String("subrepo", "", "Sub-repo dir to test (default $BENCH_SUBREPO_PATH)")
 	subRepoBaseline   = flag.String("subrepo-baseline", "", "Sub-repo baseline to test against (default $BENCH_SUBREPO_BASELINE_PATH)")
+	builderName       = flag.String("builder", "", "The name of the CI builder the benchmarks were produced on (default $GO_BUILDER_NAME)")
 )
 
 func determineGOROOT() (string, error) {
@@ -170,6 +171,15 @@
 	}
 	fmt.Printf("branch: %s\n", branch)
 
+	// Try to identify the builder. Just omit the key if there isn't one.
+	builder := *builderName
+	if builder == "" {
+		builder = os.Getenv("GO_BUILDER_NAME")
+	}
+	if builder != "" {
+		fmt.Printf("builder: %s\n", builder)
+	}
+
 	subRepoExperiment := *subRepoExperiment
 	if subRepoExperiment == "" {
 		subRepoExperiment = os.Getenv("BENCH_SUBREPO_PATH")