The Sparta Modeling Framework
|
When a simulation is configured to archive its statistics values, it will build a subset of its device tree to organize the statistics. The analogy is that a TreeNode is loosely the same as an ArchiveNode: More...
#include <ArchiveNode.hpp>
Public Member Functions | |
ArchiveNode ()=default | |
ArchiveNode (const std::string &name) | |
Construct a named node. | |
ArchiveNode (const std::string &name, const StatisticInstance *) | |
ArchiveNode (const std::string &name, const Report *) | |
const std::string & | getName () const |
Return the name that this node was originally created with. | |
void | setLeafIndex (const size_t index) |
std::vector< std::shared_ptr< ArchiveNode > > & | getChildren () |
const std::vector< std::shared_ptr< ArchiveNode > > & | getChildren () const |
void | setParent (std::shared_ptr< ArchiveNode > &parent) |
void | setParent (ArchiveNode *parent) |
RootArchiveNode * | getRoot () |
bool | isLeaf () const |
bool | canAccessDataSeries () const |
ArchiveDataSeries * | createDataSeries () |
size_t | getTotalNumLeaves () const |
Protected Attributes | |
std::string | name_ |
std::vector< std::shared_ptr< ArchiveNode > > | children_ |
Friends | |
class | boost::serialization::access |
When a simulation is configured to archive its statistics values, it will build a subset of its device tree to organize the statistics. The analogy is that a TreeNode is loosely the same as an ArchiveNode:
top.core0.rob.stats.total_number_retired (device tree) top.core0.rob.total_number_retired (archive tree) ...
The archive tree will strictly be a subset of the full device tree.
Definition at line 29 of file ArchiveNode.hpp.
|
default |
Default constructor should only be used by Boost serialization code. Boost will build up the archive tree from a metadata file piecemeal. First it will create an ArchiveNode with no ctor arguments, then it will fill in the rest (name, children, ...)
|
inline |
Archive trees are built with the help of the ReportStatisticsHierTree class. That class is templated on ArchiveNode, and needs a constructor that takes a name and an SI. For our case, we don't use the SI for anything, but we still have this constructor to make ReportStatisticsHierTree happy.
Definition at line 48 of file ArchiveNode.hpp.
|
inline |
See the comment above for the ArchiveNode(string, SI*) constructor. This constructor is here just to make the ArchiveNode class conform to the ReportStatisticsHierTree template code so we can reuse that tree builder class.
Definition at line 57 of file ArchiveNode.hpp.
|
inline |
Only nodes that are both leaves, and that have had their leaf index assigned to them, are able to access SI data.
Definition at line 133 of file ArchiveNode.hpp.
ArchiveDataSeries * sparta::statistics::ArchiveNode::createDataSeries | ( | ) |
Ask a leaf node to create an ArchiveDataSeries object. This object can be used to get individual SI values out of the archive. This method will throw if canAccessDataSeries() is FALSE.
|
inline |
Definition at line 96 of file ArchiveNode.hpp.
|
inline |
Definition at line 100 of file ArchiveNode.hpp.
|
inline |
Return the name that this node was originally created with.
Definition at line 65 of file ArchiveNode.hpp.
RootArchiveNode * sparta::statistics::ArchiveNode::getRoot | ( | ) |
All archive trees have a root node. This is different than a regular ArchiveNode in that the RootArchiveNode:
This is lazily evaluated and then cached.
|
inline |
Returns the total number of leaf nodes from this node on down. For example:
A ------------- | | B C ------- | | D E Node: Num leaves: ------ ------------ A 3 B 1 C 2 D 1 E 1
Definition at line 161 of file ArchiveNode.hpp.
|
inline |
Only leaf nodes have any data. Ask this node if it is a leaf. This is different from "do you have any data?" - leaves can have no data if the simulation hasn't even logged one report update yet.
Definition at line 127 of file ArchiveNode.hpp.
|
inline |
In every archive tree, all leaf nodes need to know their "leaf index", which is a 0-based index assigned in depth- first traversal of the tree. For example:
A ------------- | | B C ------- | | D E
Here, nodes A/C would not have a leaf index, because they are not leaves. But the others would have:
Node: Leaf index: ------ ------------ B 0 D 1 E 2
Leaves use this index to figure out their byte offset in the underlying contiguous array of SI values.
Definition at line 92 of file ArchiveNode.hpp.
|
inline |
Definition at line 108 of file ArchiveNode.hpp.
|
inline |
Definition at line 104 of file ArchiveNode.hpp.
|
friend |
The archive directories contain the following structure:
We let Boost call this same serialize() method whether we are writing to disk or reading from disk.
Definition at line 204 of file ArchiveNode.hpp.
|
protected |
Same as 'name_', the children_ vector is protected to make the subclass Boost serialization routines easier to manage.
Definition at line 179 of file ArchiveNode.hpp.
|
protected |
This property is protected so that subclasses can write their Boost serialization routines as simply as "archive & name_" and not fuss with setter and getter methods.
Definition at line 174 of file ArchiveNode.hpp.