26 #include <glog/logging.h> 52 template <
typename VT,
typename CT = LegacyStatsClock<std::chrono::seconds>>
79 std::initializer_list<Duration> durations);
104 CHECK_LT(level,
levels_.size());
117 for (
const auto& level :
levels_) {
118 if (level.isAllTime()) {
125 if (level.getLatestTime() - level.duration() <=
start) {
130 LOG(
FATAL) <<
"No level of timeseries covers internval" 131 <<
" from " << start.time_since_epoch().
count() <<
" to now";
132 return levels_.back();
146 for (
const auto& level :
levels_) {
147 if (level.duration() == duration) {
151 throw std::out_of_range(folly::to<std::string>(
152 "No level of duration ", duration.count(),
" found"));
177 template <
typename ReturnType =
double>
178 ReturnType
avg(
size_t level)
const {
179 return getLevel(level).template avg<ReturnType>();
190 template <
typename ReturnType =
double,
typename Interval = Duration>
191 ReturnType
rate(
size_t level)
const {
192 return getLevel(level).template rate<ReturnType, Interval>();
213 template <
typename ReturnType =
double,
typename Interval = Duration>
215 return getLevel(level).template countRate<ReturnType, Interval>();
243 template <
typename ReturnType =
double>
259 template <
typename ReturnType =
double,
typename Interval = Duration>
288 template <
typename ReturnType =
double,
typename Interval = Duration>
291 .template countRate<ReturnType, Interval>();
326 template <
typename ReturnType =
double>
341 template <
typename ReturnType =
double>
void addValueAggregated(TimePoint now, const ValueType &total, uint64_t nsamples)
size_t numBuckets() const
void addValue(Duration now, const ValueType &value, uint64_t times)
const Level & getLevel(TimePoint start) const
void update(Duration now)
std::chrono::steady_clock::time_point now()
—— Concurrent Priority Queue Implementation ——
ReturnType avg(size_t level) const
uint64_t count(TimePoint start, TimePoint end) const
ReturnType avg(Duration duration) const
ValueType sum(size_t level) const
uint64_t count(size_t level) const
auto end(TestAdlIterable &instance)
const ValueType & sum() const
ValueType sum(Duration duration) const
ReturnType rate(size_t level) const
ReturnType rate(Duration duration) const
const Level & getLevel(size_t level) const
ValueType sum(TimePoint start, TimePoint end) const
ReturnType countRate(size_t level) const
uint64_t count(Duration duration) const
void addValue(Duration now, const ValueType &value)
typename Clock::duration Duration
ReturnType avg(TimePoint start, TimePoint end) const
void addValue(TimePoint now, const ValueType &val)
ReturnType rate(TimePoint start, TimePoint end) const
uint64_t value(const typename LockFreeRingBuffer< T, Atom >::Cursor &rbcursor)
typename Clock::time_point TimePoint
void update(TimePoint now)
Future< Unit > times(const int n, F &&thunk)
const Level & getLevelByDuration(Duration duration) const
void addValueAggregated(Duration now, const ValueType &total, uint64_t nsamples)
ReturnType countRate(Duration duration) const
MultiLevelTimeSeries(size_t numBuckets, size_t numLevels, const Duration levelDurations[])
std::vector< Level > levels_