A node in the PerfGraph. More...
#include <PerfNode.h>
Public Member Functions | |
| PerfNode (const PerfID id) | |
| Create a PerfNode with the given ID. | |
| PerfID | id () const |
| Get the ID of this Node. | |
| void | setStartTimeAndMemory (const std::chrono::time_point< std::chrono::steady_clock > time, const long int memory) |
| Set the current start time. | |
| const std::chrono::time_point< std::chrono::steady_clock > & | startTime () const |
| Get the currnet start time Only makes sense if this node is running. | |
| const long unsigned int & | startMemory () const |
| Get the current start memory Only makes sense if this node is running. | |
| void | addTimeAndMemory (const std::chrono::time_point< std::chrono::steady_clock > time, const long int memory) |
| Add some time into this Node by taking the difference with the time passed in. | |
| void | incrementNumCalls () |
| Increments the number of calls. | |
| void | addTimeAndMemory (const std::chrono::steady_clock::duration time) |
| Add some time into this Node. | |
| PerfNode * | getChild (const PerfID id) |
| Get a child node with the unique id given. | |
| const std::map< PerfID, std::unique_ptr< PerfNode > > & | children () const |
| Get the children. | |
| std::chrono::steady_clock::duration | selfTime () const |
| Get the time this node took. | |
| Real | selfTimeSec () const |
| Get the time this node took in seconds. | |
| Real | selfTimeAvg () const |
| The average time this node took in seconds. | |
| std::chrono::steady_clock::duration | totalTime () const |
| The time this Node plus all of it's children took. | |
| Real | totalTimeSec () const |
| The time this Node plus all of its children took in seconds. | |
| Real | totalTimeAvg () const |
| The average time this Node plus all of its children took in seconds. | |
| std::chrono::steady_clock::duration | childrenTime () const |
| Get the time this nodes children took. | |
| Real | childrenTimeSec () const |
| The time this node's children took in seconds. | |
| unsigned long int | numCalls () const |
| Get the number of times this node was called. | |
| long int | selfMemory () const |
| Get the amount of memory added by this node. | |
| long int | childrenMemory () const |
| Get the amount of memory added by this node. | |
| long int | totalMemory () const |
| Get the amount of memory added by this node. | |
Private Attributes | |
| const PerfID | _id |
| The unique ID for the section this Node corresponds to. | |
| std::chrono::time_point< std::chrono::steady_clock > | _start_time |
| The current start_time for this node (if it's on the stack) | |
| std::chrono::steady_clock::duration | _total_time |
| The total elapsed time for this node. | |
| long unsigned int | _start_memory |
| The starting memory for this node. | |
| long unsigned int | _num_calls |
| Number of times this node has been called. | |
| long unsigned int | _total_memory |
| The total memory added while this node is active. | |
| std::map< PerfID, std::unique_ptr< PerfNode > > | _children |
| Timers that are directly underneath this node. | |
Friends | |
| void | dataStore (std::ostream &, const std::unique_ptr< PerfNode > &, void *) |
| void | dataLoad (std::istream &, const std::unique_ptr< PerfNode > &, void *) |
A node in the PerfGraph.
Stores the timing for a particular section of code.
The design here is that _children are automatically added and kept track of within the Node - and only raw pointers are handed back out.
Definition at line 25 of file PerfNode.h.
|
inline |
Create a PerfNode with the given ID.
Definition at line 31 of file PerfNode.h.
|
inline |
|
inline |
Add some time into this Node by taking the difference with the time passed in.
Definition at line 66 of file PerfNode.h.
Get the children.
Definition at line 107 of file PerfNode.h.
Referenced by PerfGraph::recursivelyUpdate(), and PerfGraph::treeRecurseInternal().
| long int PerfNode::childrenMemory | ( | ) | const |
Get the amount of memory added by this node.
Definition at line 47 of file PerfNode.C.
Referenced by PerfGraph::recursivelyUpdate(), and selfMemory().
| std::chrono::steady_clock::duration PerfNode::childrenTime | ( | ) | const |
Get the time this nodes children took.
Definition at line 30 of file PerfNode.C.
Referenced by childrenTimeSec(), and selfTime().
|
inline |
The time this node's children took in seconds.
Definition at line 142 of file PerfNode.h.
Referenced by PerfGraph::recursivelyUpdate().
Get a child node with the unique id given.
Note: this will automatically create the Node internally if it needs to.
Implemented in header to allow for more optimization
| id | The unique ID of the child node |
Definition at line 93 of file PerfNode.h.
Referenced by PerfGraph::push().
|
inline |
Get the ID of this Node.
Definition at line 36 of file PerfNode.h.
Referenced by getChild(), PerfGraph::recursivelyUpdate(), and PerfGraph::treeRecurseInternal().
|
inline |
Increments the number of calls.
Definition at line 76 of file PerfNode.h.
Referenced by PerfGraph::push().
|
inline |
Get the number of times this node was called.
Definition at line 147 of file PerfNode.h.
Referenced by PerfGraph::recursivelyUpdate(), selfTimeAvg(), totalTimeAvg(), and PerfGraph::treeTable().
| long int PerfNode::selfMemory | ( | ) | const |
Get the amount of memory added by this node.
Definition at line 41 of file PerfNode.C.
Referenced by PerfGraph::recursivelyUpdate(), and PerfGraph::treeTable().
| std::chrono::steady_clock::duration PerfNode::selfTime | ( | ) | const |
|
inline |
The average time this node took in seconds.
Definition at line 120 of file PerfNode.h.
Referenced by PerfGraph::treeTable().
|
inline |
Get the time this node took in seconds.
Definition at line 116 of file PerfNode.h.
Referenced by PerfGraph::recursivelyUpdate(), selfTimeAvg(), and PerfGraph::treeTable().
|
inline |
Set the current start time.
Definition at line 41 of file PerfNode.h.
Referenced by PerfGraph::push().
|
inline |
Get the current start memory Only makes sense if this node is running.
Definition at line 61 of file PerfNode.h.
|
inline |
Get the currnet start time Only makes sense if this node is running.
Definition at line 52 of file PerfNode.h.
|
inline |
Get the amount of memory added by this node.
Definition at line 162 of file PerfNode.h.
Referenced by PerfGraph::recursivelyUpdate(), and PerfGraph::treeTable().
| std::chrono::steady_clock::duration PerfNode::totalTime | ( | ) | const |
The time this Node plus all of it's children took.
Definition at line 22 of file PerfNode.C.
Referenced by totalTimeSec(), and PerfGraph::treeRecurseInternal().
|
inline |
The average time this Node plus all of its children took in seconds.
Definition at line 133 of file PerfNode.h.
Referenced by PerfGraph::treeTable().
|
inline |
The time this Node plus all of its children took in seconds.
Definition at line 129 of file PerfNode.h.
Referenced by PerfGraph::recursivelyUpdate(), totalTimeAvg(), and PerfGraph::treeTable().
|
friend |
Definition at line 79 of file PerfNode.C.
|
friend |
Definition at line 58 of file PerfNode.C.
Timers that are directly underneath this node.
Definition at line 184 of file PerfNode.h.
Referenced by children(), childrenMemory(), childrenTime(), and getChild().
|
private |
The unique ID for the section this Node corresponds to.
Definition at line 166 of file PerfNode.h.
Referenced by id().
|
private |
Number of times this node has been called.
Definition at line 178 of file PerfNode.h.
Referenced by incrementNumCalls(), and numCalls().
|
private |
The starting memory for this node.
Definition at line 175 of file PerfNode.h.
Referenced by addTimeAndMemory(), setStartTimeAndMemory(), and startMemory().
|
private |
The current start_time for this node (if it's on the stack)
Definition at line 169 of file PerfNode.h.
Referenced by addTimeAndMemory(), setStartTimeAndMemory(), and startTime().
|
private |
The total memory added while this node is active.
Definition at line 181 of file PerfNode.h.
Referenced by addTimeAndMemory(), selfMemory(), and totalMemory().
|
private |
The total elapsed time for this node.
Definition at line 172 of file PerfNode.h.
Referenced by addTimeAndMemory(), addTimeAndMemory(), selfTime(), and totalTime().