mirror of https://github.com/golang/go.git
runtime: remove nextSampleNoFP from plan9
Plan 9 can use floating point now. Change-Id: If721b243daa31853609cb3d2c535d86c106a1ee1 Reviewed-on: https://go-review.googlesource.com/c/go/+/655879 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Russ Cox <rsc@golang.org>
This commit is contained in:
parent
d037ed62bc
commit
40c953cd46
|
|
@ -1815,13 +1815,6 @@ func nextSample() int64 {
|
||||||
// Sample immediately.
|
// Sample immediately.
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
if GOOS == "plan9" {
|
|
||||||
// Plan 9 doesn't support floating point in note handler.
|
|
||||||
if gp := getg(); gp == gp.m.gsignal {
|
|
||||||
return nextSampleNoFP()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return int64(fastexprand(MemProfileRate))
|
return int64(fastexprand(MemProfileRate))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1855,20 +1848,6 @@ func fastexprand(mean int) int32 {
|
||||||
return int32(qlog*(minusLog2*float64(mean))) + 1
|
return int32(qlog*(minusLog2*float64(mean))) + 1
|
||||||
}
|
}
|
||||||
|
|
||||||
// nextSampleNoFP is similar to nextSample, but uses older,
|
|
||||||
// simpler code to avoid floating point.
|
|
||||||
func nextSampleNoFP() int64 {
|
|
||||||
// Set first allocation sample size.
|
|
||||||
rate := MemProfileRate
|
|
||||||
if rate > 0x3fffffff { // make 2*rate not overflow
|
|
||||||
rate = 0x3fffffff
|
|
||||||
}
|
|
||||||
if rate != 0 {
|
|
||||||
return int64(cheaprandn(uint32(2 * rate)))
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
type persistentAlloc struct {
|
type persistentAlloc struct {
|
||||||
base *notInHeap
|
base *notInHeap
|
||||||
off uintptr
|
off uintptr
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue