The Sparta Modeling Framework
Loading...
Searching...
No Matches
sparta::statistics::StreamNode Class Referenceabstract

When a simulation is configured to stream its statistics values for asynchronous processing, it will build a subset of its device tree to organize the statistics. The resulting hierarchy is made up of report/subreport nodes, and StatisticInstance leaves. StreamNode's represent nodes in this hierarchy, and are designed so that you can stream data out of any node, regardless of where that node lives (could be the root, could be an SI leaf, could be anywhere in the middle). More...

#include <StreamNode.hpp>

Inheritance diagram for sparta::statistics::StreamNode:

Public Member Functions

 StreamNode (const StreamNode &)=delete
 
StreamNodeoperator= (const StreamNode &)=delete
 
const std::string & getName () const
 StreamNode name - similar to a TreeNode's name.
 
const std::string & getFullPath ()
 
std::vector< std::shared_ptr< StreamNode > > & getChildren ()
 Direct descendants of this node, if any.
 
const std::vector< std::shared_ptr< StreamNode > > & getChildren () const
 Direct descendants of this node, if any.
 
void setParent (StreamNode *parent)
 
StreamNodegetRoot ()
 
void initialize ()
 Streaming interface.
 
bool notifyListenersOfStreamUpdate ()
 
void pushStreamUpdateToListeners ()
 
void getBufferedStreamData (std::queue< std::vector< double > > &data_queue)
 
void setStreamController (const std::shared_ptr< StreamController > &controller)
 

Protected Member Functions

 StreamNode (const std::string &name)
 

Detailed Description

When a simulation is configured to stream its statistics values for asynchronous processing, it will build a subset of its device tree to organize the statistics. The resulting hierarchy is made up of report/subreport nodes, and StatisticInstance leaves. StreamNode's represent nodes in this hierarchy, and are designed so that you can stream data out of any node, regardless of where that node lives (could be the root, could be an SI leaf, could be anywhere in the middle).

Definition at line 35 of file StreamNode.hpp.

Constructor & Destructor Documentation

◆ ~StreamNode()

virtual sparta::statistics::StreamNode::~StreamNode ( )
inlinevirtual

Definition at line 38 of file StreamNode.hpp.

◆ StreamNode()

sparta::statistics::StreamNode::StreamNode ( const std::string &  name)
inlineexplicitprotected

Definition at line 162 of file StreamNode.hpp.

Member Function Documentation

◆ getBufferedStreamData()

void sparta::statistics::StreamNode::getBufferedStreamData ( std::queue< std::vector< double > > &  data_queue)

This method grabs any pending data that has been buffered during a simulation, and transfers it to the 'data_queue' output argument. The caller is fully responsible for getting the data to the requesting client.

This method is thread-safe.

◆ getChildren() [1/2]

std::vector< std::shared_ptr< StreamNode > > & sparta::statistics::StreamNode::getChildren ( )
inline

Direct descendants of this node, if any.

Definition at line 67 of file StreamNode.hpp.

◆ getChildren() [2/2]

const std::vector< std::shared_ptr< StreamNode > > & sparta::statistics::StreamNode::getChildren ( ) const
inline

Direct descendants of this node, if any.

Definition at line 72 of file StreamNode.hpp.

◆ getFullPath()

const std::string & sparta::statistics::StreamNode::getFullPath ( )
inline

Full dot-delimited path from the root node to 'this' node, for example:

root                'foo_csv'
  subreport         'top'
    subreport       'core0'
      subreport     'rob'
        SI          'ipc'          <-- 'this' node

In the above example tree, our full path would be: 'foo_csv.top.core0.rob.ipc'

Definition at line 58 of file StreamNode.hpp.

◆ getName()

const std::string & sparta::statistics::StreamNode::getName ( ) const
inline

StreamNode name - similar to a TreeNode's name.

Definition at line 43 of file StreamNode.hpp.

◆ getRoot()

StreamNode * sparta::statistics::StreamNode::getRoot ( )
inline

Return the root node at the top of the stream hierarchy this StreamNode lives in.

Definition at line 88 of file StreamNode.hpp.

◆ initialize()

void sparta::statistics::StreamNode::initialize ( )
inline

Streaming interface.

Definition at line 104 of file StreamNode.hpp.

Here is the call graph for this function:

◆ notifyListenersOfStreamUpdate()

bool sparta::statistics::StreamNode::notifyListenersOfStreamUpdate ( )

Tell the nodes in this hierarchy that they should read their SI's current values, and buffer those values for processing later on (for example, on a consumer thread).

This method is thread-safe.

◆ pushStreamUpdateToListeners()

void sparta::statistics::StreamNode::pushStreamUpdateToListeners ( )

Call the 'notify listeners of new data' method, but also synchronously tell those listeners to push the data to its registered clients.

** This method is temporary while asynchronous C++/Python ** communication is developed. Python clients will just ** be fed their data packets from the main thread for now.

◆ setParent()

void sparta::statistics::StreamNode::setParent ( StreamNode parent)
inline

StreamNode's typically have their parent set only during the initial building of the stream hierarchy. Asserts if you try to call this method twice with a different parent node each time.

Definition at line 80 of file StreamNode.hpp.

◆ setStreamController()

void sparta::statistics::StreamNode::setStreamController ( const std::shared_ptr< StreamController > &  controller)
inline

Controller object shared between this node and the simulation's run controller. Used for things like synchronization between the simulation (main) thread and consumer thread(s).

Definition at line 155 of file StreamNode.hpp.


The documentation for this class was generated from the following file: