Commit fdc64cf0 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook GitHub Bot

revise SingletonRelaxedCounter check functions

Summary: Rename, mark as kept, add a version taking an argument

Differential Revision: D27383132

fbshipit-source-id: 214af5b09e42159756e97b3b829ac9ecb237c17b
parent 59b71bbb
......@@ -23,23 +23,27 @@
#include <folly/Benchmark.h>
#include <folly/init/Init.h>
#include <folly/lang/Keep.h>
#include <folly/portability/GFlags.h>
DEFINE_int32(num_threads, 4, "No. of threads allocting the objects");
namespace folly {
namespace {
struct PrivateTag {};
} // namespace
using Counter = SingletonRelaxedCounter<size_t, PrivateTag>;
using Counter = folly::SingletonRelaxedCounter<size_t, PrivateTag>;
// small wrappers around the functions being benchmarked
// useful for looking at the inlined native code of the fast path
extern "C" void check() noexcept {
extern "C" FOLLY_KEEP void check_singleton_relaxed_counter_add_1() {
Counter::add(1);
}
extern "C" FOLLY_KEEP void check_singleton_relaxed_counter_add(size_t i) {
Counter::add(i);
}
namespace folly {
// a noop which the compiler cannot see through
// used to prevent some compiler optimizations which could skew benchmarks
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment