25 #include <glog/logging.h> 29 template <
typename CallOnceFunc>
30 void bm_impl(CallOnceFunc&& fn,
size_t iters) {
31 std::deque<std::thread>
threads;
32 for (
size_t i = 0u;
i < size_t(FLAGS_threads); ++
i) {
33 threads.emplace_back([&fn, iters] {
34 for (
size_t j = 0u; j < iters; ++j) {
39 for (std::thread&
t : threads) {
69 gflags::ParseCommandLineFlags(&argc, &argv,
true);
BENCHMARK(StdCallOnceBench, iters)
void bm_impl(CallOnceFunc &&fn, size_t iters)
DEFINE_int32(threads, 16,"benchmark concurrency")
std::vector< std::thread::id > threads
FOLLY_ALWAYS_INLINE void call_once(basic_once_flag< Mutex, Atom > &flag, F &&f, Args &&...args)
basic_once_flag< TimedMutex > once_flag
int main(int argc, char **argv)