/*
- * Copyright 2014 Facebook, Inc.
+ * Copyright 2016 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* limitations under the License.
*/
-#ifndef FOLLY_STATS_MULTILEVELTIMESERIES_H_
-#define FOLLY_STATS_MULTILEVELTIMESERIES_H_
+#pragma once
#include <chrono>
#include <string>
/*
* 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.
* not been called recently.
*/
template <typename ReturnType=double, typename Interval=TimeType>
- ValueType rate(int level) const {
+ ReturnType rate(int level) const {
return getLevel(level).template rate<ReturnType, Interval>();
}
void flush();
private:
- size_t numBuckets_;
std::vector<Level> levels_;
// Updates within the same time interval are cached
};
} // folly
-
-#endif // FOLLY_STATS_MULTILEVELTIMESERIES_H_