mirror of
https://github.com/golang/go
synced 2024-11-12 09:20:22 -07:00
runtime: Fix panic when trying to stop CPU profiling with profiler turned off
Fixes #7063. R=golang-codereviews, iant CC=golang-codereviews https://golang.org/cl/47950043
This commit is contained in:
parent
79653e4121
commit
aeeda707ff
@ -168,7 +168,7 @@ runtime·SetCPUProfileRate(intgo hz)
|
|||||||
runtime·noteclear(&prof->wait);
|
runtime·noteclear(&prof->wait);
|
||||||
|
|
||||||
runtime·setcpuprofilerate(tick, hz);
|
runtime·setcpuprofilerate(tick, hz);
|
||||||
} else if(prof->on) {
|
} else if(prof != nil && prof->on) {
|
||||||
runtime·setcpuprofilerate(nil, 0);
|
runtime·setcpuprofilerate(nil, 0);
|
||||||
prof->on = false;
|
prof->on = false;
|
||||||
|
|
||||||
|
@ -126,3 +126,8 @@ func TestRuntimeGogoBytes(t *testing.T) {
|
|||||||
|
|
||||||
t.Fatalf("go tool nm did not report size for runtime.gogo")
|
t.Fatalf("go tool nm did not report size for runtime.gogo")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// golang.org/issue/7063
|
||||||
|
func TestStopCPUProfilingWithProfilerOff(t *testing.T) {
|
||||||
|
SetCPUProfileRate(0)
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user