Inserts x into the histogram. Note: this particular insert IS atomic.
| 105 | // Inserts x into the histogram. |
| 106 | // Note: this particular insert IS atomic. |
| 107 | void AtomicInsert(T x) { |
| 108 | // The last element of the buckets_ is used to count data points above |
| 109 | // the upper bound of the histogram range. |
| 110 | size_t index = x / bucket_width_; |
| 111 | index = std::min(index, buckets_.size() - 1); |
| 112 | buckets_[index].fetch_add(1); |
| 113 | } |
| 114 | |
| 115 | // Returns the summary of the histogram. |
| 116 | // "percentiles" is a vector of doubles, whose values are in the range of |