proxygen
|
#include <folly/concurrency/UnboundedQueue.h>
#include <folly/MPMCQueue.h>
#include <folly/ProducerConsumerQueue.h>
#include <folly/portability/GTest.h>
#include <glog/logging.h>
#include <atomic>
#include <thread>
Go to the source code of this file.
Classes | |
class | MPMC< T > |
class | PCQ< T > |
struct | IntArray< M > |
Typedefs | |
template<typename T , bool MayBlock> | |
using | USPSC = folly::USPSCQueue< T, MayBlock > |
template<typename T , bool MayBlock> | |
using | UMPSC = folly::UMPSCQueue< T, MayBlock > |
template<typename T , bool MayBlock> | |
using | USPMC = folly::USPMCQueue< T, MayBlock > |
template<typename T , bool MayBlock> | |
using | UMPMC = folly::UMPMCQueue< T, MayBlock > |
template<typename T , bool ignore> | |
using | FMPMC = MPMC< T > |
template<typename T , bool ignore> | |
using | FPCQ = PCQ< T > |
Functions | |
DEFINE_bool (bench, false,"run benchmark") | |
DEFINE_int32 (reps, 10,"number of reps") | |
DEFINE_int32 (ops, 1000000,"number of operations per rep") | |
DEFINE_int64 (capacity, 256 *1024,"capacity") | |
template<template< typename, bool > class Q, bool MayBlock> | |
void | basic_test () |
TEST (UnboundedQueue, basic) | |
template<template< typename, bool > class Q, bool MayBlock> | |
void | timeout_test () |
TEST (UnboundedQueue, timeout) | |
template<template< typename, bool > class Q, bool MayBlock> | |
void | peek_test () |
TEST (UnboundedQueue, peek) | |
TEST (UnboundedQueue, cleanup_on_destruction) | |
template<typename ProdFunc , typename ConsFunc , typename EndFunc > | |
uint64_t | run_once (int nprod, int ncons, const ProdFunc &prodFn, const ConsFunc &consFn, const EndFunc &endFn) |
template<bool SingleProducer, bool SingleConsumer, bool MayBlock> | |
void | enq_deq_test (const int nprod, const int ncons) |
TEST (UnboundedQueue, enq_deq) | |
template<typename RepFunc > | |
uint64_t | runBench (const std::string &name, int ops, const RepFunc &repFn) |
template<template< typename, bool > class Q, typename T , int Op> | |
uint64_t | bench (const int nprod, const int ncons, const std::string &name) |
void | dottedLine () |
template<typename T > | |
void | type_benches (const int np, const int nc, const std::string &name) |
void | benches (const int np, const int nc) |
TEST (UnboundedQueue, bench) | |
Definition at line 425 of file UnboundedQueueTest.cpp.
Definition at line 456 of file UnboundedQueueTest.cpp.
using UMPMC = folly::UMPMCQueue<T, MayBlock> |
Definition at line 42 of file UnboundedQueueTest.cpp.
using UMPSC = folly::UMPSCQueue<T, MayBlock> |
Definition at line 36 of file UnboundedQueueTest.cpp.
using USPMC = folly::USPMCQueue<T, MayBlock> |
Definition at line 39 of file UnboundedQueueTest.cpp.
using USPSC = folly::USPSCQueue<T, MayBlock> |
Definition at line 33 of file UnboundedQueueTest.cpp.
void basic_test | ( | ) |
Definition at line 45 of file UnboundedQueueTest.cpp.
References ASSERT_EQ, ASSERT_FALSE, and ASSERT_TRUE.
uint64_t bench | ( | const int | nprod, |
const int | ncons, | ||
const std::string & | name | ||
) |
Definition at line 349 of file UnboundedQueueTest.cpp.
References ASSERT_EQ, ASSERT_TRUE, i, ops, run_once(), runBench(), sum(), T, uint64_t, UNLIKELY, and v.
void benches | ( | const int | np, |
const int | nc | ||
) |
DEFINE_int32 | ( | reps | , |
10 | , | ||
"number of reps" | |||
) |
DEFINE_int32 | ( | ops | , |
1000000 | , | ||
"number of operations per rep" | |||
) |
DEFINE_int64 | ( | capacity | , |
256 * | 1024, | ||
"capacity" | |||
) |
void dottedLine | ( | ) |
Definition at line 472 of file UnboundedQueueTest.cpp.
Referenced by TEST(), and type_benches().
void enq_deq_test | ( | const int | nprod, |
const int | ncons | ||
) |
Definition at line 216 of file UnboundedQueueTest.cpp.
References ASSERT_EQ, folly::UnboundedQueue< T, SingleProducer, SingleConsumer, MayBlock, LgSegmentSize, LgAlign, Atom >::dequeue(), folly::UnboundedQueue< T, SingleProducer, SingleConsumer, MayBlock, LgSegmentSize, LgAlign, Atom >::enqueue(), i, ops, run_once(), sum(), folly::UnboundedQueue< T, SingleProducer, SingleConsumer, MayBlock, LgSegmentSize, LgAlign, Atom >::try_dequeue(), folly::UnboundedQueue< T, SingleProducer, SingleConsumer, MayBlock, LgSegmentSize, LgAlign, Atom >::try_dequeue_for(), folly::UnboundedQueue< T, SingleProducer, SingleConsumer, MayBlock, LgSegmentSize, LgAlign, Atom >::try_peek(), uint64_t, and v.
void peek_test | ( | ) |
Definition at line 107 of file UnboundedQueueTest.cpp.
References ASSERT_EQ, ASSERT_FALSE, ASSERT_TRUE, i, and v.
|
inline |
Definition at line 158 of file UnboundedQueueTest.cpp.
References count, i, now(), and start.
Referenced by bench(), and enq_deq_test().
uint64_t runBench | ( | const std::string & | name, |
int | ops, | ||
const RepFunc & | repFn | ||
) |
TEST | ( | UnboundedQueue | , |
basic | |||
) |
Definition at line 71 of file UnboundedQueueTest.cpp.
TEST | ( | UnboundedQueue | , |
timeout | |||
) |
Definition at line 95 of file UnboundedQueueTest.cpp.
TEST | ( | UnboundedQueue | , |
peek | |||
) |
Definition at line 123 of file UnboundedQueueTest.cpp.
TEST | ( | UnboundedQueue | , |
cleanup_on_destruction | |||
) |
Definition at line 130 of file UnboundedQueueTest.cpp.
References count, folly::UnboundedQueue< T, SingleProducer, SingleConsumer, MayBlock, LgSegmentSize, LgAlign, Atom >::enqueue(), folly::exchange(), EXPECT_EQ, testing::gmock_matchers_test::foo, i, folly::gen::move, and folly::pushmi::__adl::noexcept().
TEST | ( | UnboundedQueue | , |
enq_deq | |||
) |
Definition at line 281 of file UnboundedQueueTest.cpp.
TEST | ( | UnboundedQueue | , |
bench | |||
) |
void timeout_test | ( | ) |
Definition at line 83 of file UnboundedQueueTest.cpp.
References ASSERT_EQ, ASSERT_FALSE, ASSERT_TRUE, now(), and v.
void type_benches | ( | const int | np, |
const int | nc, | ||
const std::string & | name | ||
) |