File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 11#include < algorithm>
2+ #include < iterator>
23#include < numeric>
34
45#include " prometheus/histogram.h"
@@ -10,10 +11,10 @@ Histogram::Histogram(const BucketBoundaries& buckets)
1011
1112void Histogram::Observe (double value) {
1213 // TODO: determine bucket list size at which binary search would be faster
13- auto bucket_index = std::max (
14- 0L , std::find_if ( bucket_boundaries_.begin (), bucket_boundaries_. end (),
15- [value]( double boundary) { return boundary > value; }) -
16- bucket_boundaries_. begin ( ));
14+ auto bucket_index = static_cast < std::size_t >( std::distance (
15+ bucket_boundaries_.begin (),
16+ std::find_if (bucket_boundaries_. begin (), bucket_boundaries_. end (),
17+ [value]( double boundary) { return boundary > value; }) ));
1718 sum_.Increment (value);
1819 bucket_counts_[bucket_index].Increment ();
1920}
You can’t perform that action at this time.
0 commit comments