diff --git a/cmd/compilebench/main.go b/cmd/compilebench/main.go index 029308a4..caa7051a 100644 --- a/cmd/compilebench/main.go +++ b/cmd/compilebench/main.go @@ -437,6 +437,7 @@ func runBuildCmd(name string, count int, dir, tool string, args []string) error } end := time.Now() + haveAllocs := false var allocs, allocbytes int64 if *flagAlloc || *flagMemprofile != "" { out, err := ioutil.ReadFile(dir + "/_compilebench_.memprof") @@ -452,6 +453,7 @@ func runBuildCmd(name string, count int, dir, tool string, args []string) error if err != nil { continue } + haveAllocs = true switch f[1] { case "TotalAlloc": allocbytes = val @@ -459,6 +461,9 @@ func runBuildCmd(name string, count int, dir, tool string, args []string) error allocs = val } } + if !haveAllocs { + log.Println("missing stats in memprof (golang.org/issue/18641)") + } if *flagMemprofile != "" { outpath := *flagMemprofile @@ -491,7 +496,7 @@ func runBuildCmd(name string, count int, dir, tool string, args []string) error userns := cmd.ProcessState.UserTime().Nanoseconds() fmt.Printf("%s 1 %d ns/op %d user-ns/op", name, wallns, userns) - if *flagAlloc { + if haveAllocs { fmt.Printf(" %d B/op %d allocs/op", allocbytes, allocs) }