aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/export_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/export_test.go')
-rw-r--r--src/runtime/export_test.go20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/runtime/export_test.go b/src/runtime/export_test.go
index c29d64a885..93cae48211 100644
--- a/src/runtime/export_test.go
+++ b/src/runtime/export_test.go
@@ -1228,22 +1228,28 @@ func MSpanCountAlloc(ms *MSpan, bits []byte) int {
}
const (
- TimeHistSubBucketBits = timeHistSubBucketBits
- TimeHistNumSubBuckets = timeHistNumSubBuckets
- TimeHistNumSuperBuckets = timeHistNumSuperBuckets
+ TimeHistSubBucketBits = timeHistSubBucketBits
+ TimeHistNumSubBuckets = timeHistNumSubBuckets
+ TimeHistNumBuckets = timeHistNumBuckets
+ TimeHistMinBucketBits = timeHistMinBucketBits
+ TimeHistMaxBucketBits = timeHistMaxBucketBits
)
type TimeHistogram timeHistogram
// Counts returns the counts for the given bucket, subBucket indices.
// Returns true if the bucket was valid, otherwise returns the counts
-// for the underflow bucket and false.
-func (th *TimeHistogram) Count(bucket, subBucket uint) (uint64, bool) {
+// for the overflow bucket if bucket > 0 or the underflow bucket if
+// bucket < 0, and false.
+func (th *TimeHistogram) Count(bucket, subBucket int) (uint64, bool) {
t := (*timeHistogram)(th)
- i := bucket*TimeHistNumSubBuckets + subBucket
- if i >= uint(len(t.counts)) {
+ if bucket < 0 {
return t.underflow.Load(), false
}
+ i := bucket*TimeHistNumSubBuckets + subBucket
+ if i >= len(t.counts) {
+ return t.overflow.Load(), false
+ }
return t.counts[i].Load(), true
}