diff options
author | Ian Lance Taylor <iant@golang.org> | 2020-12-23 09:57:37 -0800 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2020-12-30 15:13:24 -0800 |
commit | cfcbb4227fb20191e04eb8d7766ae6202f526afd (patch) | |
tree | e2effea96f6f204451779f044415c2385e45042b /libgo/go/testing/benchmark.go | |
parent | 0696141107d61483f38482b941549959a0d7f613 (diff) | |
download | gcc-cfcbb4227fb20191e04eb8d7766ae6202f526afd.zip gcc-cfcbb4227fb20191e04eb8d7766ae6202f526afd.tar.gz gcc-cfcbb4227fb20191e04eb8d7766ae6202f526afd.tar.bz2 |
libgo: update to Go1.16beta1 release
This does not yet include support for the //go:embed directive added
in this release.
* Makefile.am (check-runtime): Don't create check-runtime-dir.
(mostlyclean-local): Don't remove check-runtime-dir.
(check-go-tool, check-vet): Copy in go.mod and modules.txt.
(check-cgo-test, check-carchive-test): Add go.mod file.
* Makefile.in: Regenerate.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/280172
Diffstat (limited to 'libgo/go/testing/benchmark.go')
-rw-r--r-- | libgo/go/testing/benchmark.go | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/libgo/go/testing/benchmark.go b/libgo/go/testing/benchmark.go index e9687bf..a8f75e9 100644 --- a/libgo/go/testing/benchmark.go +++ b/libgo/go/testing/benchmark.go @@ -8,6 +8,7 @@ import ( "flag" "fmt" "internal/race" + "internal/sysinfo" "io" "math" "os" @@ -262,6 +263,9 @@ func (b *B) run() { if b.importPath != "" { fmt.Fprintf(b.w, "pkg: %s\n", b.importPath) } + if cpu := sysinfo.CPU.Name(); cpu != "" { + fmt.Fprintf(b.w, "cpu: %s\n", cpu) + } }) if b.context != nil { // Running go test --test.bench @@ -447,23 +451,27 @@ func (r BenchmarkResult) String() string { func prettyPrint(w io.Writer, x float64, unit string) { // Print all numbers with 10 places before the decimal point - // and small numbers with three sig figs. + // and small numbers with four sig figs. Field widths are + // chosen to fit the whole part in 10 places while aligning + // the decimal point of all fractional formats. var format string switch y := math.Abs(x); { - case y == 0 || y >= 99.95: + case y == 0 || y >= 999.95: format = "%10.0f %s" - case y >= 9.995: + case y >= 99.995: format = "%12.1f %s" - case y >= 0.9995: + case y >= 9.9995: format = "%13.2f %s" - case y >= 0.09995: + case y >= 0.99995: format = "%14.3f %s" - case y >= 0.009995: + case y >= 0.099995: format = "%15.4f %s" - case y >= 0.0009995: + case y >= 0.0099995: format = "%16.5f %s" - default: + case y >= 0.00099995: format = "%17.6f %s" + default: + format = "%18.7f %s" } fmt.Fprintf(w, format, x, unit) } @@ -648,6 +656,9 @@ func (b *B) Run(name string, f func(b *B)) bool { if b.importPath != "" { fmt.Printf("pkg: %s\n", b.importPath) } + if cpu := sysinfo.CPU.Name(); cpu != "" { + fmt.Printf("cpu: %s\n", cpu) + } }) fmt.Println(benchName) |