libfoedus-core
FOEDUS Core Library
foedus::fs::DeviceEmulationOptions Struct Referencefinal

Set of configurations to emulate slower devices for some experiments. More...

Detailed Description

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>

Inheritance diagram for foedus::fs::DeviceEmulationOptions:
Collaboration diagram for foedus::fs::DeviceEmulationOptions:

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...
 
- Public Member Functions inherited from foedus::externalize::Externalizable
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 Public Member Functions inherited from foedus::externalize::Externalizable
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...
 

Constructor & Destructor Documentation

foedus::fs::DeviceEmulationOptions::DeviceEmulationOptions ( )
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_.

37  {
38  disable_direct_io_ = false;
39  null_device_ = false;
43  }
uint32_t emulated_seek_latency_cycles_
[Experiments] additional CPU cycles to busy-wait for each seek.
uint32_t emulated_write_kb_cycles_
[Experiments] additional CPU cycles to busy-wait for each 1KB write.
bool null_device_
[Experiments] as if we write out to /dev/null.
uint32_t emulated_read_kb_cycles_
[Experiments] additional CPU cycles to busy-wait for each 1KB read.
bool disable_direct_io_
[Experiments] Whether to disable Direct I/O and use non-direct I/O instead.

Member Function Documentation

void foedus::fs::DeviceEmulationOptions::assign ( const foedus::externalize::Externalizable other)
inlineoverridevirtual

Polymorphic assign operator.

This should invoke operator= of the derived class.

Parameters
[in]otherassigned value. It must be dynamic-castable to the assignee class.

Implements foedus::externalize::Externalizable.

Definition at line 65 of file device_emulation_options.hpp.

const char* foedus::fs::DeviceEmulationOptions::get_tag_name ( ) const
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.

ErrorStack foedus::fs::DeviceEmulationOptions::load ( tinyxml2::XMLElement *  element)
overridevirtual

Reads the content of this object from the given XML element.

Parameters
[in]elementthe 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_.

22  {
28  return kRetOk;
29 }
#define EXTERNALIZE_LOAD_ELEMENT(element, attribute)
Reads a child xml element to load a member variable of this object.
uint32_t emulated_seek_latency_cycles_
[Experiments] additional CPU cycles to busy-wait for each seek.
uint32_t emulated_write_kb_cycles_
[Experiments] additional CPU cycles to busy-wait for each 1KB write.
const ErrorStack kRetOk
Normal return value for no-error case.
bool null_device_
[Experiments] as if we write out to /dev/null.
uint32_t emulated_read_kb_cycles_
[Experiments] additional CPU cycles to busy-wait for each 1KB read.
bool disable_direct_io_
[Experiments] Whether to disable Direct I/O and use non-direct I/O instead.
ErrorStack foedus::fs::DeviceEmulationOptions::save ( tinyxml2::XMLElement *  element) const
overridevirtual

Writes the content of this object to the given XML element.

Parameters
[in]elementthe 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_.

31  {
33  "Whether to disable Direct I/O and use non-direct I/O instead.");
35  "As if we write out to /dev/null. Used to measure performance w/o I/O.");
37  "additional CPU cycles to busy-wait for each seek. 0 (default) disables it.");
39  "additional CPU cycles to busy-wait for each 1KB read. 0 (default) disables it."
40  " For example, 4kb read is seek+scan*4 cycles, 1MB read is seek+scan*1000 cycles.");
42  "additional CPU cycles to busy-wait for each 1KB write. 0 (default) disables it.");
43  return kRetOk;
44 }
uint32_t emulated_seek_latency_cycles_
[Experiments] additional CPU cycles to busy-wait for each seek.
uint32_t emulated_write_kb_cycles_
[Experiments] additional CPU cycles to busy-wait for each 1KB write.
const ErrorStack kRetOk
Normal return value for no-error case.
#define EXTERNALIZE_SAVE_ELEMENT(element, attribute, comment)
Adds an xml element to represent a member variable of this object.
bool null_device_
[Experiments] as if we write out to /dev/null.
uint32_t emulated_read_kb_cycles_
[Experiments] additional CPU cycles to busy-wait for each 1KB read.
bool disable_direct_io_
[Experiments] Whether to disable Direct I/O and use non-direct I/O instead.

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  o,
const DeviceEmulationOptions v 
)
friend

Definition at line 65 of file device_emulation_options.hpp.

Member Data Documentation

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().


The documentation for this struct was generated from the following files: