The Sparta Modeling Framework
|
A class that facilitates all universal pipeline collection operations such as outputting finalized records, generating unique transaction Id's, maintaining heartbeat functionality, writing the location file, writing the clock file. More...
#include <PipelineCollector.hpp>
Public Member Functions | |
PipelineCollector (const std::string &filepath, Scheduler::Tick heartbeat_interval, const sparta::Clock *root_clk, const sparta::TreeNode *root, Scheduler *scheduler=nullptr) | |
Instantiate the collector with required parameters before pipeline collection can occur. | |
void | destroy () |
Teardown the pipeline collector. | |
void | reactivate (const std::string &filepath) |
void | startCollection (sparta::TreeNode *starting_node) |
Turn on collection for everything below a TreeNode. Recursively transverse the tree and turn on child nodes for pipeline collection. | |
void | stopCollection (sparta::TreeNode *starting_node) |
Stop pipeline collection on only those CollectableTreeNodes given. | |
void | stopCollection () |
Stop pipeline collection on only those CollectableTreeNodes that this PipelineCollector was started with. | |
void | addToAutoCollection (CollectableTreeNode *ctn, SchedulingPhase collection_phase=SchedulingPhase::Tick) |
Add the CollectableTreeNode to auto collection. | |
void | removeFromAutoCollection (CollectableTreeNode *ctn) |
Remove the given CollectableTreeNode from collection. | |
uint64_t | getUniqueTransactionId () |
Return a unique transaction id using a dummy counter. | |
template<class R_Type > | |
void | writeRecord (const R_Type &dat) |
Output a finized transaction to our Outputter class. | |
uint64_t | numTransactionsWritten () const |
Return the number of transactions that this singleton has passed to it's output. This is useful for testing purposes. | |
bool | isCollectionActive () const |
Return true if the collector is actively collecting. | |
void | printMap () |
const std::string & | getFilePath () const |
Scheduler * | getScheduler () const |
Public Member Functions inherited from sparta::collection::Collector | |
Collector (const std::string &name) | |
Construct a collector. | |
virtual | ~Collector () |
Enable polymorphism and also be nice. | |
std::string | getName () const |
Additional Inherited Members | |
Protected Attributes inherited from sparta::collection::Collector | |
std::string | name_ |
A class that facilitates all universal pipeline collection operations such as outputting finalized records, generating unique transaction Id's, maintaining heartbeat functionality, writing the location file, writing the clock file.
The class must be initialized with PipelineCollector::getPipelineCollector()->init(...) before collection is to occure. This method is required to have important parameters required during pipeline collection.
This class operates on a specific scheduler specified at construction. It's implementation should not access the sparta Scheduler singleton directly.
destroy() should also be called at the end of the programs life to perform post collection maintenance. Any transactions alive at this point will have their current data written to disk with the end time as the end time of simulation. If the singleton was never initialized, destroy will have no effect.
Once the singleton is created and initialized with init pipeline collection still needs to be switched on. This can be done via the startCollection() at the treenode level. This method recursively turns on collection at and below the treenode pointer passed in.
Likewise collection can be turned off via stopCollection at any time.
Definition at line 65 of file PipelineCollector.hpp.
|
inline |
Instantiate the collector with required parameters before pipeline collection can occur.
filepath | The relative path to the output directory or file prefix. |
heartbeat_interval | The interval offset at which to write an index file (in Ticks). If 0, the heartbeat will be derived from the known clocks in the simulation. |
root_clk | A pointer to the clock that maintains the hyper cycle time. |
root | A pointer to the root sparta::TreeNode during simulation which will be walked when producing a location map file that maps location id numbers with the sparta tree location for collected objects. |
scheduler | Scheduler on which this collector operates. If null, uses the Scheduler belonging to root_clk. This allows us to run different pipeline collectors on different schedulers which is useful for standalone analyzers which run multiple instances of some model in parallel over the same trace data |
Definition at line 203 of file PipelineCollector.hpp.
|
inline |
Definition at line 294 of file PipelineCollector.hpp.
|
inline |
Add the CollectableTreeNode to auto collection.
ctn | The CollectableTreeNode that is to be collected |
collection_phase | The phase to collect the object in |
Enable collection on the given CollectableTreeNode. This is a runtime call. There are some rules here:
#. The Scheduler must be finialized and simulation started #. The clock that the CollectableTreeNode belongs to must have been registered with the PipelineCollector at init time.
Definition at line 466 of file PipelineCollector.hpp.
|
inline |
Teardown the pipeline collector.
Tear down the PipelineCollector. Should be called before Tree teardown to close all open transactions.
Definition at line 309 of file PipelineCollector.hpp.
|
inline |
Definition at line 570 of file PipelineCollector.hpp.
|
inline |
Definition at line 575 of file PipelineCollector.hpp.
|
inline |
Return a unique transaction id using a dummy counter.
Definition at line 497 of file PipelineCollector.hpp.
|
inline |
Return true if the collector is actively collecting.
Will be true if there are any registered collectables that are being collected on any clock.
Definition at line 556 of file PipelineCollector.hpp.
|
inline |
Return the number of transactions that this singleton has passed to it's output. This is useful for testing purposes.
Definition at line 541 of file PipelineCollector.hpp.
|
inline |
Definition at line 560 of file PipelineCollector.hpp.
|
inline |
Definition at line 324 of file PipelineCollector.hpp.
|
inline |
Remove the given CollectableTreeNode from collection.
ctn | The CollectableTreeNode that is to be removed from collection |
Disable collection on the given CollectableTreeNode. This is a runtime call. There are some rules here:
#. The Scheduler must be finialized and simulation started #. The clock that the CollectableTreeNode belongs to must have been registered with the PipelineCollector at init time.
Definition at line 485 of file PipelineCollector.hpp.
|
inline |
Turn on collection for everything below a TreeNode. Recursively transverse the tree and turn on child nodes for pipeline collection.
starting_node | TreeNode to start collection on. This TreeNode will try to start collection as well as any node below it. |
Definition at line 343 of file PipelineCollector.hpp.
|
inline |
Stop pipeline collection on only those CollectableTreeNodes that this PipelineCollector was started with.
Definition at line 447 of file PipelineCollector.hpp.
|
inline |
Stop pipeline collection on only those CollectableTreeNodes given.
starting_node | The node to shut collection down on |
Definition at line 412 of file PipelineCollector.hpp.
|
inline |
Output a finized transaction to our Outputter class.
dat | The transaction to be outputted. |
R_Type | the type of transaction struct |
Definition at line 511 of file PipelineCollector.hpp.