https://mooseframework.inl.gov
Functions
PerfGraphReporter.C File Reference

Go to the source code of this file.

Functions

 registerMooseObject ("MooseApp", PerfGraphReporter)
 
void to_json (nlohmann::json &json, const PerfGraph *const &perf_graph)
 
void to_json (nlohmann::json &json, const PerfNode &node)
 

Function Documentation

◆ registerMooseObject()

registerMooseObject ( "MooseApp"  ,
PerfGraphReporter   
)

◆ to_json() [1/2]

void to_json ( nlohmann::json &  json,
const PerfGraph *const &  perf_graph 
)

Definition at line 37 of file PerfGraphReporter.C.

Referenced by to_json().

38 {
39  mooseAssert(perf_graph, "perf_graph is not set");
40 
41  // Update the timings in each node before we output them
42  const_cast<PerfGraph *>(perf_graph)->update();
43 
44  // Recurse through the nodes starting with the root to fill the graph
45  to_json(json, perf_graph->rootNode());
46 }
void to_json(nlohmann::json &json, const PerfGraph *const &perf_graph)
The PerfGraph will hold the master list of all registered performance segments and the head PerfNode...
Definition: PerfGraph.h:43
const PerfNode & rootNode() const
Definition: PerfGraph.h:186

◆ to_json() [2/2]

void to_json ( nlohmann::json &  json,
const PerfNode node 
)

Definition at line 49 of file PerfGraphReporter.C.

50 {
52 
53  auto & node_json = json[info._name];
54  node_json["level"] = info._level;
55  node_json["num_calls"] = node.numCalls();
56  node_json["memory"] = node.selfMemory();
57  node_json["time"] = node.selfTimeSec();
58 
59  // Recursively add the children
60  for (const auto & id_child_pair : node.children())
61  to_json(node_json, *id_child_pair.second);
62 }
Real selfTimeSec() const
Get the time this node took in seconds.
Definition: PerfNode.h:115
long int selfMemory() const
Get the amount of memory added by this node.
Definition: PerfNode.C:41
MPI_Info info
unsigned int _level
Print level (verbosity level)
unsigned long int numCalls() const
Get the number of times this node was called.
Definition: PerfNode.h:146
const std::map< PerfID, std::unique_ptr< PerfNode > > & children() const
Get the children.
Definition: PerfNode.h:106
PerfID id() const
Get the ID of this Node.
Definition: PerfNode.h:35
const PerfGraphSectionInfo & sectionInfo(const PerfID section_id) const
Given a PerfID return the PerfGraphSectionInfo The ID.
void to_json(nlohmann::json &json, const PerfGraph *const &perf_graph)
PerfGraphRegistry & getPerfGraphRegistry()
Get the global PerfGraphRegistry singleton.