소스 검색

Better controlled update of debug.GCStats.Pause.

Richard Crowley 12 년 전
부모
커밋
2af3b6c997
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 1
      debug.go

+ 2 - 1
debug.go

@@ -21,11 +21,12 @@ func CaptureDebugGCStats(r Registry, interval int64) {
 // Giving a registry which has not been given to RegisterDebugGCStats will
 // panic.
 func CaptureDebugGCStatsOnce(r Registry) {
+	lastGC := gcStats.LastGC
 	debug.ReadGCStats(&gcStats)
 	r.Get("debug.GCStats.LastGC").(Gauge).Update(int64(gcStats.LastGC.UnixNano()))
 	r.Get("debug.GCStats.NumGC").(Gauge).Update(int64(gcStats.NumGC))
 	r.Get("debug.GCStats.PauseTotal").(Gauge).Update(int64(gcStats.PauseTotal))
-	if 0 < len(gcStats.Pause) {
+	if lastGC != gcStats.LastGC && 0 < len(gcStats.Pause) {
 		r.Get("debug.GCStats.Pause").(Histogram).Update(int64(gcStats.Pause[0]))
 	}
 	//r.Get("debug.GCStats.PauseQuantiles").(Histogram).Update(gcStats.PauseQuantiles)