Skip to content

Commit

Permalink
add comment and refine code
Browse files Browse the repository at this point in the history
  • Loading branch information
liqiangz committed Jan 8, 2021
1 parent 752179d commit ee2c594
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/stat/base/metric_bucket.go
Expand Up @@ -34,7 +34,7 @@ type MetricBucket struct {
func NewMetricBucket() *MetricBucket {
mb := &MetricBucket{
minRt: base.DefaultStatisticMaxRt,
maxConcurrency: int32(0),
maxConcurrency: 0,
}
return mb
}
Expand Down Expand Up @@ -76,6 +76,7 @@ func (mb *MetricBucket) reset() {
func (mb *MetricBucket) AddRt(rt int64) {
mb.addCount(base.MetricEventRt, rt)
if rt < atomic.LoadInt64(&mb.minRt) {
// Might not be accurate here.
atomic.StoreInt64(&mb.minRt, rt)
}
}
Expand All @@ -87,6 +88,7 @@ func (mb *MetricBucket) MinRt() int64 {
func (mb *MetricBucket) UpdateConcurrency(concurrency int32) {
cc := concurrency
if cc > atomic.LoadInt32(&mb.maxConcurrency) {
// Might not be accurate here.
atomic.StoreInt32(&mb.maxConcurrency, cc)
}
}
Expand Down

0 comments on commit ee2c594

Please sign in to comment.