type MutatorUtil … type UtilFlags … const UtilSTW … const UtilBackground … const UtilAssist … const UtilSweep … const UtilPerProc … // MutatorUtilizationV2 returns a set of mutator utilization functions // for the given v2 trace, passed as an io.Reader. Each function will // always end with 0 utilization. The bounds of each function are implicit // in the first and last event; outside of these bounds each function is // undefined. // // If the UtilPerProc flag is not given, this always returns a single // utilization function. Otherwise, it returns one function per P. func MutatorUtilizationV2(events []Event, flags UtilFlags) [][]MutatorUtil { … } func addUtil(util []MutatorUtil, mu MutatorUtil) []MutatorUtil { … } type totalUtil … func totalUtilOf(meanUtil float64, dur int64) totalUtil { … } // mean returns the mean utilization over dur. func (u totalUtil) mean(dur time.Duration) float64 { … } type MMUCurve … type mmuSeries … type mmuBand … // NewMMUCurve returns an MMU curve for the given mutator utilization // function. func NewMMUCurve(utils [][]MutatorUtil) *MMUCurve { … } var bandsPerSeries … func newMMUSeries(util []MutatorUtil) mmuSeries { … } func (s *mmuSeries) bandTime(i int) (start, end int64) { … } type bandUtil … type bandUtilHeap … func (h bandUtilHeap) Len() int { … } func (h bandUtilHeap) Less(i, j int) bool { … } func (h bandUtilHeap) Swap(i, j int) { … } func (h *bandUtilHeap) Push(x any) { … } func (h *bandUtilHeap) Pop() any { … } type UtilWindow … type utilHeap … func (h utilHeap) Len() int { … } func (h utilHeap) Less(i, j int) bool { … } func (h utilHeap) Swap(i, j int) { … } func (h *utilHeap) Push(x any) { … } func (h *utilHeap) Pop() any { … } type accumulator … // resetTime declares a discontinuity in the windowed mutator // utilization function by resetting the current time. func (acc *accumulator) resetTime() { … } // addMU adds a point to the windowed mutator utilization function at // (time, mu). This must be called for monotonically increasing values // of time. // // It returns true if further calls to addMU would be pointless. func (acc *accumulator) addMU(time int64, mu float64, window time.Duration) bool { … } // MMU returns the minimum mutator utilization for the given time // window. This is the minimum utilization for all windows of this // duration across the execution. The returned value is in the range // [0, 1]. func (c *MMUCurve) MMU(window time.Duration) (mmu float64) { … } // Examples returns n specific examples of the lowest mutator // utilization for the given window size. The returned windows will be // disjoint (otherwise there would be a huge number of // mostly-overlapping windows at the single lowest point). There are // no guarantees on which set of disjoint windows this returns. func (c *MMUCurve) Examples(window time.Duration, n int) (worst []UtilWindow) { … } // MUD returns mutator utilization distribution quantiles for the // given window size. // // The mutator utilization distribution is the distribution of mean // mutator utilization across all windows of the given window size in // the trace. // // The minimum mutator utilization is the minimum (0th percentile) of // this distribution. (However, if only the minimum is desired, it's // more efficient to use the MMU method.) func (c *MMUCurve) MUD(window time.Duration, quantiles []float64) []float64 { … } func (c *MMUCurve) mmu(window time.Duration, acc *accumulator) { … } func (c *mmuSeries) mkBandUtil(series int, window time.Duration) []bandUtil { … } // bandMMU computes the precise minimum mutator utilization for // windows with a left edge in band bandIdx. func (c *mmuSeries) bandMMU(bandIdx int, window time.Duration, acc *accumulator) { … } type integrator … // advance returns the integral of the utilization function from 0 to // time. advance must be called on monotonically increasing values of // times. func (in *integrator) advance(time int64) totalUtil { … } // next returns the smallest time t' > time of a change in the // utilization function. func (in *integrator) next(time int64) int64 { … } func isGCSTW(r Range) bool { … } func isGCMarkAssist(r Range) bool { … } func isGCSweep(r Range) bool { … }