MCPcopy Create free account
hub / github.com/NetSys/bess / AtomicInsert

Method AtomicInsert

core/utils/histogram.h:107–113  ·  view source on GitHub ↗

Inserts x into the histogram. Note: this particular insert IS atomic.

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.80

Tested by

no test coverage detected