type SamplesBuffer … // Initializes an empty buffer. func NewSamplesBuffer(size int) *SamplesBuffer { … } // Returns the current number of samples in the buffer. func (s *SamplesBuffer) Size() int { … } // Add an element to the buffer. Oldest one is overwritten if required. func (s *SamplesBuffer) Add(stat info.Usage) { … } // Returns pointers to the last 'n' stats. func (s *SamplesBuffer) RecentStats(n int) []*info.Usage { … }