https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Functions
PerfNode.C File Reference

Go to the source code of this file.

Functions

void dataStore (std::ostream &stream, const std::unique_ptr< PerfNode > &node, void *)
 
void dataLoad (std::istream &stream, const std::unique_ptr< PerfNode > &node, void *perf_graph)
 

Function Documentation

◆ dataLoad()

void dataLoad ( std::istream &  stream,
const std::unique_ptr< PerfNode > &  node,
void *  perf_graph 
)

Definition at line 99 of file PerfNode.C.

100{
101 std::string name;
102 // When we recursively add children, we grab the name before recursing into
103 // dataLoad(), so only load the name if we're on the root
104 if (node.get() == &static_cast<PerfGraph *>(perf_graph)->rootNode())
105 dataLoad(stream, name, nullptr);
106
107 std::chrono::steady_clock::duration total_time;
108 dataLoad(stream, total_time, nullptr);
109 node->_total_time += total_time;
110
111 long unsigned int num_calls;
112 dataLoad(stream, num_calls, nullptr);
113 node->_num_calls += num_calls;
114
115 long unsigned int total_memory;
116 dataLoad(stream, total_memory, nullptr);
117 node->_total_memory += total_memory;
118
119 // Recursively add the children
120 // If a matching child exists with the same name, the time/calls/memory will be appended
121 // to said node. If a node does not exist with the same name, it will be created
122 std::size_t num_children;
123 dataLoad(stream, num_children, nullptr);
124 std::size_t i = 0;
125 while (i++ < num_children)
126 {
127 dataLoad(stream, name, nullptr);
128 const auto id = moose::internal::getPerfGraphRegistry().sectionID(name);
129 node->getChild(id); // creates the child if it does not exist
130
131 const auto & child = node->_children[id];
132 dataLoad(stream, child, perf_graph);
133 }
134}
void dataLoad(std::istream &stream, const std::unique_ptr< PerfNode > &node, void *perf_graph)
Definition PerfNode.C:99
The PerfGraph will hold the master list of all registered performance segments and the head PerfNode.
Definition PerfGraph.h:44
const PerfNode & rootNode() const
Definition PerfGraph.h:193
PerfID sectionID(const std::string &section_name) const
Given a name return the PerfID @section_name The name of the section.
std::string name(const ElemQuality q)
PerfGraphRegistry & getPerfGraphRegistry()
Get the global PerfGraphRegistry singleton.

◆ dataStore()

void dataStore ( std::ostream &  stream,
const std::unique_ptr< PerfNode > &  node,
void *  context 
)

Definition at line 78 of file PerfNode.C.

79{
80 // We store the name instead of the ID because the ID could change in recover
82 dataStore(stream, name, nullptr);
83
84 dataStore(stream, node->_total_time, nullptr);
85 dataStore(stream, node->_num_calls, nullptr);
86 dataStore(stream, node->_total_memory, nullptr);
87
88 // Recursively add all of the children
89 std::size_t num_children = node->children().size();
90 dataStore(stream, num_children, nullptr);
91 for (auto & id_child_pair : node->_children)
92 {
93 const auto & child = id_child_pair.second;
94 dataStore(stream, child, nullptr);
95 }
96}
void dataStore(std::ostream &stream, const std::unique_ptr< PerfNode > &node, void *)
Definition PerfNode.C:78
const PerfGraphSectionInfo & sectionInfo(const PerfID section_id) const
Given a PerfID return the PerfGraphSectionInfo @section_id The ID.