Ich möchte Profil meine Benchmarks von go test -c
erzeugt, aber die go tool pprof
braucht eine Profildatei in der Regel innerhalb der Hauptfunktion wie this generiert:Wie profile Benchmarks mit dem Tool pprof?
func main() {
flag.Parse()
if *cpuprofile != "" {
f, err := os.Create(*cpuprofile)
if err != nil {
log.Fatal(err)
}
pprof.StartCPUProfile(f)
defer pprof.StopCPUProfile()
}
Wie kann ich eine Profildatei in meinem Benchmarks erstellen?
ein zusätzliches Stück, das nicht auf den ersten mir klar war, dass ein .test Datei erstellt wird für Sie pprof passieren –
neonstalwart