22 using namespace folly;
29 using duration = std::chrono::steady_clock::duration;
30 using time_point = std::chrono::steady_clock::time_point;
49 for (
auto it = r.
begin(); it != r.
end(); ++it) {
57 for (
auto it = r.
begin(); it != r.
end(); ++it) {
58 for (
auto value : it->values_) {
70 return values_.empty();
81 std::unique_ptr<BufferedDigest<SimpleDigest, MockClock>>
bd;
82 const size_t nBuckets = 60;
83 const size_t bufferSize = 1000;
84 const std::chrono::milliseconds bufferDuration{1000};
88 bd = std::make_unique<BufferedDigest<SimpleDigest, MockClock>>(
98 auto digest = bd->get();
109 auto digest = bd->get();
111 auto values = digest.getValues();
123 auto digest = bd->get();
129 auto values = digest.getValues();
139 values = digest.getValues();
147 values = digest.getValues();
156 std::unique_ptr<BufferedSlidingWindow<SimpleDigest, MockClock>>
bsw;
157 const size_t nBuckets = 60;
158 const size_t bufferSize = 1000;
159 const std::chrono::milliseconds windowDuration{1000};
163 bsw = std::make_unique<BufferedSlidingWindow<SimpleDigest, MockClock>>(
164 nBuckets, windowDuration, bufferSize,
kDigestSize);
173 auto digests = bsw->get();
184 auto digests = bsw->get();
189 for (
double i = 0;
i < 3; ++
i) {
200 auto digests = bsw->get();
205 digests = bsw->get();
208 for (
double i = 0;
i < 3; ++
i) {
216 digests = bsw->get();
219 for (
double i = 0;
i < 4; ++
i) {
226 digests = bsw->get();
229 for (
double i = 0;
i < 4; ++
i) {
235 digests = bsw->get();
239 EXPECT_EQ(4, digests[0].getValues().front());
242 for (
double i = 0;
i < 4; ++
i) {
252 auto digests = bsw->get();
265 auto digests = bsw->get();
279 auto digests = bsw->get();
288 auto digests = bsw->get();
std::vector< double > getValues() const
#define EXPECT_EQ(val1, val2)
—— Concurrent Priority Queue Implementation ——
SimpleDigest merge(Range< const double * > r) const
std::unique_ptr< BufferedDigest< SimpleDigest, MockClock > > bd
std::unique_ptr< BufferedSlidingWindow< SimpleDigest, MockClock > > bsw
constexpr auto size(C const &c) -> decltype(c.size())
TEST_F(StaticSingletonManagerTest, example)
static SimpleDigest merge(Range< const SimpleDigest * > r)
std::vector< double > values_
constexpr Iter end() const
constexpr Iter begin() const
#define EXPECT_TRUE(condition)
std::chrono::steady_clock::duration duration
uint64_t value(const typename LockFreeRingBuffer< T, Atom >::Cursor &rbcursor)
std::chrono::steady_clock::time_point time_point
std::vector< int > values(1'000)