...
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
9dir=$(mktemp -d)
10cd $dir
11seed=$(date)
12
13for 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
17done
18
19go tool pprof -proto prof.* > $(go env GOROOT)/src/cmd/compile/default.pgo
20
21rm -r $dir
View as plain text