https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Classes | Functions
PerfNode.h File Reference

Go to the source code of this file.

Classes

class  PerfNode
 A node in the PerfGraph. More...
 

Functions

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

Function Documentation

◆ dataLoad()

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

Definition at line 79 of file PerfNode.C.

80{
81 std::string name;
82 // When we recursively add children, we grab the name before recursing into
83 // dataLoad(), so only load the name if we're on the root
84 if (node.get() == &static_cast<PerfGraph *>(perf_graph)->rootNode())
85 dataLoad(stream, name, nullptr);
86
87 std::chrono::steady_clock::duration total_time;
88 dataLoad(stream, total_time, nullptr);
89 node->_total_time += total_time;
90
91 long unsigned int num_calls;
92 dataLoad(stream, num_calls, nullptr);
93 node->_num_calls += num_calls;
94
95 long unsigned int total_memory;
96 dataLoad(stream, total_memory, nullptr);
97 node->_total_memory += total_memory;
98
99 // Recursively add the children
100 // If a matching child exists with the same name, the time/calls/memory will be appended
101 // to said node. If a node does not exist with the same name, it will be created
102 std::size_t num_children;
103 dataLoad(stream, num_children, nullptr);
104 std::size_t i = 0;
105 while (i++ < num_children)
106 {
107 dataLoad(stream, name, nullptr);
108 const auto id = moose::internal::getPerfGraphRegistry().sectionID(name);
109 node->getChild(id); // creates the child if it does not exist
110
111 const auto & child = node->_children[id];
112 dataLoad(stream, child, perf_graph);
113 }
114}
void dataLoad(std::istream &stream, const std::unique_ptr< PerfNode > &node, void *perf_graph)
Definition PerfNode.C:79
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 58 of file PerfNode.C.

59{
60 // We store the name instead of the ID because the ID could change in recover
62 dataStore(stream, name, nullptr);
63
64 dataStore(stream, node->_total_time, nullptr);
65 dataStore(stream, node->_num_calls, nullptr);
66 dataStore(stream, node->_total_memory, nullptr);
67
68 // Recursively add all of the children
69 std::size_t num_children = node->children().size();
70 dataStore(stream, num_children, nullptr);
71 for (auto & id_child_pair : node->_children)
72 {
73 const auto & child = id_child_pair.second;
74 dataStore(stream, child, nullptr);
75 }
76}
void dataStore(std::ostream &stream, const std::unique_ptr< PerfNode > &node, void *)
Definition PerfNode.C:58
const PerfGraphSectionInfo & sectionInfo(const PerfID section_id) const
Given a PerfID return the PerfGraphSectionInfo @section_id The ID.