work.tMark = now
// Update the CPU stats pause time.
- work.cpuStats.accumulateGCPauseTime(now-work.tSweepTerm, work.stwprocs)
+ //
+ // Use maxprocs instead of stwprocs here because the total time
+ // computed in the CPU stats is based on maxprocs, and we want them
+ // to be comparable.
+ work.cpuStats.accumulateGCPauseTime(now-work.tSweepTerm, work.maxprocs)
// Release the CPU limiter.
gcCPULimiter.finishGCTransition(now)
// Accumulate CPU stats.
//
- // Pass gcMarkPhase=true so we can get all the latest GC CPU stats in there too.
- work.cpuStats.accumulateGCPauseTime(work.tEnd-work.tMarkTerm, work.stwprocs)
+ // Use maxprocs instead of stwprocs for GC pause time because the total time
+ // computed in the CPU stats is based on maxprocs, and we want them to be
+ // comparable.
+ //
+ // Pass gcMarkPhase=true to accumulate so we can get all the latest GC CPU stats
+ // in there too.
+ work.cpuStats.accumulateGCPauseTime(work.tEnd-work.tMarkTerm, work.maxprocs)
work.cpuStats.accumulate(now, true)
// Compute overall GC CPU utilization.
}
// accumulateGCPauseTime add dt*stwProcs to the GC CPU pause time stats. dt should be
-// the actual time spent paused, for orthogonality. stwProcs should be GOMAXPROCS,
+// the actual time spent paused, for orthogonality. maxProcs should be GOMAXPROCS,
// not work.stwprocs, since this number must be comparable to a total time computed
// from GOMAXPROCS.
-func (s *cpuStats) accumulateGCPauseTime(dt int64, stwProcs int32) {
- cpu := dt * int64(stwProcs)
+func (s *cpuStats) accumulateGCPauseTime(dt int64, maxProcs int32) {
+ cpu := dt * int64(maxProcs)
s.gcPauseTime += cpu
s.gcTotalTime += cpu
}