mirror of
https://github.com/golang/go.git
synced 2025-05-05 15:43:04 +00:00
cmd/compilebench: generate separate mem profiles when using -count
When the -count flag is provided, instead of having each run overwrite the previous profile, add a count suffix to the profile filename. Then you can combine the profiles with go tool pprof `go tool -n compile` <all profile files here> This was done for CPU profiles in https://golang.org/cl/39718. Change-Id: I4aa66d745fe18088655fc1d9cf3ecf29f68370bb Reviewed-on: https://go-review.googlesource.com/c/tools/+/166523 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
a10017ccd2
commit
4ccd092f47
@ -329,7 +329,11 @@ func runBuild(name, dir string, count int) {
|
||||
}
|
||||
|
||||
if *flagMemprofile != "" {
|
||||
if err := ioutil.WriteFile(*flagMemprofile, out, 0666); err != nil {
|
||||
outpath := *flagMemprofile
|
||||
if *flagCount != 1 {
|
||||
outpath = fmt.Sprintf("%s_%d", outpath, count)
|
||||
}
|
||||
if err := ioutil.WriteFile(outpath, out, 0666); err != nil {
|
||||
log.Print(err)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user