Source File
garbage.go
Belonging Package
runtime/debug
package debug
import (
)
type GCStats struct {
LastGC time.Time // time of last collection
NumGC int64 // number of garbage collections
PauseTotal time.Duration // total pause for all collections
Pause []time.Duration // pause history, most recent first
PauseEnd []time.Time // pause end times history, most recent first
PauseQuantiles []time.Duration
}
readGCStats(&.Pause)
:= len(.Pause) - 3
.LastGC = time.Unix(0, int64(.Pause[]))
.NumGC = int64(.Pause[+1])
.PauseTotal = .Pause[+2]
/= 2 // buffer holds pauses and end times
.Pause = .Pause[:]
if cap(.PauseEnd) < {
.PauseEnd = make([]time.Time, 0, )
}
.PauseEnd = .PauseEnd[:0]
for , := range .Pause[ : +] {
.PauseEnd = append(.PauseEnd, time.Unix(0, int64()))
}
if len(.PauseQuantiles) > 0 {
if == 0 {
for := range .PauseQuantiles {
.PauseQuantiles[] = 0
}
:= .Pause[ : +]
copy(, .Pause)
sort.Slice(, func(, int) bool { return [] < [] })
:= len(.PauseQuantiles) - 1
for := 0; < ; ++ {
.PauseQuantiles[] = [len()*/]
}
.PauseQuantiles[] = [len()-1]
}
}
}
func ( int) int {
return int(setGCPercent(int32()))
}
func () {
freeOSMemory()
}
func ( int) int {
return setMaxStack()
}
func ( int) int {
return setMaxThreads()
}
func ( bool) bool {
return setPanicOnFault()
}
func ( uintptr)
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |