Skip to content

Commit 1bfb35c

Browse files
committed
fixed assert failure when accepting time values close to 0
1 parent 3b8bd6a commit 1bfb35c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

include/pinba/histogram.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,13 +166,15 @@ struct histogram_t
166166
else
167167
{
168168
uint32_t bucket_id = d.nsec / conf.bucket_d.nsec;
169-
assert((bucket_id > 0) && "zero bucket is checked above");
170169

171170
if (bucket_id < conf.bucket_count)
172171
{
173172
// try fit exact upper-bound match to previous bucket
174-
if (d == bucket_id * conf.bucket_d)
175-
bucket_id -= 1;
173+
if (bucket_id > 0)
174+
{
175+
if (d == bucket_id * conf.bucket_d)
176+
bucket_id -= 1;
177+
}
176178

177179
map_[bucket_id] += increment_by;
178180
}

0 commit comments

Comments
 (0)