proxygen
|
#include <folly/synchronization/LifoSem.h>
#include <thread>
#include <folly/Benchmark.h>
#include <folly/Random.h>
#include <folly/portability/Asm.h>
#include <folly/portability/GFlags.h>
#include <folly/portability/GTest.h>
#include <folly/portability/Semaphore.h>
#include <folly/test/DeterministicSchedule.h>
Go to the source code of this file.
Classes | |
class | LifoSemTest |
Typedefs | |
typedef LifoSemImpl< DeterministicAtomic > | DLifoSem |
typedef DeterministicSchedule | DSched |
Functions | |
TEST (LifoSem, basic) | |
TEST (LifoSem, multi) | |
TEST_F (LifoSemTest, pingpong) | |
TEST_F (LifoSemTest, mutex) | |
TEST_F (LifoSemTest, no_blocking) | |
TEST_F (LifoSemTest, one_way) | |
TEST_F (LifoSemTest, shutdown_wait_order) | |
TEST_F (LifoSemTest, shutdown_multi) | |
TEST (LifoSem, multi_try_wait_simple) | |
TEST_F (LifoSemTest, multi_try_wait) | |
TEST_F (LifoSemTest, timeout) | |
BENCHMARK (lifo_sem_pingpong, iters) | |
BENCHMARK (lifo_sem_oneway, iters) | |
BENCHMARK (single_thread_lifo_post, iters) | |
BENCHMARK (single_thread_lifo_wait, iters) | |
BENCHMARK (single_thread_lifo_postwait, iters) | |
BENCHMARK (single_thread_lifo_trywait, iters) | |
BENCHMARK (single_thread_posix_postwait, iters) | |
BENCHMARK (single_thread_posix_trywait, iters) | |
static void | contendedUse (uint32_t n, int posters, int waiters) |
BENCHMARK_DRAW_LINE () | |
int | main (int argc, char **argv) |
typedef LifoSemImpl<DeterministicAtomic> DLifoSem |
Definition at line 32 of file LifoSemTests.cpp.
typedef DeterministicSchedule DSched |
Definition at line 33 of file LifoSemTests.cpp.
BENCHMARK | ( | lifo_sem_pingpong | , |
iters | |||
) |
Definition at line 313 of file LifoSemTests.cpp.
References a, b, i, folly::detail::LifoSemBase< Handoff, Atom >::post(), and folly::detail::LifoSemBase< Handoff, Atom >::wait().
BENCHMARK | ( | lifo_sem_oneway | , |
iters | |||
) |
Definition at line 329 of file LifoSemTests.cpp.
References a, i, folly::detail::LifoSemBase< Handoff, Atom >::post(), and folly::detail::LifoSemBase< Handoff, Atom >::wait().
BENCHMARK | ( | single_thread_lifo_post | , |
iters | |||
) |
Definition at line 342 of file LifoSemTests.cpp.
References folly::asm_volatile_memory(), and folly::detail::LifoSemBase< Handoff, Atom >::post().
BENCHMARK | ( | single_thread_lifo_wait | , |
iters | |||
) |
Definition at line 350 of file LifoSemTests.cpp.
References folly::asm_volatile_memory(), and folly::detail::LifoSemBase< Handoff, Atom >::wait().
BENCHMARK | ( | single_thread_lifo_postwait | , |
iters | |||
) |
Definition at line 358 of file LifoSemTests.cpp.
References folly::asm_volatile_memory(), folly::detail::LifoSemBase< Handoff, Atom >::post(), and folly::detail::LifoSemBase< Handoff, Atom >::wait().
BENCHMARK | ( | single_thread_lifo_trywait | , |
iters | |||
) |
Definition at line 368 of file LifoSemTests.cpp.
References folly::asm_volatile_memory(), EXPECT_FALSE, and folly::detail::LifoSemBase< Handoff, Atom >::tryWait().
BENCHMARK | ( | single_thread_posix_postwait | , |
iters | |||
) |
Definition at line 376 of file LifoSemTests.cpp.
References EXPECT_EQ.
BENCHMARK | ( | single_thread_posix_trywait | , |
iters | |||
) |
BENCHMARK_DRAW_LINE | ( | ) |
|
static |
Definition at line 395 of file LifoSemTests.cpp.
References folly::BENCHMARK_DRAW_LINE(), BENCHMARK_NAMED_PARAM, BENCHMARK_SUSPEND, i, folly::detail::LifoSemBase< BatonType, Atom >::post(), folly::pushmi::detail::t, threads, uint32_t, folly::detail::LifoSemBase< BatonType, Atom >::wait(), and folly::fibers::yield().
int main | ( | int | argc, |
char ** | argv | ||
) |
Definition at line 465 of file LifoSemTests.cpp.
References argv, testing::InitGoogleTest(), RUN_ALL_TESTS(), and folly::runBenchmarksOnFlag().
Definition at line 44 of file LifoSemTests.cpp.
References EXPECT_FALSE, EXPECT_TRUE, folly::detail::LifoSemBase< Handoff, Atom >::post(), folly::detail::LifoSemBase< Handoff, Atom >::tryWait(), and folly::detail::LifoSemBase< Handoff, Atom >::wait().
TEST | ( | LifoSem | , |
multi | |||
) |
Definition at line 53 of file LifoSemTests.cpp.
References b, i, folly::INFO, folly::detail::LifoSemBase< Handoff, Atom >::post(), threads, folly::detail::LifoSemBase< Handoff, Atom >::tryWait(), and folly::detail::LifoSemBase< Handoff, Atom >::wait().
TEST | ( | LifoSem | , |
multi_try_wait_simple | |||
) |
Definition at line 222 of file LifoSemTests.cpp.
References ASSERT_EQ, folly::detail::LifoSemBase< Handoff, Atom >::post(), and folly::detail::LifoSemBase< Handoff, Atom >::tryWait().
TEST_F | ( | LifoSemTest | , |
pingpong | |||
) |
Definition at line 85 of file LifoSemTests.cpp.
References a, b, EXPECT_EQ, i, folly::test::DeterministicSchedule::join(), folly::detail::LifoSemBase< Handoff, Atom >::post(), folly::test::DeterministicSchedule::thread(), folly::test::DeterministicSchedule::uniform(), folly::detail::LifoSemBase< Handoff, Atom >::valueGuess(), and folly::detail::LifoSemBase< Handoff, Atom >::wait().
TEST_F | ( | LifoSemTest | , |
mutex | |||
) |
Definition at line 114 of file LifoSemTests.cpp.
References a, i, folly::test::DeterministicSchedule::join(), folly::detail::LifoSemBase< Handoff, Atom >::post(), folly::test::DeterministicSchedule::thread(), folly::test::DeterministicSchedule::uniform(), and folly::detail::LifoSemBase< Handoff, Atom >::wait().
TEST_F | ( | LifoSemTest | , |
no_blocking | |||
) |
Definition at line 138 of file LifoSemTests.cpp.
References a, i, folly::INFO, folly::test::DeterministicSchedule::join(), folly::detail::LifoSemBase< Handoff, Atom >::post(), folly::randomNumberSeed(), seed, folly::test::DeterministicSchedule::thread(), threads, folly::test::DeterministicSchedule::uniform(), and folly::detail::LifoSemBase< Handoff, Atom >::wait().
TEST_F | ( | LifoSemTest | , |
one_way | |||
) |
Definition at line 167 of file LifoSemTests.cpp.
References a, i, folly::INFO, folly::test::DeterministicSchedule::join(), folly::detail::LifoSemBase< Handoff, Atom >::post(), folly::randomNumberSeed(), seed, folly::test::DeterministicSchedule::thread(), folly::test::DeterministicSchedule::uniformSubset(), and folly::detail::LifoSemBase< Handoff, Atom >::wait().
TEST_F | ( | LifoSemTest | , |
shutdown_wait_order | |||
) |
Definition at line 189 of file LifoSemTests.cpp.
References a, EXPECT_THROW, EXPECT_TRUE, folly::detail::LifoSemBase< Handoff, Atom >::isShutdown(), folly::detail::LifoSemBase< Handoff, Atom >::post(), folly::detail::LifoSemBase< Handoff, Atom >::shutdown(), and folly::detail::LifoSemBase< Handoff, Atom >::wait().
TEST_F | ( | LifoSemTest | , |
shutdown_multi | |||
) |
Definition at line 198 of file LifoSemTests.cpp.
References a, ADD_FAILURE, EXPECT_TRUE, folly::detail::LifoSemBase< Handoff, Atom >::isShutdown(), folly::test::DeterministicSchedule::join(), folly::detail::LifoSemBase< Handoff, Atom >::shutdown(), folly::test::DeterministicSchedule::thread(), threads, folly::test::DeterministicSchedule::uniform(), and folly::detail::LifoSemBase< Handoff, Atom >::wait().
TEST_F | ( | LifoSemTest | , |
multi_try_wait | |||
) |
Definition at line 229 of file LifoSemTests.cpp.
References ASSERT_EQ, i, folly::INFO, folly::test::DeterministicSchedule::join(), folly::test::DeterministicAtomicImpl< T, Schedule, Atom >::load(), folly::detail::LifoSemBase< Handoff, Atom >::post(), folly::randomNumberSeed(), seed, stop(), folly::test::DeterministicAtomicImpl< T, Schedule, Atom >::store(), folly::test::DeterministicSchedule::thread(), folly::detail::LifoSemBase< Handoff, Atom >::tryWait(), and folly::test::DeterministicSchedule::uniform().
TEST_F | ( | LifoSemTest | , |
timeout | |||
) |
Definition at line 267 of file LifoSemTests.cpp.
References a, EXPECT_GT, EXPECT_TRUE, i, folly::INFO, folly::detail::LifoSemBase< Handoff, Atom >::isShutdown(), folly::test::DeterministicSchedule::join(), folly::detail::LifoSemBase< Handoff, Atom >::post(), folly::randomNumberSeed(), seed, folly::detail::LifoSemBase< Handoff, Atom >::shutdown(), folly::test::DeterministicSchedule::thread(), threads, folly::detail::LifoSemBase< Handoff, Atom >::try_wait_for(), and folly::test::DeterministicSchedule::uniform().