102 return "fundamental";
113 PRECICE_DEBUG(
"Profiling is turned off. Backend will not start.");
125 "The destination folder \"{}\" exists but isn't a directory. Please remove the directory \"precice-run\" and try again.",
132 PRECICE_DEBUG(
"Starting backend with events-file: \"{}\"", filename);
215 Event::Clock::time_point initClock;
218 auto sinceInit(Event::Clock::time_point tp)
223 void operator()(
const StartEntry &se)
226 R
"({}{{"et":"{}","eid":{},"ts":{}}})",
227 prefix, se.type, se.eid, sinceInit(se.clock));
230 void operator()(
const StopEntry &se)
233 R
"({}{{"et":"{}","eid":{},"ts":{}}})",
234 prefix, se.type, se.eid, sinceInit(se.clock));
237 void operator()(
const DataEntry &de)
240 R
"({}{{"et":"{}","eid":{},"ts":{},"dn":{},"dv":"{}"}})",
241 prefix, de.type, de.eid, sinceInit(de.clock), de.did, de.dvalue);
247 R
"({}{{"et":"n","en":"{}","eid":{}}})",
284 _writeQueue.emplace_back(NameEntry{std::string(name),
id});
#define PRECICE_DEBUG(...)
#define PRECICE_CHECK(check,...)
#define PRECICE_ASSERT(...)
#define PRECICE_UNREACHABLE(...)
static EventRegistry & instance()
Returns the only instance (singleton) of the EventRegistry class.
void startBackend()
Create the file and starts the filestream if profiling is turned on.
void initialize(std::string_view applicationName, int rank=0, int size=1)
Sets the global start time.
void clear()
Clears the registry.
void setWriteQueueMax(std::size_t size)
Sets the maximum size of the writequeue before calling flush(). Use 0 to flush on destruction.
void setDirectory(std::string_view directory)
Sets the directory where to write the event files to.
int nameToID(std::string_view name)
int _size
The amount of parallel instances of the current program.
void finalize()
Sets the global end time and flushes buffers.
void setMode(Mode mode)
Sets the operational mode of the registry.
void stopBackend()
Stops the global event, flushes the buffers and closes the filestream.
Mode _mode
The operational mode of the registry.
std::vector< PendingEntry > _writeQueue
bool _firstwrite
Indicator for the first record to be written.
void put(PendingEntry pe)
Records an event.
std::map< std::string, int, std::less<> > _nameDict
int _rank
The rank/number of parallel instance of the current program.
std::size_t _writeQueueMax
Event::Clock::time_point _initClock
The initial time clock, used to take runtime measurements.
std::optional< int > _globalId
The id of the global event.
std::string _applicationName
The name of the current participant.
void putCritical(PendingEntry pe)
Records an event without flushing events.
EventRegistry(EventRegistry const &)=delete
Deleted copy and move SMFs for singleton pattern.
void flush()
Writes all recorded events to file and flushes the buffer.
std::chrono::system_clock::time_point _initTime
The initial time, used to describe when the run started.
T create_directories(T... args)
T duration_cast(T... args)
T holds_alternative(T... args)
T is_directory(T... args)
contains profiling utilities.
std::chrono::system_clock sys_clk
std::chrono::steady_clock stdy_clk
Mode
The Mode of the Event utility.
std::variant< StartEntry, StopEntry, DataEntry, NameEntry > PendingEntry
std::string timepoint_to_string(sys_clk::time_point c)
Converts the time_point into a string like "2019-01-10T18:30:46.834".