|
proxygen
|
#include <thread>#include <boost/thread.hpp>#include <folly/Random.h>#include <folly/SpinLock.h>#include <folly/experimental/FlatCombiningPriorityQueue.h>#include <folly/experimental/RelaxedConcurrentPriorityQueue.h>#include <folly/portability/GFlags.h>#include <folly/portability/GTest.h>#include <folly/test/DeterministicSchedule.h>#include <glog/logging.h>Go to the source code of this file.
Classes | |
| class | Queue< E > |
| class | GlobalLockPQ< T > |
Typedefs | |
| using | DSched = folly::test::DeterministicSchedule |
| using | FCPQ = folly::FlatCombiningPriorityQueue< int > |
Functions | |
| DEFINE_bool (bench, false,"run benchmark") | |
| DEFINE_int32 (reps, 1,"number of reps") | |
| DEFINE_int64 (ops, 32,"number of operations per rep") | |
| DEFINE_int64 (elems, 64,"number of elements") | |
| template<class PriorityQueue > | |
| void | basicOpsTest () |
| TEST (CPQ, BasicOpsTest) | |
| template<typename Func > | |
| static uint64_t | run_once (const Func &fn) |
| execute the function for nthreads More... | |
| template<class PriorityQueue > | |
| void | singleThreadTest () |
| TEST (CPQ, SingleThrStrictImplTest) | |
| TEST (CPQ, SingleThrRelaxedImplTest) | |
| template<class PriorityQueue > | |
| void | concurrentPopforSharedBuffer () |
| TEST (CPQ, ConcurrentPopStrictImplTest) | |
| TEST (CPQ, ConcurrentPopRelaxedImplTest) | |
| template<class PriorityQueue > | |
| void | concurrentPush () |
| TEST (CPQ, ConcurrentPushStrictImplTest) | |
| TEST (CPQ, ConcurrentPushRelaxedImplTest) | |
| template<class PriorityQueue > | |
| void | concurrentOps (int ops) |
| template<class PriorityQueue > | |
| void | concurrentSizeTest (int ops) |
| TEST (CPQ, ConcurrentMixedStrictImplTest) | |
| TEST (CPQ, ConcurrentMixedRelaxedImplTest) | |
| TEST (CPQ, StrictImplSizeTest) | |
| TEST (CPQ, RelaxedImplSizeTest) | |
| template<class PriorityQueue > | |
| void | multiPusherPopper (int PushThr, int PopThr) |
| TEST (CPQ, PusherPopperBlockingTest) | |
| TEST (CPQ, PusherPopperSpinningTest) | |
| template<class PriorityQueue > | |
| void | blockingFirst () |
| template<class PriorityQueue > | |
| void | concurrentBlocking () |
| TEST (CPQ, PopBlockingTest) | |
| TEST (CPQ, MixedBlockingTest) | |
| template<class PriorityQueue , template< typename > class Atom = std::atomic> | |
| static void | DSchedMixedTest () |
| TEST (CPQ, DSchedMixedStrictTest) | |
| TEST (CPQ, DSchedMixedRelaxedTest) | |
| template<class PriorityQueue > | |
| static uint64_t | producer_consumer_test (std::string name, uint32_t PushThr, uint32_t PopThr, uint64_t initial_size) |
| template<class PriorityQueue > | |
| static uint64_t | throughtput_test (std::string name, uint64_t initial_size) |
| template<class PriorityQueue > | |
| static void | accuracy_test (std::string name, uint64_t initial_size, uint32_t top_percent) |
| TEST (CPQ, ThroughtputBench) | |
| TEST (CPQ, ProducerConsumerBench) | |
| TEST (CPQ, Accuracy) | |
Variables | |
| static std::vector< int > | nthr = {1, 2, 4, 8} |
| static uint32_t | nthreads |
| static std::vector< int > | sizes = {0, 1024} |
Definition at line 625 of file RelaxedConcurrentPriorityQueueTest.cpp.
| using FCPQ = folly::FlatCombiningPriorityQueue<int> |
Definition at line 1052 of file RelaxedConcurrentPriorityQueueTest.cpp.
|
static |
Definition at line 1004 of file RelaxedConcurrentPriorityQueueTest.cpp.
References counter, folly::pushmi::operators::filter, i, folly::Random::rand32(), rng, stop(), uint64_t, and val.
| void basicOpsTest | ( | ) |
Definition at line 40 of file RelaxedConcurrentPriorityQueueTest.cpp.
References EXPECT_EQ, EXPECT_FALSE, and EXPECT_TRUE.
| void blockingFirst | ( | ) |
Definition at line 523 of file RelaxedConcurrentPriorityQueueTest.cpp.
References b, c, EXPECT_EQ, folly::pushmi::detail::t, and val.
| void concurrentBlocking | ( | ) |
Definition at line 558 of file RelaxedConcurrentPriorityQueueTest.cpp.
References b, EXPECT_EQ, folly::pushmi::detail::t, uint32_t, and val.
Referenced by TEST().
| void concurrentOps | ( | int | ops | ) |
initialize the queue
operations
clean up work
Definition at line 291 of file RelaxedConcurrentPriorityQueueTest.cpp.
References i, nthreads, ops, folly::Random::rand32(), rng, run_once(), folly::pushmi::detail::t, uint32_t, uint64_t, and val.
| void concurrentPopforSharedBuffer | ( | ) |
concurrent pop should made the queue empty with executing the eaqual elements pop function
Definition at line 171 of file RelaxedConcurrentPriorityQueueTest.cpp.
References EXPECT_EQ, i, nthreads, folly::Random::rand32(), rng, run_once(), folly::pushmi::detail::t, uint32_t, uint64_t, and val.
Referenced by TEST().
| void concurrentPush | ( | ) |
executing fixed number of push, counting the element number & total value.
Definition at line 246 of file RelaxedConcurrentPriorityQueueTest.cpp.
References EXPECT_EQ, i, nthreads, folly::Random::rand32(), rng, run_once(), folly::pushmi::detail::t, uint32_t, uint64_t, and val.
| void concurrentSizeTest | ( | int | ops | ) |
initialize the queue
operations
Definition at line 352 of file RelaxedConcurrentPriorityQueueTest.cpp.
References EXPECT_EQ, EXPECT_TRUE, i, nthreads, ops, folly::Random::rand32(), rng, run_once(), folly::pushmi::detail::t, uint32_t, uint64_t, and val.
| DEFINE_int32 | ( | reps | , |
| 1 | , | ||
| "number of reps" | |||
| ) |
| DEFINE_int64 | ( | ops | , |
| 32 | , | ||
| "number of operations per rep" | |||
| ) |
| DEFINE_int64 | ( | elems | , |
| 64 | , | ||
| "number of elements" | |||
| ) |
|
static |
Definition at line 630 of file RelaxedConcurrentPriorityQueueTest.cpp.
References EXPECT_EQ, i, folly::test::DeterministicSchedule::join(), folly::Random::rand32(), rng, folly::pushmi::detail::t, folly::test::DeterministicSchedule::thread(), threads, uint64_t, and val.
Referenced by TEST().
| void multiPusherPopper | ( | int | PushThr, |
| int | PopThr | ||
| ) |
Definition at line 428 of file RelaxedConcurrentPriorityQueueTest.cpp.
References EXPECT_EQ, i, ops, folly::Random::rand32(), folly::pushmi::detail::t, uint32_t, and val.
Referenced by TEST().
|
static |
|
static |
execute the function for nthreads
Definition at line 94 of file RelaxedConcurrentPriorityQueueTest.cpp.
References count, now(), nthreads, folly::pushmi::detail::t, threads, uint32_t, and uint64_t.
Referenced by concurrentOps(), concurrentPopforSharedBuffer(), concurrentPush(), concurrentSizeTest(), and throughtput_test().
| void singleThreadTest | ( | ) |
Definition at line 119 of file RelaxedConcurrentPriorityQueueTest.cpp.
References counter, EXPECT_EQ, i, folly::Random::rand32(), rng, sum(), uint64_t, and val.
| TEST | ( | CPQ | , |
| BasicOpsTest | |||
| ) |
Definition at line 75 of file RelaxedConcurrentPriorityQueueTest.cpp.
| TEST | ( | CPQ | , |
| SingleThrStrictImplTest | |||
| ) |
Definition at line 144 of file RelaxedConcurrentPriorityQueueTest.cpp.
| TEST | ( | CPQ | , |
| SingleThrRelaxedImplTest | |||
| ) |
Definition at line 155 of file RelaxedConcurrentPriorityQueueTest.cpp.
| TEST | ( | CPQ | , |
| ConcurrentPopStrictImplTest | |||
| ) |
Definition at line 207 of file RelaxedConcurrentPriorityQueueTest.cpp.
References concurrentPopforSharedBuffer().
| TEST | ( | CPQ | , |
| ConcurrentPopRelaxedImplTest | |||
| ) |
Definition at line 224 of file RelaxedConcurrentPriorityQueueTest.cpp.
References concurrentPopforSharedBuffer().
| TEST | ( | CPQ | , |
| ConcurrentPushStrictImplTest | |||
| ) |
Definition at line 276 of file RelaxedConcurrentPriorityQueueTest.cpp.
| TEST | ( | CPQ | , |
| ConcurrentPushRelaxedImplTest | |||
| ) |
Definition at line 282 of file RelaxedConcurrentPriorityQueueTest.cpp.
| TEST | ( | CPQ | , |
| ConcurrentMixedStrictImplTest | |||
| ) |
| TEST | ( | CPQ | , |
| ConcurrentMixedRelaxedImplTest | |||
| ) |
| TEST | ( | CPQ | , |
| StrictImplSizeTest | |||
| ) |
| TEST | ( | CPQ | , |
| RelaxedImplSizeTest | |||
| ) |
| TEST | ( | CPQ | , |
| PusherPopperBlockingTest | |||
| ) |
Definition at line 481 of file RelaxedConcurrentPriorityQueueTest.cpp.
References i, and multiPusherPopper().
| TEST | ( | CPQ | , |
| PusherPopperSpinningTest | |||
| ) |
Definition at line 501 of file RelaxedConcurrentPriorityQueueTest.cpp.
References i, and multiPusherPopper().
| TEST | ( | CPQ | , |
| PopBlockingTest | |||
| ) |
Definition at line 596 of file RelaxedConcurrentPriorityQueueTest.cpp.
| TEST | ( | CPQ | , |
| MixedBlockingTest | |||
| ) |
Definition at line 610 of file RelaxedConcurrentPriorityQueueTest.cpp.
References concurrentBlocking().
| TEST | ( | CPQ | , |
| DSchedMixedStrictTest | |||
| ) |
Definition at line 682 of file RelaxedConcurrentPriorityQueueTest.cpp.
References DSchedMixedTest(), and folly::test::DeterministicSchedule::uniform().
| TEST | ( | CPQ | , |
| DSchedMixedRelaxedTest | |||
| ) |
Definition at line 746 of file RelaxedConcurrentPriorityQueueTest.cpp.
References DSchedMixedTest(), and folly::test::DeterministicSchedule::uniform().
| TEST | ( | CPQ | , |
| ThroughtputBench | |||
| ) |
| TEST | ( | CPQ | , |
| ProducerConsumerBench | |||
| ) |
Definition at line 1081 of file RelaxedConcurrentPriorityQueueTest.cpp.
References m, nthrs, producer_consumer_test(), and s.
| TEST | ( | CPQ | , |
| Accuracy | |||
| ) |
|
static |
Definition at line 952 of file RelaxedConcurrentPriorityQueueTest.cpp.
References counter, i, max, min, name, nthreads, ops, folly::Random::rand32(), rng, run_once(), sum(), uint32_t, uint64_t, and val.
|
static |
Definition at line 35 of file RelaxedConcurrentPriorityQueueTest.cpp.
|
static |
Definition at line 37 of file RelaxedConcurrentPriorityQueueTest.cpp.
Referenced by concurrentOps(), concurrentPopforSharedBuffer(), concurrentPush(), concurrentSizeTest(), run_once(), TEST(), and throughtput_test().
|
static |
Definition at line 383 of file RelaxedConcurrentPriorityQueueTest.cpp.