The Sparta Modeling Framework
|
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>
Public Member Functions | |
StreamNode (const StreamNode &)=delete | |
StreamNode & | operator= (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) |
StreamNode * | getRoot () |
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) | |
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.
|
inlinevirtual |
Definition at line 38 of file StreamNode.hpp.
|
inlineexplicitprotected |
Definition at line 162 of file StreamNode.hpp.
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.
|
inline |
Direct descendants of this node, if any.
Definition at line 67 of file StreamNode.hpp.
|
inline |
Direct descendants of this node, if any.
Definition at line 72 of file StreamNode.hpp.
|
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.
|
inline |
StreamNode name - similar to a TreeNode's name.
Definition at line 43 of file StreamNode.hpp.
|
inline |
Return the root node at the top of the stream hierarchy this StreamNode lives in.
Definition at line 88 of file StreamNode.hpp.
|
inline |
Streaming interface.
Definition at line 104 of file StreamNode.hpp.
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.
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.
|
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.
|
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.