From 518248cfad0199b1145f2d761110fd670b4bdb86 Mon Sep 17 00:00:00 2001 From: Josh Bleecher Snyder Date: Mon, 24 Apr 2017 17:28:29 -0700 Subject: [PATCH] cmd/compilebench: add -pkg flag to compile a single package Sometimes, as with CL 41493, or when investigating a reported issue, there's a package of interest that is not part of the standard compilebench suite. Add a -pkg flag to allow easy access to the compilebench set of goodies (allocs, object file stats) without having to edit and reinstall compilebench itself, which is what I have been doing. Change-Id: Id6ca6356cae062208f8686c0cb597ed45fc861c0 Reviewed-on: https://go-review.googlesource.com/41627 Run-TryBot: Josh Bleecher Snyder TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick --- cmd/compilebench/main.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmd/compilebench/main.go b/cmd/compilebench/main.go index 6869db5d23..e04bd61fe5 100644 --- a/cmd/compilebench/main.go +++ b/cmd/compilebench/main.go @@ -37,6 +37,9 @@ // -obj // Report object file statistics. // +// -pkg +// Benchmark compiling a single package. +// // -run regexp // Only run benchmarks with names matching regexp. // @@ -96,6 +99,7 @@ var ( flagCpuprofile = flag.String("cpuprofile", "", "write CPU profile to `file`") flagMemprofile = flag.String("memprofile", "", "write memory profile to `file`") flagMemprofilerate = flag.Int64("memprofilerate", -1, "set memory profile `rate`") + flagPackage = flag.String("pkg", "", "if set, benchmark the package at path `pkg`") flagShort = flag.Bool("short", false, "skip long-running benchmarks") ) @@ -158,6 +162,10 @@ func main() { } for i := 0; i < *flagCount; i++ { + if *flagPackage != "" { + runBuild("BenchmarkPkg", *flagPackage, i) + continue + } for _, tt := range tests { if tt.long && *flagShort { continue