Summary:
* Spend some extra time in getNumBuckets() in order to save
space: 8 bytes per object on 64-bit platforms.
Test Plan: Ran the unit tests
Reviewed By: simpkins@fb.com
Subscribers: ruibalp
FB internal diff:
D1488345
size_t numBuckets,
size_t numLevels,
const TimeType levelDurations[])
- : numBuckets_(numBuckets),
- cachedTime_(0),
+ : cachedTime_(0),
cachedSum_(0),
cachedCount_(0) {
CHECK_GT(numLevels, 0);
/*
* Return the number of buckets used to track time series at each level.
*/
- size_t numBuckets() const { return numBuckets_; }
+ size_t numBuckets() const {
+ // The constructor ensures that levels_ has at least one item
+ return levels_[0].numBuckets();
+ }
/*
* Return the number of levels tracked by MultiLevelTimeSeries.
void flush();
private:
- size_t numBuckets_;
std::vector<Level> levels_;
// Updates within the same time interval are cached