cmd/compilebench: add more linker benchmarking

Change-Id: I84ac9637b9d4221f38acbd2bfe8e1d1fc3097f48
Reviewed-on: https://go-review.googlesource.com/c/tools/+/194680
Run-TryBot: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
This commit is contained in:
Jeremy Faller 2019-09-11 10:24:31 -04:00
Родитель 16c5e0f7d1
Коммит 663385e6ef
1 изменённых файлов: 6 добавлений и 3 удалений

Просмотреть файл

@ -139,7 +139,9 @@ var tests = []test{
{"BenchmarkReflect", compile{"reflect"}},
{"BenchmarkTar", compile{"archive/tar"}},
{"BenchmarkXML", compile{"encoding/xml"}},
{"BenchmarkLinkCompiler", link{"cmd/compile"}},
{"BenchmarkLinkCompiler", link{"cmd/compile", ""}},
{"BenchmarkExternalLinkCompiler", link{"cmd/compile", "-linkmode=external"}},
{"BenchmarkLinkWithoutDebugCompiler", link{"cmd/compile", "-w"}},
{"BenchmarkStdCmd", goBuild{[]string{"std", "cmd"}}},
{"BenchmarkHelloSize", size{"$GOROOT/test/helloworld.go", false}},
{"BenchmarkCmdGoSize", size{"cmd/go", true}},
@ -200,7 +202,7 @@ func main() {
if *flagPackage != "" {
tests = []test{
{"BenchmarkPkg", compile{*flagPackage}},
{"BenchmarkPkgLink", link{*flagPackage}},
{"BenchmarkPkgLink", link{*flagPackage, ""}},
}
runRE = nil
}
@ -361,7 +363,7 @@ func (c compile) run(name string, count int) error {
return nil
}
type link struct{ dir string }
type link struct{ dir, flags string }
func (link) long() bool { return false }
@ -397,6 +399,7 @@ func (r link) run(name string, count int) error {
// Link the main package.
args = []string{"-o", "_compilebench_.exe"}
args = append(args, strings.Fields(*flagLinkerFlags)...)
args = append(args, strings.Fields(r.flags)...)
args = append(args, "_compilebench_.o")
if err := runBuildCmd(name, count, pkg.Dir, linker, args); err != nil {
return err