Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Merge pull request #13 from taylorchu/master
Browse files Browse the repository at this point in the history
Add NextGC
  • Loading branch information
codahale committed Dec 16, 2015
2 parents 7c37910 + ee8a524 commit dbbe668
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions runtime/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// Mem.NumGC
// Mem.PauseTotalNs
// Mem.LastGC
// Mem.NextGC
// Mem.Alloc
// Mem.HeapObjects
// Goroutines.Num
Expand Down
5 changes: 5 additions & 0 deletions runtime/memstats.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ func init() {
metrics.Gauge("Mem.LastGC").SetBatchFunc(key{}, msg.init, msg.lastPause)
metrics.Gauge("Mem.Alloc").SetBatchFunc(key{}, msg.init, msg.alloc)
metrics.Gauge("Mem.HeapObjects").SetBatchFunc(key{}, msg.init, msg.objects)
metrics.Gauge("Mem.NextGC").SetBatchFunc(key{}, msg.init, msg.nextGC)
}

type key struct{} // unexported to prevent collision
Expand Down Expand Up @@ -46,3 +47,7 @@ func (msg *memStatGauges) alloc() int64 {
func (msg *memStatGauges) objects() int64 {
return int64(msg.stats.HeapObjects)
}

func (msg *memStatGauges) nextGC() int64 {
return int64(msg.stats.NextGC)
}
1 change: 1 addition & 0 deletions runtime/memstats_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ func TestMemStats(t *testing.T) {
"Mem.LastGC",
"Mem.Alloc",
"Mem.HeapObjects",
"Mem.NextGC",
}

for _, name := range expectedCounters {
Expand Down

0 comments on commit dbbe668

Please sign in to comment.