35 XMLTag tag(*
this,
"profiling", XMLTag::OCCUR_NOT_OR_ONCE);
36 tag.setDocumentation(
"Allows configuring the profiling functionality of preCICE.");
38 auto attrMode = makeXMLAttribute<std::string>(
"mode",
DEFAULT_MODE)
40 .setDocumentation(
"Operational modes of the profiling. "
41 "\"fundamental\" will only write fundamental events. "
42 "\"all\" writes all events.");
43 tag.addAttribute(attrMode);
46 .setDocumentation(
"Set the amount of event records that should be kept in memory before flushing them to file. "
47 "One event consists out of multiple records."
48 "0 keeps all records in memory and writes them at the end of the program, useful for slower network filesystems. "
49 "1 writes records directly to the file, useful to get profiling data despite program crashes. "
50 "Settings greater than 1 keep records in memory and write them to file in blocks, which is recommended.");
51 tag.addAttribute(attrFlush);
53 auto attrDirectory = makeXMLAttribute<std::string>(
"directory",
DEFAULT_DIRECTORY)
54 .setDocumentation(
"Directory to use as a root directory to write the events to. "
55 "Events will be written to `<directory>/precice-profiling/`");
56 tag.addAttribute(attrDirectory);
59 .
setDocumentation(
"Enables additional inter- and intra-participant synchronization points. "
60 "This avoids measuring blocking time for communication and other collective operations.");
61 tag.addAttribute(attrSynchronize);
74 PRECICE_CHECK(flushEvery >= 0,
"You configured the profiling to flush-every=\"{}\", which is invalid. "
75 "Please choose a number >= 0.");
80 er.setWriteQueueMax(flushEvery);
82 directory /=
"precice-profiling";
83 er.setDirectory(directory.string());
85 er.setMode(fromString(mode));
96 directory /=
"precice-profiling";
97 er.setDirectory(directory.string());
#define PRECICE_CHECK(check,...)
#define PRECICE_UNREACHABLE(...)
static EventRegistry & instance()
Returns the only instance (singleton) of the EventRegistry class.
ProfilingConfiguration(xml::XMLTag &parent)
void xmlTagCallback(const xml::ConfigurationContext &context, xml::XMLTag &callingTag) override
Callback at begin of XML tag.
XMLAttribute & setDocumentation(std::string documentation)
Sets a documentation string for the attribute.
Represents an XML tag to be configured automatically.
std::string getStringAttributeValue(const std::string &name, std::optional< std::string > default_value=std::nullopt) const
bool getBooleanAttributeValue(const std::string &name, std::optional< bool > default_value=std::nullopt) const
int getIntAttributeValue(const std::string &name, std::optional< int > default_value=std::nullopt) const
XMLTag & addSubtag(const XMLTag &tag)
Adds an XML tag as subtag by making a copy of the given tag.
contains profiling utilities.
constexpr const char * DEFAULT_DIRECTORY
constexpr const char * MODE_ALL
constexpr const char * MODE_OFF
Mode
The Mode of the Event utility.
constexpr const char * MODE_FUNDAMENTAL
constexpr int DEFAULT_SYNC_EVERY
constexpr const char * DEFAULT_MODE
XMLAttribute< std::string > makeXMLAttribute(std::string name, const char *defaultValue)
Main namespace of the precice library.
bool syncMode
Enabled further inter- and intra-solver synchronisation.
Tightly coupled to the parameters of Participant()