Ensure ewma int64s are always aligned. (#2675)

This commit is contained in:
Tom Wilkie 2017-05-03 20:32:50 +01:00 committed by Frederic Branczyk
parent 363554f675
commit e9787382b4
No known key found for this signature in database
GPG key ID: CA14788B1E48B256
2 changed files with 5 additions and 3 deletions

View file

@ -29,8 +29,10 @@ type ewmaRate struct {
mutex sync.Mutex
}
func newEWMARate(alpha float64, interval time.Duration) ewmaRate {
return ewmaRate{
// newEWMARate always allocates a new ewmaRate, as this guarantees the atomically
// accessed int64 will be aligned on ARM. See prometheus#2666.
func newEWMARate(alpha float64, interval time.Duration) *ewmaRate {
return &ewmaRate{
alpha: alpha,
interval: interval,
}

View file

@ -185,7 +185,7 @@ type QueueManager struct {
quit chan struct{}
wg sync.WaitGroup
samplesIn, samplesOut, samplesOutDuration ewmaRate
samplesIn, samplesOut, samplesOutDuration *ewmaRate
integralAccumulator float64
}