mirror of
https://github.com/golang/go.git
synced 2026-06-28 03:40:37 +00:00
internal/goexperiment,runtime: drop goroutineleakprofile experiment
This is on by default now, and there's really no reason to turn it off (the "off" behavior is just that the new profile type doesn't get registered). Updates #74609. Change-Id: Ide8a3f3247c0ea72b14f66e0fdd78bca7080973f Reviewed-on: https://go-review.googlesource.com/c/go/+/774621 Reviewed-by: Georgian-Vlad Saioc <vsaioc@uber.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Austin Clements <austin@google.com> LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
3b7d571c99
commit
16449179ec
6 changed files with 18 additions and 59 deletions
|
|
@ -1,8 +0,0 @@
|
|||
// Code generated by mkconsts.go. DO NOT EDIT.
|
||||
|
||||
//go:build !goexperiment.goroutineleakprofile
|
||||
|
||||
package goexperiment
|
||||
|
||||
const GoroutineLeakProfile = false
|
||||
const GoroutineLeakProfileInt = 0
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
// Code generated by mkconsts.go. DO NOT EDIT.
|
||||
|
||||
//go:build goexperiment.goroutineleakprofile
|
||||
|
||||
package goexperiment
|
||||
|
||||
const GoroutineLeakProfile = true
|
||||
const GoroutineLeakProfileInt = 1
|
||||
|
|
@ -77,7 +77,6 @@ import (
|
|||
"fmt"
|
||||
"html"
|
||||
"internal/godebug"
|
||||
"internal/goexperiment"
|
||||
"internal/profile"
|
||||
"io"
|
||||
"log"
|
||||
|
|
@ -362,22 +361,17 @@ var profileSupportsDelta = map[handler]bool{
|
|||
}
|
||||
|
||||
var profileDescriptions = map[string]string{
|
||||
"allocs": "A sampling of all past memory allocations",
|
||||
"block": "Stack traces that led to blocking on synchronization primitives",
|
||||
"cmdline": "The command line invocation of the current program",
|
||||
"goroutine": "Stack traces of all current goroutines. Use debug=2 as a query parameter to export in the same format as an unrecovered panic.",
|
||||
"heap": "A sampling of memory allocations of live objects. You can specify the gc GET parameter to run GC before taking the heap sample.",
|
||||
"mutex": "Stack traces of holders of contended mutexes",
|
||||
"profile": "CPU profile. You can specify the duration in the seconds GET parameter. After you get the profile file, use the go tool pprof command to investigate the profile.",
|
||||
"symbol": "Maps given program counters to function names. Counters can be specified in a GET raw query or POST body, multiple counters are separated by '+'.",
|
||||
"threadcreate": "Stack traces that led to the creation of new OS threads",
|
||||
"trace": "A trace of execution of the current program. You can specify the duration in the seconds GET parameter. After you get the trace file, use the go tool trace command to investigate the trace.",
|
||||
}
|
||||
|
||||
func init() {
|
||||
if goexperiment.GoroutineLeakProfile {
|
||||
profileDescriptions["goroutineleak"] = "Stack traces of all leaked goroutines. Use debug=2 as a query parameter to export in the same format as an unrecovered panic."
|
||||
}
|
||||
"allocs": "A sampling of all past memory allocations",
|
||||
"block": "Stack traces that led to blocking on synchronization primitives",
|
||||
"cmdline": "The command line invocation of the current program",
|
||||
"goroutine": "Stack traces of all current goroutines. Use debug=2 as a query parameter to export in the same format as an unrecovered panic.",
|
||||
"heap": "A sampling of memory allocations of live objects. You can specify the gc GET parameter to run GC before taking the heap sample.",
|
||||
"mutex": "Stack traces of holders of contended mutexes",
|
||||
"profile": "CPU profile. You can specify the duration in the seconds GET parameter. After you get the profile file, use the go tool pprof command to investigate the profile.",
|
||||
"symbol": "Maps given program counters to function names. Counters can be specified in a GET raw query or POST body, multiple counters are separated by '+'.",
|
||||
"threadcreate": "Stack traces that led to the creation of new OS threads",
|
||||
"trace": "A trace of execution of the current program. You can specify the duration in the seconds GET parameter. After you get the trace file, use the go tool trace command to investigate the trace.",
|
||||
"goroutineleak": "Stack traces of all leaked goroutines. Use debug=2 as a query parameter to export in the same format as an unrecovered panic.",
|
||||
}
|
||||
|
||||
type profileEntry struct {
|
||||
|
|
|
|||
|
|
@ -194,21 +194,6 @@ func buildTestProg(t *testing.T, binary string, flags ...string) (string, error)
|
|||
cmd.Dir = "testdata/" + binary
|
||||
cmd = testenv.CleanCmdEnv(cmd)
|
||||
|
||||
// If tests need any experimental flags, add them here.
|
||||
//
|
||||
// TODO(vsaioc): Remove `goroutineleakprofile` once the feature is no longer experimental.
|
||||
edited := false
|
||||
for i := range cmd.Env {
|
||||
e := cmd.Env[i]
|
||||
if _, vars, ok := strings.Cut(e, "GOEXPERIMENT="); ok {
|
||||
cmd.Env[i] = "GOEXPERIMENT=" + vars + ",goroutineleakprofile"
|
||||
edited, _ = true, vars
|
||||
}
|
||||
}
|
||||
if !edited {
|
||||
cmd.Env = append(cmd.Env, "GOEXPERIMENT=goroutineleakprofile")
|
||||
}
|
||||
|
||||
out, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
target.err = fmt.Errorf("building %s %v: %v\n%s", binary, flags, err, out)
|
||||
|
|
|
|||
|
|
@ -509,7 +509,6 @@ func TestGoroutineLeakProfile(t *testing.T) {
|
|||
|
||||
cmdEnv := []string{
|
||||
"GODEBUG=asyncpreemptoff=1",
|
||||
"GOEXPERIMENT=goroutineleakprofile",
|
||||
}
|
||||
|
||||
if tcase.simple {
|
||||
|
|
|
|||
|
|
@ -80,7 +80,6 @@ import (
|
|||
"cmp"
|
||||
"fmt"
|
||||
"internal/abi"
|
||||
"internal/goexperiment"
|
||||
"internal/profilerecord"
|
||||
"io"
|
||||
"runtime"
|
||||
|
|
@ -257,15 +256,13 @@ func lockProfiles() {
|
|||
if profiles.m == nil {
|
||||
// Initial built-in profiles.
|
||||
profiles.m = map[string]*Profile{
|
||||
"goroutine": goroutineProfile,
|
||||
"threadcreate": threadcreateProfile,
|
||||
"heap": heapProfile,
|
||||
"allocs": allocsProfile,
|
||||
"block": blockProfile,
|
||||
"mutex": mutexProfile,
|
||||
}
|
||||
if goexperiment.GoroutineLeakProfile {
|
||||
profiles.m["goroutineleak"] = goroutineLeakProfile
|
||||
"goroutine": goroutineProfile,
|
||||
"threadcreate": threadcreateProfile,
|
||||
"heap": heapProfile,
|
||||
"allocs": allocsProfile,
|
||||
"block": blockProfile,
|
||||
"mutex": mutexProfile,
|
||||
"goroutineleak": goroutineLeakProfile,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue