timer_registrar.h Source File
|
CPP API
|
timer_registrar.h
Go to the documentation of this file.
166 // print_timers already uses a "single nowait", but the cout for titling the table needs one, too
181 std::ranges::transform(m_register, std::back_inserter(gathered_register), [](const TimerRegistration& r) {
202 MPI_Recv(bytes.data(), bytes.data_size(), MPI_BYTE, snd_rank, 0, mpi::get_world(), MPI_STATUS_IGNORE);
209 rec_register.value(), std::back_inserter(gathered_register), [&](const GatherableRegistration& r) {
218 std::ranges::transform(m_register, std::back_inserter(snd_register), [](const TimerRegistration& r) {
229 std::unique_ptr<Printer> m_printer = std::make_unique<TablePrinter>();
const unsigned char * data() const
Get the pointer to the buffer of the stream.
Definition: binary_serializer.h:111
size_t data_size() const
Get the size of the buffer of the stream.
Definition: binary_serializer.h:124
TimerRegistrar is a singleton to keep track of and print timers. Does not manage storage.
Definition: timer_registrar.h:44
void operator=(TimerRegistrar &&)=delete
TimerRegistrar must not be copied or moved, use TimerRegistrar::get_instance() to access it.
const auto & get_register() const
Returns a read only list of all TimerRegistrations. Can be used to print or evaluate timers.
Definition: timer_registrar.h:80
~TimerRegistrar()
Specify a destructor to allow printing all timers after exit from main.
Definition: timer_registrar.h:161
void gather_timers(mpi::Comm comm, std::list< BasicTimer > &external_timers, std::list< TimerRegistration > &gathered_register) const
Gather timers from all ranks, using external_timers as temporary timer storage for gathered_register.
Definition: timer_registrar.h:174
void set_printer(std::unique_ptr< Printer > &&printer)
Replace the internal printer used for print_timers.
Definition: timer_registrar.h:140
std::unique_ptr< Printer > m_printer
A printer to visualize all timers.
Definition: timer_registrar.h:229
void add_timer(TimerRegistration &®istration)
Add a new timer to the TimerRegistrar.
Definition: timer_registrar.h:72
TimerRegistrar()=default
Instead of constructing a TimerRegistrar, use its static method TimerRegistrar::get_instance().
static TimerRegistrar & get_instance()
Access the TimerRegistrar.
Definition: timer_registrar.h:56
TimerRegistrar(TimerRegistrar &&)=delete
TimerRegistrar must not be copied or moved, use TimerRegistrar::get_instance() to access it.
void print_gathered_timers(mpi::Comm comm, std::ostream &out=std::cout)
Print all timers gathered on the given MPI Comm using a Printer.
Definition: timer_registrar.h:108
TimerRegistrar(TimerRegistrar &)=delete
TimerRegistrar must not be copied or moved, use TimerRegistrar::get_instance() to access it.
std::list< TimerRegistration > m_register
List that allows access to timers without having their name.
Definition: timer_registrar.h:231
std::mutex m_registration_lock
Lock to safeguard m_register against concurrent writes.
Definition: timer_registrar.h:232
void print_timers(std::ostream &out=std::cout) const
Print all timers using a Printer.
Definition: timer_registrar.h:92
void operator=(TimerRegistrar &)=delete
TimerRegistrar must not be copied or moved, use TimerRegistrar::get_instance() to access it.
bool m_print_on_death
Whether to call m_printer during the destructor.
Definition: timer_registrar.h:230
void disable_final_timer_summary()
Prevent the TimerRegistrar from calling print_timers on exit from main.
Definition: timer_registrar.h:122
bool is_root()
Returns true if the calling process is the root process.
Definition: miompi.cpp:58
void * Comm
Alias for MPI_Comm, to be used in APIs to avoid having to use #ifdef everywhere.
Definition: miompi.h:40
A collection of classes to simplify handling of matrix shapes in meta programming.
Definition: models/abm/analyze_result.h:30
boost::outcome_v2::in_place_type_t< T > Tag
Type that is used for overload resolution.
Definition: io.h:407
IOResult< T > deserialize_binary(ByteStream &stream, Tag< T >, int flags=0)
Deserialize an object from binary format.
Definition: binary_serializer.h:468
void log_error(spdlog::string_view_t fmt, const Args &... args)
Definition: logging.h:100
ByteStream serialize_binary(const T &t, int flags=0)
Serialize an object into binary format.
Definition: binary_serializer.h:452
void unused(T &&...)
Does nothing, can be used to mark variables as not used.
Definition: compiler_diagnostics.h:30
Generated by