libfoedus-core
FOEDUS Core Library
|
Set of options about threads and thread-groups. More...
Set of options about threads and thread-groups.
This is a POD struct. Default destructor/copy-constructor/assignment operator work fine.
Definition at line 31 of file thread_options.hpp.
#include <thread_options.hpp>
Public Member Functions | |
ThreadOptions () | |
Constructs option values with default values. More... | |
ErrorStack | load (tinyxml2::XMLElement *element) override |
Reads the content of this object from the given XML element. More... | |
ErrorStack | save (tinyxml2::XMLElement *element) const override |
Writes the content of this object to the given XML element. More... | |
const char * | get_tag_name () const override |
Returns an XML tag name for this object as a root element. More... | |
void | assign (const foedus::externalize::Externalizable *other) override |
Polymorphic assign operator. More... | |
ThreadId | get_total_thread_count () const |
![]() | |
ErrorStack | load_from_string (const std::string &xml) |
Load the content of this object from the given XML string. More... | |
void | save_to_stream (std::ostream *ptr) const |
Invokes save() and directs the resulting XML text to the given stream. More... | |
ErrorStack | load_from_file (const fs::Path &path) |
Load the content of this object from the specified XML file. More... | |
ErrorStack | save_to_file (const fs::Path &path) const |
Atomically and durably writes out this object to the specified XML file. More... | |
Public Attributes | |
uint16_t | group_count_ |
Number of ThreadGroup in the engine. More... | |
ThreadLocalOrdinal | thread_count_per_group_ |
Number of Thread in each ThreadGroup. More... | |
bool | overwrite_thread_schedule_ |
Whether to overwrite policy/priority of worker threads. More... | |
ThreadPolicy | thread_policy_ |
Thread policy for worker threads. More... | |
ThreadPriority | thread_priority_ |
Thread priority for worker threads. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &o, const ThreadOptions &v) |
Additional Inherited Members | |
![]() | |
static ErrorStack | insert_comment (tinyxml2::XMLElement *element, const std::string &comment) |
static ErrorStack | append_comment (tinyxml2::XMLElement *parent, const std::string &comment) |
static ErrorStack | create_element (tinyxml2::XMLElement *parent, const std::string &name, tinyxml2::XMLElement **out) |
template<typename T > | |
static ErrorStack | add_element (tinyxml2::XMLElement *parent, const std::string &tag, const std::string &comment, T value) |
Only declaration in header. More... | |
template<uint MAXLEN, typename CHAR > | |
static ErrorStack | add_element (tinyxml2::XMLElement *parent, const std::string &tag, const std::string &comment, const assorted::FixedString< MAXLEN, CHAR > &value) |
template<typename T > | |
static ErrorStack | add_element (tinyxml2::XMLElement *parent, const std::string &tag, const std::string &comment, const std::vector< T > &value) |
vector version More... | |
template<typename ENUM > | |
static ErrorStack | add_enum_element (tinyxml2::XMLElement *parent, const std::string &tag, const std::string &comment, ENUM value) |
enum version More... | |
static ErrorStack | add_child_element (tinyxml2::XMLElement *parent, const std::string &tag, const std::string &comment, const Externalizable &child) |
child Externalizable version More... | |
template<typename T > | |
static ErrorStack | get_element (tinyxml2::XMLElement *parent, const std::string &tag, T *out, bool optional=false, T value=0) |
Only declaration in header. More... | |
static ErrorStack | get_element (tinyxml2::XMLElement *parent, const std::string &tag, std::string *out, bool optional=false, const char *value="") |
string type is bit special. More... | |
template<uint MAXLEN, typename CHAR > | |
static ErrorStack | get_element (tinyxml2::XMLElement *parent, const std::string &tag, assorted::FixedString< MAXLEN, CHAR > *out, bool optional=false, const assorted::FixedString< MAXLEN, CHAR > &value=assorted::FixedString< MAXLEN, CHAR >()) |
template<typename ENUM > | |
static ErrorStack | get_enum_element (tinyxml2::XMLElement *parent, const std::string &tag, ENUM *out, bool optional=false, ENUM default_value=static_cast< ENUM >(0)) |
enum version More... | |
template<typename T > | |
static ErrorStack | get_element (tinyxml2::XMLElement *parent, const std::string &tag, std::vector< T > *out, bool optional=false) |
vector version. More... | |
static ErrorStack | get_child_element (tinyxml2::XMLElement *parent, const std::string &tag, Externalizable *child, bool optional=false) |
child Externalizable version More... | |
foedus::thread::ThreadOptions::ThreadOptions | ( | ) |
Constructs option values with default values.
Definition at line 28 of file thread_options.cpp.
References group_count_, foedus::thread::kPriorityDefault, foedus::thread::kScheduleFifo, numa_available(), numa_num_configured_cpus(), numa_num_configured_nodes(), overwrite_thread_schedule_, thread_count_per_group_, thread_policy_, and thread_priority_.
|
inlineoverridevirtual |
Polymorphic assign operator.
This should invoke operator= of the derived class.
[in] | other | assigned value. It must be dynamic-castable to the assignee class. |
Implements foedus::externalize::Externalizable.
Definition at line 60 of file thread_options.hpp.
|
inlineoverridevirtual |
Returns an XML tag name for this object as a root element.
We might want to give a different name for same externalizable objects, so this is used only when it is the root element of xml.
Implements foedus::externalize::Externalizable.
Definition at line 60 of file thread_options.hpp.
|
inline |
Definition at line 62 of file thread_options.hpp.
References thread_count_per_group_.
Referenced by foedus::EngineOptions::calculate_required_memory(), foedus::cache::CacheManagerPimpl::initialize_once(), foedus::log::LogManagerPimpl::initialize_once(), and foedus::EngineOptions::prescreen_ulimits().
|
overridevirtual |
Reads the content of this object from the given XML element.
[in] | element | the XML element that represents this object |
Expect errors due to missing-elements, out-of-range values, etc.
Implements foedus::externalize::Externalizable.
Definition at line 50 of file thread_options.cpp.
References EXTERNALIZE_LOAD_ELEMENT, EXTERNALIZE_LOAD_ENUM_ELEMENT, group_count_, foedus::kRetOk, overwrite_thread_schedule_, thread_count_per_group_, thread_policy_, and thread_priority_.
|
overridevirtual |
Writes the content of this object to the given XML element.
[in] | element | the XML element that represents this object |
Expect only out-of-memory error. We receive the XML element this object will represent, so this method does not determine the XML element name of itself. The parent object determines children's tag names because one parent object might have multiple child objects of the same type with different XML element name.
Implements foedus::externalize::Externalizable.
Definition at line 59 of file thread_options.cpp.
References CHECK_ERROR, EXTERNALIZE_SAVE_ELEMENT, EXTERNALIZE_SAVE_ENUM_ELEMENT, group_count_, foedus::externalize::Externalizable::insert_comment(), foedus::kRetOk, overwrite_thread_schedule_, thread_count_per_group_, thread_policy_, and thread_priority_.
|
friend |
Definition at line 60 of file thread_options.hpp.
uint16_t foedus::thread::ThreadOptions::group_count_ |
Number of ThreadGroup in the engine.
Default value is hardware NUMA node count (numa_num_configured_nodes()). Note that the type of this value is NOT ThreadGroupId so that we can handle 256 NUMA nodes. Otherwise 256 becomes 0.
Definition at line 43 of file thread_options.hpp.
Referenced by foedus::memory::NumaCoreMemory::calculate_local_small_memory_size(), foedus::EngineOptions::calculate_required_memory(), foedus::storage::array::ArrayPartitioner::design_partition(), foedus::storage::sequential::SequentialStoragePimpl::drop(), foedus::storage::sequential::SequentialComposer::drop_volatiles(), foedus::memory::EngineMemory::dump_free_memory_stat(), foedus::storage::sequential::SequentialStoragePimpl::for_every_page(), foedus::storage::sequential::SequentialStoragePimpl::get_head_pointer(), foedus::Engine::get_soc_count(), foedus::storage::sequential::SequentialStoragePimpl::get_tail_pointer(), foedus::storage::sequential::SequentialStoragePimpl::initialize_head_tail_pages(), foedus::soc::SocManagerPimpl::initialize_master(), foedus::memory::EngineMemory::initialize_once(), foedus::memory::NumaCoreMemory::initialize_once(), foedus::EnginePimpl::initialize_once(), foedus::proc::ProcManagerPimpl::initialize_once(), foedus::log::LogManagerPimpl::initialize_once(), foedus::savepoint::SavepointManagerPimpl::initialize_once(), foedus::snapshot::SnapshotManagerPimpl::initialize_once(), foedus::soc::SocManagerPimpl::launch_emulated_children(), foedus::soc::SocManagerPimpl::launch_forked_children(), foedus::soc::SocManagerPimpl::launch_spawned_children(), load(), save(), ThreadOptions(), foedus::savepoint::SavepointManagerPimpl::update_shared_savepoint(), foedus::soc::SocManagerPimpl::wait_for_child_attach(), foedus::soc::SocManagerPimpl::wait_for_child_terminate(), and foedus::soc::SocManagerPimpl::wait_for_children_module().
bool foedus::thread::ThreadOptions::overwrite_thread_schedule_ |
Whether to overwrite policy/priority of worker threads.
default false.
Definition at line 53 of file thread_options.hpp.
Referenced by load(), save(), foedus::thread::ThreadPimpl::set_thread_schedule(), and ThreadOptions().
ThreadLocalOrdinal foedus::thread::ThreadOptions::thread_count_per_group_ |
Number of Thread in each ThreadGroup.
Default value is hardware NUMA core count; numa_num_configured_cpus() / numa_num_configured_nodes().
Definition at line 50 of file thread_options.hpp.
Referenced by foedus::soc::NodeMemoryAnchors::allocate_arrays(), foedus::memory::NumaCoreMemory::calculate_local_small_memory_size(), foedus::soc::SharedMemoryRepo::calculate_node_memory_size(), foedus::storage::sequential::SequentialStoragePimpl::drop(), foedus::storage::sequential::SequentialComposer::drop_volatiles(), foedus::storage::sequential::SequentialStoragePimpl::for_every_page(), foedus::storage::sequential::SequentialStoragePimpl::get_head_pointer(), foedus::storage::sequential::SequentialStoragePimpl::get_tail_pointer(), get_total_thread_count(), foedus::thread::ThreadPoolPimpl::impersonate(), foedus::thread::ThreadPoolPimpl::impersonate_on_numa_node(), foedus::thread::ThreadGroup::initialize_once(), foedus::memory::NumaCoreMemory::initialize_once(), foedus::log::LogManagerPimpl::initialize_once(), load(), save(), foedus::thread::ThreadGroupRef::ThreadGroupRef(), and ThreadOptions().
ThreadPolicy foedus::thread::ThreadOptions::thread_policy_ |
Thread policy for worker threads.
ignored if overwrite_thread_schedule_==false
Definition at line 56 of file thread_options.hpp.
Referenced by load(), save(), foedus::thread::ThreadPimpl::set_thread_schedule(), and ThreadOptions().
ThreadPriority foedus::thread::ThreadOptions::thread_priority_ |
Thread priority for worker threads.
ignored if overwrite_thread_schedule_==false
Definition at line 58 of file thread_options.hpp.
Referenced by load(), save(), foedus::thread::ThreadPimpl::set_thread_schedule(), and ThreadOptions().