Skip to content

Commit 518248c

Browse files
committed
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 <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]>
1 parent 8147801 commit 518248c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

cmd/compilebench/main.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@
3737
// -obj
3838
// Report object file statistics.
3939
//
40+
// -pkg
41+
// Benchmark compiling a single package.
42+
//
4043
// -run regexp
4144
// Only run benchmarks with names matching regexp.
4245
//
@@ -96,6 +99,7 @@ var (
9699
flagCpuprofile = flag.String("cpuprofile", "", "write CPU profile to `file`")
97100
flagMemprofile = flag.String("memprofile", "", "write memory profile to `file`")
98101
flagMemprofilerate = flag.Int64("memprofilerate", -1, "set memory profile `rate`")
102+
flagPackage = flag.String("pkg", "", "if set, benchmark the package at path `pkg`")
99103
flagShort = flag.Bool("short", false, "skip long-running benchmarks")
100104
)
101105

@@ -158,6 +162,10 @@ func main() {
158162
}
159163

160164
for i := 0; i < *flagCount; i++ {
165+
if *flagPackage != "" {
166+
runBuild("BenchmarkPkg", *flagPackage, i)
167+
continue
168+
}
161169
for _, tt := range tests {
162170
if tt.long && *flagShort {
163171
continue

0 commit comments

Comments
 (0)