Commit 8bc6aa1c authored by Dominik Charousset's avatar Dominik Charousset

Collect all default settings in extra header

parent 04ede6c4
......@@ -40,6 +40,7 @@ set(LIBCAF_CORE_SRCS
src/config_value.cpp
src/decorated_tuple.cpp
src/default_attachable.cpp
src/defaults.cpp
src/deserializer.cpp
src/downstream_manager.cpp
src/downstream_manager_base.cpp
......
/******************************************************************************
* ____ _ _____ *
* / ___| / \ | ___| C++ *
* | | / _ \ | |_ Actor *
* | |___ / ___ \| _| Framework *
* \____/_/ \_|_| *
* *
* Copyright 2011-2018 Dominik Charousset *
* *
* Distributed under the terms and conditions of the BSD 3-Clause License or *
* (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* *
* If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and *
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
#pragma once
#include <chrono>
#include <cstddef>
#include "caf/atom.hpp"
#include "caf/timestamp.hpp"
// -- hard-coded default values for various CAF options ------------------------
namespace caf {
namespace defaults {
namespace streaming {
extern const timespan desired_batch_complexity;
extern const timespan max_batch_delay;
extern const timespan credit_round_interval;
} // namespace streaming
namespace scheduler {
extern const atom_value policy;
extern const size_t max_threads;
extern const size_t max_throughput;
extern const bool enable_profiling;
extern const timespan profiling_resolution;
} // namespace scheduler
namespace work_stealing {
extern const size_t aggressive_poll_attempts;
extern const size_t aggressive_steal_interval;
extern const size_t moderate_poll_attempts;
extern const size_t moderate_steal_interval;
extern const timespan moderate_sleep_duration;
extern const size_t relaxed_steal_interval;
extern const timespan relaxed_sleep_duration;
} // namespace work_stealing
namespace logger {
extern const char* file_name;
extern const char* file_format;
extern const atom_value console;
extern const char* console_format;
extern const atom_value verbosity;
extern const bool inline_output;
} // namespace logger
namespace middleman {
extern const atom_value network_backend;
extern const bool enable_automatic_connections;
extern const size_t max_consecutive_reads;
extern const size_t heartbeat_interval;
extern const bool detach_utility_actors;
extern const bool detach_multiplexer;
extern const bool enable_tcp;
extern const bool enable_udp;
extern const size_t cached_udp_buffers;
extern const size_t max_pending_msgs;
} // namespace middleman
} // namespace defaults
} // namespace caf
/******************************************************************************
* ____ _ _____ *
* / ___| / \ | ___| C++ *
* | | / _ \ | |_ Actor *
* | |___ / ___ \| _| Framework *
* \____/_/ \_|_| *
* *
* Copyright 2011-2018 Dominik Charousset *
* *
* Distributed under the terms and conditions of the BSD 3-Clause License or *
* (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* *
* If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and *
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
#include "caf/defaults.hpp"
#include <algorithm>
#include <limits>
#include <thread>
namespace {
using us_t = std::chrono::microseconds;
constexpr caf::timespan us(us_t::rep x) {
return std::chrono::duration_cast<caf::timespan>(us_t{x});
}
using ms_t = std::chrono::milliseconds;
constexpr caf::timespan ms(ms_t::rep x) {
return std::chrono::duration_cast<caf::timespan>(ms_t{x});
}
} // namespace <anonymous>
namespace caf {
namespace defaults {
namespace streaming {
const timespan desired_batch_complexity = us(50);
const timespan max_batch_delay = ms(5);
const timespan credit_round_interval = ms(10);
} // namespace streaming
namespace scheduler {
const atom_value policy = atom("stealing");
const size_t max_threads = std::max(std::thread::hardware_concurrency(), 4u);
const size_t max_throughput = std::numeric_limits<size_t>::max();
const bool enable_profiling = false;
const timespan profiling_resolution = ms(100);
} // namespace scheduler
namespace work_stealing {
const size_t aggressive_poll_attempts = 100;
const size_t aggressive_steal_interval = 10;
const size_t moderate_poll_attempts = 500;
const size_t moderate_steal_interval = 5;
const timespan moderate_sleep_duration = us(50);
const size_t relaxed_steal_interval = 1;
const timespan relaxed_sleep_duration = ms(10);
} // namespace work_stealing
namespace logger {
const char* file_name = "actor_log_[PID]_[TIMESTAMP]_[NODE].log";
const char* file_format = "%r %c %p %a %t %C %M %F:%L %m%n";
const atom_value console = atom("none");
const char* console_format = "%m";
const atom_value verbosity = atom("trace");
const bool inline_output = false;
} // namespace logger
namespace middleman {
const atom_value network_backend = atom("default");
const bool enable_automatic_connections = false;
const size_t max_consecutive_reads = 50;
const size_t heartbeat_interval = 0;
const bool detach_utility_actors = true;
const bool detach_multiplexer = true;
const bool enable_tcp = true;
const bool enable_udp = false;
const size_t cached_udp_buffers = 10;
const size_t max_pending_msgs = 10;
} // namespace middleman
} // namespace defaults
} // namespace caf
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