20 #include <glog/logging.h> 24 template <
typename VT,
typename CT>
29 : cachedTime_(), cachedSum_(0), cachedCount_(0) {
30 CHECK_GT(nLevels, 0u);
31 CHECK(levelDurations);
34 for (
size_t i = 0;
i < nLevels; ++
i) {
36 CHECK_EQ(
i, nLevels - 1);
38 CHECK(levelDurations[
i - 1] < levelDurations[
i]);
40 levels_.emplace_back(nBuckets, levelDurations[
i]);
44 template <
typename VT,
typename CT>
47 std::initializer_list<Duration> durations)
49 CHECK_GT(durations.size(), 0u);
51 levels_.reserve(durations.size());
54 for (
auto dur : durations) {
56 CHECK_EQ(i, durations.size() - 1);
60 levels_.emplace_back(nBuckets, dur);
66 template <
typename VT,
typename CT>
73 template <
typename VT,
typename CT>
81 template <
typename VT,
typename CT>
94 template <
typename VT,
typename CT>
102 template <
typename VT,
typename CT>
114 template <
typename VT,
typename CT>
void addValueAggregated(TimePoint now, const ValueType &total, uint64_t nsamples)
std::chrono::steady_clock::time_point now()
—— Concurrent Priority Queue Implementation ——
typename Clock::duration Duration
void addValue(TimePoint now, const ValueType &val)
typename Clock::time_point TimePoint
void update(TimePoint now)
Future< Unit > times(const int n, F &&thunk)
MultiLevelTimeSeries(size_t numBuckets, size_t numLevels, const Duration levelDurations[])
std::vector< Level > levels_