The place where all timed sections will be stored.
More...
#include <PerfGraphRegistry.h>
|
| PerfID | registerSection (const std::string §ion_name, const unsigned int level) |
| | Call to register a named section for timing.
|
| |
| 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.
|
| |
| PerfID | sectionID (const std::string §ion_name) const |
| | Given a name return the PerfID @section_name The name of the section.
|
| |
| const PerfGraphSectionInfo & | sectionInfo (const PerfID section_id) const |
| | Given a PerfID return the PerfGraphSectionInfo @section_id The ID.
|
| |
| bool | sectionExists (const std::string §ion_name) const |
| | Whether or not a section with that name has been registered @section_name The name of the section.
|
| |
| bool | sectionExists (const PerfID section_id) const |
| | Whether or not a section with that id has been registered @section_id The ID.
|
| |
| std::size_t | numSections () const |
| |
|
| friend | PerfGraph |
| | This is only here so that PerfGraph can access readSectionInfo.
|
| |
| const std::string | _name |
| | The name of this registry; used in error handling.
|
| |
| std::unordered_map< std::string, std::size_t, std::hash< std::string > > | _key_to_id |
| | Map of keys to IDs.
|
| |
| std::deque< PerfGraphSectionInfo > | _id_to_item |
| | Vector of IDs to Items.
|
| |
| 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.
|
| |
| 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.
|
| |
The place where all timed sections will be stored.
Definition at line 80 of file PerfGraphRegistry.h.
◆ PerfGraphRegistry()
| moose::internal::PerfGraphRegistry::PerfGraphRegistry |
( |
| ) |
|
|
private |
◆ actuallyRegisterSection()
| PerfID moose::internal::PerfGraphRegistry::actuallyRegisterSection |
( |
const std::string & |
section_name, |
|
|
const unsigned int |
level, |
|
|
const std::string & |
live_message, |
|
|
const bool |
print_dots = true |
|
) |
| |
|
private |
The internal function that actually carries out the registration.
Definition at line 55 of file PerfGraphRegistry.C.
59{
60 const auto create_item = [§ion_name, &level, &live_message, &print_dots](
const std::size_t
id)
61 { return PerfGraphSectionInfo(id, section_name, level, live_message, print_dots); };
63}
std::size_t registerItem(const std::string &key, CreateItem &create_item)
Registers an item with key key if said key does not exist.
std::size_t id(const std::string &key) const
Referenced by registerSection(), and registerSection().
◆ id()
- Returns
- The ID assocated with the key
key
Definition at line 32 of file GeneralRegistry.h.
98{
103 return it->second;
104}
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
std::unordered_map< std::string, std::size_t, std::hash< std::string > > _key_to_id
Map of keys to IDs.
const std::string _name
The name of this registry; used in error handling.
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...
◆ idExists()
- Returns
- Whether or not the id
id is registered
Definition at line 41 of file GeneralRegistry.h.
117{
120}
std::deque< PerfGraphSectionInfo > _id_to_item
Vector of IDs to Items.
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++1...
◆ item()
- Returns
- The item associated with the key
key (thread safe)
Definition at line 46 of file GeneralRegistry.h.
125{
128}
const PerfGraphSectionInfo & itemNonLocking(const std::size_t id) const
◆ itemNonLocking()
- Returns
- The item associated with the key
key (not thread safe)
Definition at line 52 of file GeneralRegistry.h.
◆ keyExists()
- Returns
- Whether or not the key
key is registered
Definition at line 37 of file GeneralRegistry.h.
◆ numSections()
| std::size_t moose::internal::PerfGraphRegistry::numSections |
( |
| ) |
const |
|
inline |
◆ readSectionInfo()
◆ registerItem()
Registers an item with key key if said key does not exist.
- Parameters
-
| 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
- Returns
- The ID of the item
Definition at line 64 of file GeneralRegistry.h.
143{
145
146
149 return it->second;
150
151
155 _id_to_item.emplace_back(std::move(create_item(
id)));
157}
◆ registerSection() [1/2]
| unsigned int moose::internal::PerfGraphRegistry::registerSection |
( |
const std::string & |
section_name, |
|
|
const unsigned int |
level |
|
) |
| |
Call to register a named section for timing.
- Parameters
-
| 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) |
- Returns
- The ID of the section - use when starting timing
Definition at line 34 of file PerfGraphRegistry.C.
35{
37}
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.
Referenced by PerfGraphInterface::registerTimedSection(), and PerfGraphInterface::registerTimedSection().
◆ registerSection() [2/2]
| 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.
- Parameters
-
| 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 |
- Returns
- The ID of the section - use when starting timing
Definition at line 40 of file PerfGraphRegistry.C.
44{
45 if (section_name == "")
46 mooseError(
"Section name not provided when registering timed section!");
47
48 if (live_message == "")
49 mooseError(
"Live message not provided when registering timed section!");
50
52}
◆ sectionExists() [1/2]
| bool moose::internal::PerfGraphRegistry::sectionExists |
( |
const PerfID |
section_id | ) |
const |
|
inline |
Whether or not a section with that id has been registered @section_id The ID.
- Returns
- Whether or not it exists
Definition at line 135 of file PerfGraphRegistry.h.
bool idExists(const std::size_t id) const
◆ sectionExists() [2/2]
| bool moose::internal::PerfGraphRegistry::sectionExists |
( |
const std::string & |
section_name | ) |
const |
|
inline |
◆ sectionID()
| PerfID moose::internal::PerfGraphRegistry::sectionID |
( |
const std::string & |
section_name | ) |
const |
|
inline |
◆ sectionInfo()
◆ size()
◆ void::dataStore()
| moose::internal::PerfGraphRegistry::void::dataStore |
( |
std::ostream & |
, |
|
|
PerfGraph & |
, |
|
|
void * |
|
|
) |
| |
|
private |
◆ getPerfGraphRegistry
So it can be constructed.
Definition at line 20 of file PerfGraphRegistry.C.
21{
22
24
25 return perf_graph_registry_singleton;
26}
◆ _id_to_item
◆ _id_to_item_mutex
|
|
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.
◆ _key_to_id
◆ _key_to_id_mutex
|
|
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.
◆ _name
The name of this registry; used in error handling.
Definition at line 67 of file GeneralRegistry.h.
◆ PerfGraph
| friend moose::internal::PerfGraphRegistry::PerfGraph |
|
private |
The documentation for this class was generated from the following files: