The place where all timed sections will be stored. More...
#include <PerfGraphRegistry.h>
Public Member Functions | |
PerfID | registerSection (const std::string §ion_name, const unsigned int level) |
Call to register a named section for timing. More... | |
PerfID | registerSection (const std::string §ion_name, const unsigned int level, const std::string &live_message, const bool print_dots=true) |
Call to register a named section for timing. More... | |
PerfID | sectionID (const std::string §ion_name) const |
Given a name return the PerfID The name of the section. More... | |
const PerfGraphSectionInfo & | sectionInfo (const PerfID section_id) const |
Given a PerfID return the PerfGraphSectionInfo The ID. More... | |
bool | sectionExists (const std::string §ion_name) const |
Whether or not a section with that name has been registered The name of the section. More... | |
bool | sectionExists (const PerfID section_id) const |
Whether or not a section with that id has been registered The ID. More... | |
std::size_t | numSections () const |
Private Member Functions | |
PerfGraphRegistry () | |
PerfID | actuallyRegisterSection (const std::string §ion_name, const unsigned int level, const std::string &live_message, const bool print_dots=true) |
The internal function that actually carries out the registration. More... | |
const PerfGraphSectionInfo & | readSectionInfo (PerfID section_id) const |
Special accessor just for PerfGraph so that no locking is needed in PerfGraph. More... | |
friend | void ::dataStore (std::ostream &, PerfGraph &, void *) |
std::size_t | size () const |
std::size_t | id (const std::string &key) const |
bool | keyExists (const std::string &key) const |
bool | idExists (const std::size_t id) const |
const PerfGraphSectionInfo & | item (const std::size_t id) const |
const PerfGraphSectionInfo & | itemNonLocking (const std::size_t id) const |
std::size_t | registerItem (const std::string &key, CreateItem &create_item) |
Registers an item with key key if said key does not exist. More... | |
Private Attributes | |
friend | PerfGraph |
This is only here so that PerfGraph can access readSectionInfo. More... | |
const std::string | _name |
The name of this registry; used in error handling. More... | |
std::unordered_map< std::string, std::size_t, std::hash< std::string > > | _key_to_id |
Map of keys to IDs. More... | |
std::deque< PerfGraphSectionInfo > | _id_to_item |
Vector of IDs to Items. More... | |
std::mutex | _key_to_id_mutex |
Mutex for locking access to _key_to_id NOTE: These can be changed to shared_mutexes once we get C++17. More... | |
std::mutex | _id_to_item_mutex |
Mutex for locking access to _id_to_item NOTE: These can be changed to shared_mutexes once we get C++17. More... | |
Friends | |
PerfGraphRegistry & | getPerfGraphRegistry () |
So it can be constructed. More... | |
The place where all timed sections will be stored.
Definition at line 80 of file PerfGraphRegistry.h.
|
private |
Definition at line 28 of file PerfGraphRegistry.C.
|
private |
The internal function that actually carries out the registration.
Definition at line 55 of file PerfGraphRegistry.C.
Referenced by registerSection().
|
inherited |
key
Definition at line 97 of file GeneralRegistry.h.
Referenced by actuallyRegisterSection(), and sectionID().
|
inherited |
id
is registered Definition at line 116 of file GeneralRegistry.h.
Referenced by sectionExists().
|
inherited |
key
(thread safe) Definition at line 124 of file GeneralRegistry.h.
Referenced by sectionInfo().
|
protectedinherited |
key
(not thread safe) Definition at line 132 of file GeneralRegistry.h.
Referenced by readSectionInfo().
|
inherited |
key
is registered Definition at line 108 of file GeneralRegistry.h.
Referenced by sectionExists().
|
inline |
Definition at line 140 of file PerfGraphRegistry.h.
Referenced by PerfGraph::update().
|
inlineprivate |
Special accessor just for PerfGraph so that no locking is needed in PerfGraph.
This could probably be removed once we have C++17 with shared_mutex
This function is NOT threadsafe - but it is ok for PerfGraph to call it because only the main thread will be registering sections and only the main thread will be running PerfGraph routines
Definition at line 165 of file PerfGraphRegistry.h.
Referenced by PerfGraph::pop(), PerfGraph::push(), PerfGraph::recursivelyUpdate(), and PerfGraph::treeRecurseInternal().
|
protectedinherited |
Registers an item with key key
if said key does not exist.
key | The key |
create_item | Lambda called to create an item if the key does not exist. Takes a single argument std::size_t which is the new ID and should return an Item |
Definition at line 142 of file GeneralRegistry.h.
Referenced by actuallyRegisterSection().
unsigned int moose::internal::PerfGraphRegistry::registerSection | ( | const std::string & | section_name, |
const unsigned int | level | ||
) |
Call to register a named section for timing.
section_name | The name of the code section to be timed |
level | The importance of the timer - lower is more important (0 will always come out) |
Definition at line 34 of file PerfGraphRegistry.C.
Referenced by dataLoad(), and PerfGraphInterface::registerTimedSection().
PerfID moose::internal::PerfGraphRegistry::registerSection | ( | const std::string & | section_name, |
const unsigned int | level, | ||
const std::string & | live_message, | ||
const bool | print_dots = true |
||
) |
Call to register a named section for timing.
section_name | The name of the code section to be timed |
level | The importance of the timer - lower is more important (0 will always come out) |
live_message | The message to be printed to the screen during execution |
print_dots | Whether or not progress dots should be printed for this section |
Definition at line 40 of file PerfGraphRegistry.C.
|
inline |
Whether or not a section with that name has been registered The name of the section.
Definition at line 128 of file PerfGraphRegistry.h.
Referenced by PerfGraphLivePrint::printStats(), PerfGraph::sectionData(), and PerfGraph::treeRecurseInternal().
|
inline |
Whether or not a section with that id has been registered The ID.
Definition at line 135 of file PerfGraphRegistry.h.
|
inline |
Given a name return the PerfID The name of the section.
Definition at line 111 of file PerfGraphRegistry.h.
Referenced by dataLoad(), PerfGraphInterface::registerTimedSection(), and PerfGraph::update().
|
inline |
Given a PerfID return the PerfGraphSectionInfo The ID.
Definition at line 118 of file PerfGraphRegistry.h.
Referenced by dataStore(), PerfGraphLivePrint::inSamePlace(), PerfGraph::printHeaviestSections(), PerfGraphLivePrint::printLiveMessage(), PerfGraphLivePrint::printStats(), and to_json().
|
inherited |
Definition at line 89 of file GeneralRegistry.h.
Referenced by numSections().
|
private |
|
friend |
So it can be constructed.
Definition at line 20 of file PerfGraphRegistry.C.
|
protectedinherited |
Vector of IDs to Items.
Definition at line 72 of file GeneralRegistry.h.
|
mutableprotectedinherited |
Mutex for locking access to _id_to_item NOTE: These can be changed to shared_mutexes once we get C++17.
Definition at line 79 of file GeneralRegistry.h.
|
protectedinherited |
Map of keys to IDs.
Definition at line 70 of file GeneralRegistry.h.
|
mutableprotectedinherited |
Mutex for locking access to _key_to_id NOTE: These can be changed to shared_mutexes once we get C++17.
Definition at line 76 of file GeneralRegistry.h.
|
protectedinherited |
The name of this registry; used in error handling.
Definition at line 67 of file GeneralRegistry.h.
|
private |
This is only here so that PerfGraph can access readSectionInfo.
Definition at line 173 of file PerfGraphRegistry.h.