// of its destruction.
struct EnvVarSaver {
EnvVarSaver()
- : state_(make_unique<experimental::EnvironmentState>(
+ : state_(std::make_unique<experimental::EnvironmentState>(
experimental::EnvironmentState::fromCurrentEnvironment())) {}
EnvVarSaver(EnvVarSaver&& other) noexcept : state_(std::move(other.state_)) {}
// We break apart the constructor and actually loading the schema so that
// we can handle the case where a schema refers to itself, e.g. via
// "$ref": "#".
- auto v = make_unique<SchemaValidator>();
+ auto v = std::make_unique<SchemaValidator>();
v->loadSchema(context, schema);
return v;
}
if (p->isString() && p->stringPiece()[0] == '#') {
auto it = context.refs.find(p->getString());
if (it != context.refs.end()) {
- validators_.emplace_back(make_unique<RefValidator>(it->second));
+ validators_.emplace_back(std::make_unique<RefValidator>(it->second));
return;
}
// future references to it will just see that pointer and won't try to
// keep parsing further.
if (s) {
- auto v = make_unique<SchemaValidator>();
+ auto v = std::make_unique<SchemaValidator>();
context.refs[p->getString()] = v.get();
v->loadSchema(context, *s);
validators_.emplace_back(std::move(v));
// Numeric validators
if (const auto* p = schema.get_ptr("multipleOf")) {
- validators_.emplace_back(make_unique<MultipleOfValidator>(*p));
+ validators_.emplace_back(std::make_unique<MultipleOfValidator>(*p));
}
if (const auto* p = schema.get_ptr("maximum")) {
- validators_.emplace_back(
- make_unique<ComparisonValidator>(*p,
- schema.get_ptr("exclusiveMaximum"),
- ComparisonValidator::Type::MAX));
+ validators_.emplace_back(std::make_unique<ComparisonValidator>(
+ *p,
+ schema.get_ptr("exclusiveMaximum"),
+ ComparisonValidator::Type::MAX));
}
if (const auto* p = schema.get_ptr("minimum")) {
- validators_.emplace_back(
- make_unique<ComparisonValidator>(*p,
- schema.get_ptr("exclusiveMinimum"),
- ComparisonValidator::Type::MIN));
+ validators_.emplace_back(std::make_unique<ComparisonValidator>(
+ *p,
+ schema.get_ptr("exclusiveMinimum"),
+ ComparisonValidator::Type::MIN));
}
// String validators
if (const auto* p = schema.get_ptr("maxLength")) {
validators_.emplace_back(
- make_unique<SizeValidator<std::greater_equal<int64_t>>>(
+ std::make_unique<SizeValidator<std::greater_equal<int64_t>>>(
*p, dynamic::Type::STRING));
}
if (const auto* p = schema.get_ptr("minLength")) {
validators_.emplace_back(
- make_unique<SizeValidator<std::less_equal<int64_t>>>(
+ std::make_unique<SizeValidator<std::less_equal<int64_t>>>(
*p, dynamic::Type::STRING));
}
if (const auto* p = schema.get_ptr("pattern")) {
- validators_.emplace_back(make_unique<StringPatternValidator>(*p));
+ validators_.emplace_back(std::make_unique<StringPatternValidator>(*p));
}
// Array validators
const auto* additionalItems = schema.get_ptr("additionalItems");
if (items || additionalItems) {
validators_.emplace_back(
- make_unique<ArrayItemsValidator>(context, items, additionalItems));
+ std::make_unique<ArrayItemsValidator>(context, items, additionalItems));
}
if (const auto* p = schema.get_ptr("maxItems")) {
validators_.emplace_back(
- make_unique<SizeValidator<std::greater_equal<int64_t>>>(
+ std::make_unique<SizeValidator<std::greater_equal<int64_t>>>(
*p, dynamic::Type::ARRAY));
}
if (const auto* p = schema.get_ptr("minItems")) {
validators_.emplace_back(
- make_unique<SizeValidator<std::less_equal<int64_t>>>(
+ std::make_unique<SizeValidator<std::less_equal<int64_t>>>(
*p, dynamic::Type::ARRAY));
}
if (const auto* p = schema.get_ptr("uniqueItems")) {
- validators_.emplace_back(make_unique<ArrayUniqueValidator>(*p));
+ validators_.emplace_back(std::make_unique<ArrayUniqueValidator>(*p));
}
// Object validators
const auto* patternProperties = schema.get_ptr("patternProperties");
const auto* additionalProperties = schema.get_ptr("additionalProperties");
if (properties || patternProperties || additionalProperties) {
- validators_.emplace_back(make_unique<PropertiesValidator>(
+ validators_.emplace_back(std::make_unique<PropertiesValidator>(
context, properties, patternProperties, additionalProperties));
}
if (const auto* p = schema.get_ptr("maxProperties")) {
validators_.emplace_back(
- make_unique<SizeValidator<std::greater_equal<int64_t>>>(
+ std::make_unique<SizeValidator<std::greater_equal<int64_t>>>(
*p, dynamic::Type::OBJECT));
}
if (const auto* p = schema.get_ptr("minProperties")) {
validators_.emplace_back(
- make_unique<SizeValidator<std::less_equal<int64_t>>>(
+ std::make_unique<SizeValidator<std::less_equal<int64_t>>>(
*p, dynamic::Type::OBJECT));
}
if (const auto* p = schema.get_ptr("required")) {
- validators_.emplace_back(make_unique<RequiredValidator>(*p));
+ validators_.emplace_back(std::make_unique<RequiredValidator>(*p));
}
// Misc validators
if (const auto* p = schema.get_ptr("dependencies")) {
- validators_.emplace_back(make_unique<DependencyValidator>(context, *p));
+ validators_.emplace_back(
+ std::make_unique<DependencyValidator>(context, *p));
}
if (const auto* p = schema.get_ptr("enum")) {
- validators_.emplace_back(make_unique<EnumValidator>(*p));
+ validators_.emplace_back(std::make_unique<EnumValidator>(*p));
}
if (const auto* p = schema.get_ptr("type")) {
- validators_.emplace_back(make_unique<TypeValidator>(*p));
+ validators_.emplace_back(std::make_unique<TypeValidator>(*p));
}
if (const auto* p = schema.get_ptr("allOf")) {
- validators_.emplace_back(make_unique<AllOfValidator>(context, *p));
+ validators_.emplace_back(std::make_unique<AllOfValidator>(context, *p));
}
if (const auto* p = schema.get_ptr("anyOf")) {
- validators_.emplace_back(make_unique<AnyOfValidator>(
+ validators_.emplace_back(std::make_unique<AnyOfValidator>(
context, *p, AnyOfValidator::Type::ONE_OR_MORE));
}
if (const auto* p = schema.get_ptr("oneOf")) {
- validators_.emplace_back(make_unique<AnyOfValidator>(
+ validators_.emplace_back(std::make_unique<AnyOfValidator>(
context, *p, AnyOfValidator::Type::EXACTLY_ONE));
}
if (const auto* p = schema.get_ptr("not")) {
- validators_.emplace_back(make_unique<NotValidator>(context, *p));
+ validators_.emplace_back(std::make_unique<NotValidator>(context, *p));
}
}
Validator::~Validator() = default;
std::unique_ptr<Validator> makeValidator(const dynamic& schema) {
- auto v = make_unique<SchemaValidator>();
+ auto v = std::make_unique<SchemaValidator>();
SchemaValidatorContext context(schema);
context.refs["#"] = v.get();
v->loadSchema(context, schema);
};
ObserverManager::ObserverManager() {
- currentQueue_ = make_unique<CurrentQueue>();
- nextQueue_ = make_unique<NextQueue>(*this);
+ currentQueue_ = std::make_unique<CurrentQueue>();
+ nextQueue_ = std::make_unique<NextQueue>(*this);
}
ObserverManager::~ObserverManager() {
fd,
SymbolizePrinter::COLOR_IF_TTY,
size_t(64) << 10), // 64KiB
- addresses_(make_unique<FrameArray<kMaxStackTraceDepth>>()) {}
+ addresses_(std::make_unique<FrameArray<kMaxStackTraceDepth>>()) {}
void StackTracePrinter::flush() {
printer_.flush();
PCHECK(0 == unsetenv(key));
EXPECT_EQ(nullptr, getenv(key));
- auto saver = make_unique<EnvVarSaver>();
+ auto saver = std::make_unique<EnvVarSaver>();
PCHECK(0 == setenv(key, "blah", true));
EXPECT_STREQ("blah", getenv(key));
saver = nullptr;
EXPECT_NE(nullptr, getenv(key));
auto value = std::string{getenv(key)};
- auto saver = make_unique<EnvVarSaver>();
+ auto saver = std::make_unique<EnvVarSaver>();
PCHECK(0 == setenv(key, "blah", true));
EXPECT_STREQ("blah", getenv(key));
saver = nullptr;
EXPECT_NE(nullptr, getenv(key));
auto value = std::string{getenv(key)};
- auto saver = make_unique<EnvVarSaver>();
+ auto saver = std::make_unique<EnvVarSaver>();
PCHECK(0 == unsetenv(key));
EXPECT_EQ(nullptr, getenv(key));
saver = nullptr;
auto& fmPtrRef = map_[&evb];
if (!fmPtrRef) {
- auto loopController = make_unique<EventBaseLoopController>();
+ auto loopController = std::make_unique<EventBaseLoopController>();
loopController->attachEventBase(evb);
evb.runOnDestruction(new EventBaseOnDestructionCallback<EventBaseT>(evb));
- fmPtrRef = make_unique<FiberManager>(std::move(loopController), opts);
+ fmPtrRef =
+ std::make_unique<FiberManager>(std::move(loopController), opts);
}
return *fmPtrRef;
TEST(FutureSplitter, splitFutureScope) {
Promise<int> p;
- auto pSP = make_unique<FutureSplitter<int>>(p.getFuture());
+ auto pSP = std::make_unique<FutureSplitter<int>>(p.getFuture());
auto f1 = pSP->getFuture();
EXPECT_FALSE(f1.isReady());
pSP.reset();
// apply
{
auto mapResult
- = seq(1)
- | map([](int x) { return make_unique<int>(x); })
- | map([](std::unique_ptr<int> x) { return make_unique<int>(*x * *x); })
- | map([](std::unique_ptr<int> x) { return *x; })
- | take(1000)
- | sum;
+ = seq(1)
+ | map([](int x) { return std::make_unique<int>(x); })
+ | map([](std::unique_ptr<int> x) {
+ return std::make_unique<int>(*x * *x); })
+ | map([](std::unique_ptr<int> x) { return *x; })
+ | take(1000)
+ | sum;
auto pmapResult
- = seq(1)
- | pmap([](int x) { return make_unique<int>(x); })
- | pmap([](std::unique_ptr<int> x) { return make_unique<int>(*x * *x); })
- | pmap([](std::unique_ptr<int> x) { return *x; })
- | take(1000)
- | sum;
+ = seq(1)
+ | pmap([](int x) { return std::make_unique<int>(x); })
+ | pmap([](std::unique_ptr<int> x) {
+ return std::make_unique<int>(*x * *x); })
+ | pmap([](std::unique_ptr<int> x) { return *x; })
+ | take(1000)
+ | sum;
EXPECT_EQ(pmapResult, mapResult);
}
// foreach
{
auto mapResult
- = seq(1, 1000)
- | map([](int x) { return make_unique<int>(x); })
- | map([](std::unique_ptr<int> x) { return make_unique<int>(*x * *x); })
- | map([](std::unique_ptr<int> x) { return *x; })
- | sum;
+ = seq(1, 1000)
+ | map([](int x) { return std::make_unique<int>(x); })
+ | map([](std::unique_ptr<int> x) {
+ return std::make_unique<int>(*x * *x); })
+ | map([](std::unique_ptr<int> x) { return *x; })
+ | sum;
auto pmapResult
- = seq(1, 1000)
- | pmap([](int x) { return make_unique<int>(x); })
- | pmap([](std::unique_ptr<int> x) { return make_unique<int>(*x * *x); })
- | pmap([](std::unique_ptr<int> x) { return *x; })
- | sum;
+ = seq(1, 1000)
+ | pmap([](int x) { return std::make_unique<int>(x); })
+ | pmap([](std::unique_ptr<int> x) {
+ return std::make_unique<int>(*x * *x); })
+ | pmap([](std::unique_ptr<int> x) { return *x; })
+ | sum;
EXPECT_EQ(pmapResult, mapResult);
}
};
std::unique_ptr<Codec> NoCompressionCodec::create(int level, CodecType type) {
- return make_unique<NoCompressionCodec>(level, type);
+ return std::make_unique<NoCompressionCodec>(level, type);
}
NoCompressionCodec::NoCompressionCodec(int level, CodecType type)
};
std::unique_ptr<Codec> LZ4Codec::create(int level, CodecType type) {
- return make_unique<LZ4Codec>(level, type);
+ return std::make_unique<LZ4Codec>(level, type);
}
LZ4Codec::LZ4Codec(int level, CodecType type) : Codec(type) {
/* static */ std::unique_ptr<Codec> LZ4FrameCodec::create(
int level,
CodecType type) {
- return make_unique<LZ4FrameCodec>(level, type);
+ return std::make_unique<LZ4FrameCodec>(level, type);
}
static constexpr uint32_t kLZ4FrameMagicLE = 0x184D2204;
};
std::unique_ptr<Codec> SnappyCodec::create(int level, CodecType type) {
- return make_unique<SnappyCodec>(level, type);
+ return std::make_unique<SnappyCodec>(level, type);
}
SnappyCodec::SnappyCodec(int level, CodecType type) : Codec(type) {
}
std::unique_ptr<Codec> ZlibCodec::create(int level, CodecType type) {
- return make_unique<ZlibCodec>(level, type);
+ return std::make_unique<ZlibCodec>(level, type);
}
ZlibCodec::ZlibCodec(int level, CodecType type) : Codec(type) {
}
std::unique_ptr<Codec> LZMA2Codec::create(int level, CodecType type) {
- return make_unique<LZMA2Codec>(level, type);
+ return std::make_unique<LZMA2Codec>(level, type);
}
LZMA2Codec::LZMA2Codec(int level, CodecType type) : Codec(type) {
}
std::unique_ptr<Codec> ZSTDCodec::create(int level, CodecType type) {
- return make_unique<ZSTDCodec>(level, type);
+ return std::make_unique<ZSTDCodec>(level, type);
}
ZSTDCodec::ZSTDCodec(int level, CodecType type) : Codec(type) {
/* static */ std::unique_ptr<Codec> Bzip2Codec::create(
int level,
CodecType type) {
- return make_unique<Bzip2Codec>(level, type);
+ return std::make_unique<Bzip2Codec>(level, type);
}
Bzip2Codec::Bzip2Codec(int level, CodecType type) : Codec(type) {
/* static */ std::unique_ptr<Codec> AutomaticCodec::create(
std::vector<std::unique_ptr<Codec>> customCodecs) {
- return make_unique<AutomaticCodec>(std::move(customCodecs));
+ return std::make_unique<AutomaticCodec>(std::move(customCodecs));
}
AutomaticCodec::AutomaticCodec(std::vector<std::unique_ptr<Codec>> customCodecs)
size_t cloneAtMost(std::unique_ptr<folly::IOBuf>& buf, size_t len) {
if (!buf) {
- buf = make_unique<folly::IOBuf>();
+ buf = std::make_unique<folly::IOBuf>();
}
return cloneAtMost(*buf, len);
}
}
unique_ptr<IOBuf> IOBuf::createSeparate(uint64_t capacity) {
- return make_unique<IOBuf>(CREATE, capacity);
+ return std::make_unique<IOBuf>(CREATE, capacity);
}
unique_ptr<IOBuf> IOBuf::createChain(
//
// Note that we always pass freeOnError as false to the constructor.
// If the constructor throws we'll handle it below. (We have to handle
- // allocation failures from make_unique too.)
- return make_unique<IOBuf>(TAKE_OWNERSHIP, buf, capacity, length,
- freeFn, userData, false);
+ // allocation failures from std::make_unique too.)
+ return std::make_unique<IOBuf>(
+ TAKE_OWNERSHIP, buf, capacity, length, freeFn, userData, false);
} catch (...) {
takeOwnershipError(freeOnError, buf, freeFn, userData);
throw;
}
unique_ptr<IOBuf> IOBuf::wrapBuffer(const void* buf, uint64_t capacity) {
- return make_unique<IOBuf>(WRAP_BUFFER, buf, capacity);
+ return std::make_unique<IOBuf>(WRAP_BUFFER, buf, capacity);
}
IOBuf IOBuf::wrapBufferAsValue(const void* buf, uint64_t capacity) {
}
unique_ptr<IOBuf> IOBuf::clone() const {
- return make_unique<IOBuf>(cloneAsValue());
+ return std::make_unique<IOBuf>(cloneAsValue());
}
unique_ptr<IOBuf> IOBuf::cloneOne() const {
- return make_unique<IOBuf>(cloneOneAsValue());
+ return std::make_unique<IOBuf>(cloneOneAsValue());
}
unique_ptr<IOBuf> IOBuf::cloneCoalesced() const {
- return make_unique<IOBuf>(cloneCoalescedAsValue());
+ return std::make_unique<IOBuf>(cloneCoalescedAsValue());
}
IOBuf IOBuf::cloneAsValue() const {
if (th_) {
return;
}
- th_ = make_unique<ScopedEventBaseThread>(ebm_);
+ th_ = std::make_unique<ScopedEventBaseThread>(ebm_);
}
void EventBaseThread::stop() {
vector<unique_ptr<atomic<size_t>>> atoms(c);
for (size_t i = 0; i < c; ++i) {
auto& atom = atoms.at(i);
- atom = make_unique<atomic<size_t>>(0);
+ atom = std::make_unique<atomic<size_t>>(0);
}
vector<thread> threads;
for (size_t i = 0; i < c; ++i) {
class CustomCodec : public Codec {
public:
static std::unique_ptr<Codec> create(std::string prefix, CodecType type) {
- return make_unique<CustomCodec>(std::move(prefix), type);
+ return std::make_unique<CustomCodec>(std::move(prefix), type);
}
explicit CustomCodec(std::string prefix, CodecType type)
: Codec(CodecType::USER_DEFINED),
// we use the Bench method, but perf results are meaningless under DSched
DSched sched(DSched::uniform(seed));
- vector<unique_ptr<WriteMethodCaller<MPMCQueue<int, DeterministicAtomic,
- Dynamic>>>> callers;
- callers.emplace_back(make_unique<BlockingWriteCaller<MPMCQueue<int,
- DeterministicAtomic, Dynamic>>>());
- callers.emplace_back(make_unique<WriteIfNotFullCaller<MPMCQueue<int,
- DeterministicAtomic, Dynamic>>>());
- callers.emplace_back(make_unique<WriteCaller<MPMCQueue<int,
- DeterministicAtomic, Dynamic>>>());
- callers.emplace_back(make_unique<TryWriteUntilCaller<MPMCQueue<int,
- DeterministicAtomic, Dynamic>>>(milliseconds(1)));
- callers.emplace_back(make_unique<TryWriteUntilCaller<MPMCQueue<int,
- DeterministicAtomic, Dynamic>>>(seconds(2)));
+ using QueueType = MPMCQueue<int, DeterministicAtomic, Dynamic>;
+
+ vector<unique_ptr<WriteMethodCaller<QueueType>>> callers;
+ callers.emplace_back(std::make_unique<BlockingWriteCaller<QueueType>>());
+ callers.emplace_back(std::make_unique<WriteIfNotFullCaller<QueueType>>());
+ callers.emplace_back(std::make_unique<WriteCaller<QueueType>>());
+ callers.emplace_back(
+ std::make_unique<TryWriteUntilCaller<QueueType>>(milliseconds(1)));
+ callers.emplace_back(
+ std::make_unique<TryWriteUntilCaller<QueueType>>(seconds(2)));
size_t cap;
for (const auto& caller : callers) {
// we use the Bench method, but perf results are meaningless under DSched
DSched sched(DSched::uniform(seed));
- vector<unique_ptr<WriteMethodCaller<MPMCQueue<int, DeterministicAtomic,
- true>>>> callers;
- callers.emplace_back(make_unique<BlockingWriteCaller<MPMCQueue<int,
- DeterministicAtomic, true>>>());
- callers.emplace_back(make_unique<WriteIfNotFullCaller<MPMCQueue<int,
- DeterministicAtomic, true>>>());
- callers.emplace_back(make_unique<WriteCaller<MPMCQueue<int,
- DeterministicAtomic, true>>>());
- callers.emplace_back(make_unique<TryWriteUntilCaller<MPMCQueue<int,
- DeterministicAtomic, true>>>(milliseconds(1)));
- callers.emplace_back(make_unique<TryWriteUntilCaller<MPMCQueue<int,
- DeterministicAtomic, true>>>(seconds(2)));
+ using QueueType = MPMCQueue<int, DeterministicAtomic, true>;
+
+ vector<unique_ptr<WriteMethodCaller<QueueType>>> callers;
+ callers.emplace_back(std::make_unique<BlockingWriteCaller<QueueType>>());
+ callers.emplace_back(std::make_unique<WriteIfNotFullCaller<QueueType>>());
+ callers.emplace_back(std::make_unique<WriteCaller<QueueType>>());
+ callers.emplace_back(
+ std::make_unique<TryWriteUntilCaller<QueueType>>(milliseconds(1)));
+ callers.emplace_back(
+ std::make_unique<TryWriteUntilCaller<QueueType>>(seconds(2)));
for (const auto& caller : callers) {
LOG(INFO) <<
template <bool Dynamic = false>
void runMtProdCons() {
+ using QueueType = MPMCQueue<int, std::atomic, Dynamic>;
+
int n = 100000;
setFromEnv(n, "NUM_OPS");
- vector<unique_ptr<WriteMethodCaller<MPMCQueue<int, std::atomic, Dynamic>>>>
+ vector<unique_ptr<WriteMethodCaller<QueueType>>>
callers;
- callers.emplace_back(make_unique<BlockingWriteCaller<MPMCQueue<int,
- std::atomic, Dynamic>>>());
- callers.emplace_back(make_unique<WriteIfNotFullCaller<MPMCQueue<int,
- std::atomic, Dynamic>>>());
- callers.emplace_back(make_unique<WriteCaller<MPMCQueue<int, std::atomic,
- Dynamic>>>());
- callers.emplace_back(make_unique<TryWriteUntilCaller<MPMCQueue<int,
- std::atomic, Dynamic>>>(milliseconds(1)));
- callers.emplace_back(make_unique<TryWriteUntilCaller<MPMCQueue<int,
- std::atomic, Dynamic>>>(seconds(2)));
+ callers.emplace_back(std::make_unique<BlockingWriteCaller<QueueType>>());
+ callers.emplace_back(std::make_unique<WriteIfNotFullCaller<QueueType>>());
+ callers.emplace_back(std::make_unique<WriteCaller<QueueType>>());
+ callers.emplace_back(
+ std::make_unique<TryWriteUntilCaller<QueueType>>(milliseconds(1)));
+ callers.emplace_back(
+ std::make_unique<TryWriteUntilCaller<QueueType>>(seconds(2)));
for (const auto& caller : callers) {
- LOG(INFO) << PC_BENCH((MPMCQueue<int, std::atomic, Dynamic>(10)),
- 1, 1, n, *caller);
- LOG(INFO) << PC_BENCH((MPMCQueue<int, std::atomic, Dynamic>(10)),
- 10, 1, n, *caller);
- LOG(INFO) << PC_BENCH((MPMCQueue<int, std::atomic, Dynamic>(10)),
- 1, 10, n, *caller);
- LOG(INFO) << PC_BENCH((MPMCQueue<int, std::atomic, Dynamic>(10)),
- 10, 10, n, *caller);
- LOG(INFO) << PC_BENCH((MPMCQueue<int, std::atomic, Dynamic>(10000)),
- 1, 1, n, *caller);
- LOG(INFO) << PC_BENCH((MPMCQueue<int, std::atomic, Dynamic>(10000)),
- 10, 1, n, *caller);
- LOG(INFO) << PC_BENCH((MPMCQueue<int, std::atomic, Dynamic>(10000)),
- 1, 10, n, *caller);
- LOG(INFO) << PC_BENCH((MPMCQueue<int, std::atomic, Dynamic>(10000)),
- 10, 10, n, *caller);
- LOG(INFO) << PC_BENCH((MPMCQueue<int, std::atomic, Dynamic>(100000)),
- 32, 100, n, *caller);
+ LOG(INFO) << PC_BENCH((QueueType(10)), 1, 1, n, *caller);
+ LOG(INFO) << PC_BENCH((QueueType(10)), 10, 1, n, *caller);
+ LOG(INFO) << PC_BENCH((QueueType(10)), 1, 10, n, *caller);
+ LOG(INFO) << PC_BENCH((QueueType(10)), 10, 10, n, *caller);
+ LOG(INFO) << PC_BENCH((QueueType(10000)), 1, 1, n, *caller);
+ LOG(INFO) << PC_BENCH((QueueType(10000)), 10, 1, n, *caller);
+ LOG(INFO) << PC_BENCH((QueueType(10000)), 1, 10, n, *caller);
+ LOG(INFO) << PC_BENCH((QueueType(10000)), 10, 10, n, *caller);
+ LOG(INFO) << PC_BENCH((QueueType(100000)), 32, 100, n, *caller);
}
}
template <bool Dynamic = false>
void runMtProdConsEmulatedFutex() {
+ using QueueType = MPMCQueue<int, EmulatedFutexAtomic, Dynamic>;
+
int n = 100000;
- vector<unique_ptr<WriteMethodCaller<MPMCQueue<int, EmulatedFutexAtomic,
- Dynamic>>>> callers;
- callers.emplace_back(make_unique<BlockingWriteCaller<MPMCQueue<int,
- EmulatedFutexAtomic, Dynamic>>>());
- callers.emplace_back(make_unique<WriteIfNotFullCaller<MPMCQueue<int,
- EmulatedFutexAtomic, Dynamic>>>());
- callers.emplace_back(make_unique<WriteCaller<MPMCQueue<int,
- EmulatedFutexAtomic, Dynamic>>>());
- callers.emplace_back(make_unique<TryWriteUntilCaller<MPMCQueue<int,
- EmulatedFutexAtomic, Dynamic>>>(milliseconds(1)));
- callers.emplace_back(make_unique<TryWriteUntilCaller<MPMCQueue<int,
- EmulatedFutexAtomic, Dynamic>>>(seconds(2)));
+ vector<unique_ptr<WriteMethodCaller<QueueType>>> callers;
+ callers.emplace_back(std::make_unique<BlockingWriteCaller<QueueType>>());
+ callers.emplace_back(std::make_unique<WriteIfNotFullCaller<QueueType>>());
+ callers.emplace_back(std::make_unique<WriteCaller<QueueType>>());
+ callers.emplace_back(
+ std::make_unique<TryWriteUntilCaller<QueueType>>(milliseconds(1)));
+ callers.emplace_back(
+ std::make_unique<TryWriteUntilCaller<QueueType>>(seconds(2)));
for (const auto& caller : callers) {
- LOG(INFO) << PC_BENCH(
- (MPMCQueue<int, EmulatedFutexAtomic, Dynamic>(10)), 1, 1, n, *caller);
- LOG(INFO) << PC_BENCH(
- (MPMCQueue<int, EmulatedFutexAtomic, Dynamic>(10)), 10, 1, n, *caller);
- LOG(INFO) << PC_BENCH(
- (MPMCQueue<int, EmulatedFutexAtomic, Dynamic>(10)), 1, 10, n, *caller);
- LOG(INFO) << PC_BENCH(
- (MPMCQueue<int, EmulatedFutexAtomic, Dynamic>(10)), 10, 10, n, *caller);
- LOG(INFO) << PC_BENCH(
- (MPMCQueue<int, EmulatedFutexAtomic, Dynamic>(10000)), 1, 1, n, *caller);
- LOG(INFO) << PC_BENCH(
- (MPMCQueue<int, EmulatedFutexAtomic, Dynamic>(10000)), 10, 1, n, *caller);
- LOG(INFO) << PC_BENCH(
- (MPMCQueue<int, EmulatedFutexAtomic, Dynamic>(10000)), 1, 10, n, *caller);
- LOG(INFO) << PC_BENCH((MPMCQueue<int, EmulatedFutexAtomic, Dynamic>
- (10000)), 10, 10, n, *caller);
- LOG(INFO) << PC_BENCH((MPMCQueue<int, EmulatedFutexAtomic, Dynamic>
- (100000)), 32, 100, n, *caller);
+ LOG(INFO) << PC_BENCH((QueueType(10)), 1, 1, n, *caller);
+ LOG(INFO) << PC_BENCH((QueueType(10)), 10, 1, n, *caller);
+ LOG(INFO) << PC_BENCH((QueueType(10)), 1, 10, n, *caller);
+ LOG(INFO) << PC_BENCH((QueueType(10)), 10, 10, n, *caller);
+ LOG(INFO) << PC_BENCH((QueueType(10000)), 1, 1, n, *caller);
+ LOG(INFO) << PC_BENCH((QueueType(10000)), 10, 1, n, *caller);
+ LOG(INFO) << PC_BENCH((QueueType(10000)), 1, 10, n, *caller);
+ LOG(INFO) << PC_BENCH((QueueType(10000)), 10, 10, n, *caller);
+ LOG(INFO) << PC_BENCH((QueueType(100000)), 32, 100, n, *caller);
}
}