37 XMLTag tag(*
this,
"profiling", XMLTag::OCCUR_NOT_OR_ONCE);
38 tag.setDocumentation(
"Allows configuring the profiling functionality of preCICE.");
40 auto attrMode = makeXMLAttribute<std::string>(
"mode",
DEFAULT_MODE)
42 .setDocumentation(
"Operational modes of the profiling. "
43 "\"fundamental\" will only write fundamental steering events. "
44 "\"api\" will write events of the complete API. "
45 "\"all\" writes all events.");
46 tag.addAttribute(attrMode);
49 .setDocumentation(
"Set the amount of event records that should be kept in memory before flushing them to file. "
50 "One event consists out of multiple records. "
51 "0 keeps all records in memory and writes them at the end of the program, useful for slower network filesystems. "
52 "1 writes records directly to the file, useful to get profiling data despite program crashes. "
53 "Settings greater than 1 keep records in memory and write them to file in blocks, which is recommended.");
54 tag.addAttribute(attrFlush);
56 auto attrDirectory = makeXMLAttribute<std::string>(
"directory",
DEFAULT_DIRECTORY)
57 .setDocumentation(
"Directory to use as a root directory to write the events to. "
58 "Events will be written to `<directory>/precice-profiling/`");
59 tag.addAttribute(attrDirectory);
62 .setDocumentation(
"Enables additional inter- and intra-participant synchronization points. "
63 "This avoids measuring blocking time for communication and other collective operations.");
64 tag.addAttribute(attrSynchronize);
77 PRECICE_CHECK(flushEvery >= 0,
"You configured the profiling to flush-every=\"{}\", which is invalid. "
78 "Please choose a number >= 0.");
83 er.setWriteQueueMax(flushEvery);
85 directory /=
"precice-profiling";
86 er.setDirectory(directory.string());
88 er.setMode(fromString(mode));
99 directory /=
"precice-profiling";
100 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.
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 * MODE_API
constexpr const char * DEFAULT_MODE
contains the XML configuration parser.
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()