libfoedus-core
FOEDUS Core Library
|
Set of configurations to emulate slower devices for some experiments. More...
Set of configurations to emulate slower devices for some experiments.
For snapshot files and log files, we have an option to emulate slower devices. In some experiments, we use them to emulate NVM/SSD/etc on DRAM (RAMDisk). This is a POD.
Definition at line 36 of file device_emulation_options.hpp.
#include <device_emulation_options.hpp>
Public Member Functions | |
DeviceEmulationOptions () | |
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... | |
![]() | |
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 | |
bool | disable_direct_io_ |
[Experiments] Whether to disable Direct I/O and use non-direct I/O instead. More... | |
bool | null_device_ |
[Experiments] as if we write out to /dev/null. More... | |
uint32_t | emulated_seek_latency_cycles_ |
[Experiments] additional CPU cycles to busy-wait for each seek. More... | |
uint32_t | emulated_read_kb_cycles_ |
[Experiments] additional CPU cycles to busy-wait for each 1KB read. More... | |
uint32_t | emulated_write_kb_cycles_ |
[Experiments] additional CPU cycles to busy-wait for each 1KB write. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &o, const DeviceEmulationOptions &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... | |
|
inline |
Definition at line 37 of file device_emulation_options.hpp.
References disable_direct_io_, emulated_read_kb_cycles_, emulated_seek_latency_cycles_, emulated_write_kb_cycles_, and null_device_.
|
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 65 of file device_emulation_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 65 of file device_emulation_options.hpp.
|
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 22 of file device_emulation_options.cpp.
References disable_direct_io_, emulated_read_kb_cycles_, emulated_seek_latency_cycles_, emulated_write_kb_cycles_, EXTERNALIZE_LOAD_ELEMENT, foedus::kRetOk, and null_device_.
|
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 31 of file device_emulation_options.cpp.
References disable_direct_io_, emulated_read_kb_cycles_, emulated_seek_latency_cycles_, emulated_write_kb_cycles_, EXTERNALIZE_SAVE_ELEMENT, foedus::kRetOk, and null_device_.
|
friend |
Definition at line 65 of file device_emulation_options.hpp.
bool foedus::fs::DeviceEmulationOptions::disable_direct_io_ |
[Experiments] Whether to disable Direct I/O and use non-direct I/O instead.
Definition at line 46 of file device_emulation_options.hpp.
Referenced by DeviceEmulationOptions(), load(), foedus::fs::DirectIoFile::open(), foedus::fs::DirectIoFile::read_raw(), save(), and foedus::fs::DirectIoFile::write_raw().
uint32_t foedus::fs::DeviceEmulationOptions::emulated_read_kb_cycles_ |
[Experiments] additional CPU cycles to busy-wait for each 1KB read.
0 (default) disables it. For example, 4kb read is seek+read*4 cycles, 1MB read is seek+read*1024 cycles.
Definition at line 58 of file device_emulation_options.hpp.
Referenced by DeviceEmulationOptions(), load(), foedus::fs::DirectIoFile::read_raw(), and save().
uint32_t foedus::fs::DeviceEmulationOptions::emulated_seek_latency_cycles_ |
[Experiments] additional CPU cycles to busy-wait for each seek.
0 (default) disables it.
Definition at line 52 of file device_emulation_options.hpp.
Referenced by DeviceEmulationOptions(), load(), save(), and foedus::fs::DirectIoFile::seek().
uint32_t foedus::fs::DeviceEmulationOptions::emulated_write_kb_cycles_ |
[Experiments] additional CPU cycles to busy-wait for each 1KB write.
0 (default) disables it.
Definition at line 63 of file device_emulation_options.hpp.
Referenced by DeviceEmulationOptions(), load(), save(), and foedus::fs::DirectIoFile::write_raw().
bool foedus::fs::DeviceEmulationOptions::null_device_ |
[Experiments] as if we write out to /dev/null.
Used to measure performance w/o I/O
Definition at line 49 of file device_emulation_options.hpp.
Referenced by DeviceEmulationOptions(), load(), foedus::xct::XctManagerPimpl::precommit_xct_readwrite(), foedus::fs::DirectIoFile::read(), foedus::fs::DirectIoFile::read_raw(), save(), foedus::fs::DirectIoFile::seek(), foedus::fs::DirectIoFile::sync(), foedus::fs::DirectIoFile::truncate(), foedus::log::ThreadLogBuffer::wait_for_space(), and foedus::fs::DirectIoFile::write_raw().