github.com/bir3/gocompiler@v0.9.2202/src/cmd/compile/profile.sh (about) 1 # Copyright 2023 The Go Authors. All rights reserved. 2 # Use of this source code is governed by a BSD-style 3 # license that can be found in the LICENSE file. 4 5 # This script collects a CPU profile of the compiler 6 # for building all targets in std and cmd, and puts 7 # the profile at cmd/compile/default.pgo. 8 9 dir=$(mktemp -d) 10 cd $dir 11 seed=$(date) 12 13 for p in $(go list std cmd); do 14 h=$(echo $seed $p | md5sum | cut -d ' ' -f 1) 15 echo $p $h 16 go build -o /dev/null -gcflags=-cpuprofile=$PWD/prof.$h $p 17 done 18 19 go tool pprof -proto prof.* > $(go env GOROOT)/src/cmd/compile/default.pgo 20 21 rm -r $dir