The Sparta Modeling Framework
Loading...
Searching...
No Matches
sparta::pevents::PeventCollector< CollectedEntityType > Class Template Reference

Class that is capable of recording pevents as key value pairs, where a PairDefinition has been defined with the key values, and function pointers to where to get the data for the pairs. More...

#include <PeventCollector.hpp>

Inheritance diagram for sparta::pevents::PeventCollector< CollectedEntityType >:
Collaboration diagram for sparta::pevents::PeventCollector< CollectedEntityType >:

Public Member Functions

 PeventCollector (const std::string &event_name, sparta::TreeNode *parent, const Clock *clk, const bool verbosity=false)
 
template<typename... Targs>
void collect (const typename CollectedEntityType::TypeCollected &obj, const Targs &... pos_args)
 Actually collect the object, and write out a pevent. We ovverride the collect method to ensure the the generateCollectionString is always called, even when there is not a change.
 
virtual const std::string & eventName () override
 Return the ev name.
 
void adjustSkew (const int32_t &skew_amount)
 
virtual bool addTap (const std::string &type, const std::string &file, const bool verbose) override final
 Mark this pevent with a tap to output the pevent's data to a file.
 
virtual void turnOff (const std::string &type) override final
 
virtual void go () override final
 This method should be called on all pevent collectors when the trigger either manually fires to start or the trigger is reached.
 
- Public Member Functions inherited from sparta::pevents::PeventCollectorTreeNode
 PeventCollectorTreeNode (sparta::TreeNode *parent, const std::string &name)
 

Protected Member Functions

virtual void generateCollectionString_ () override
 Override the generateCollectionString_() of the bases PairCollector, In this method, we use the pair_cache owned by PairCache.
 

Protected Attributes

const std::string event_name_
 
log::MessageSource message_src_
 
std::vector< std::unique_ptr< log::Tap > > taps_
 
const Clockclk_
 
std::function< uint64_t(const uint64_t &, const uint32_t &)> f_skew_
 
uint32_t skew_
 
bool verbosity_
 
bool running_ = false
 

Detailed Description

template<class CollectedEntityType>
class sparta::pevents::PeventCollector< CollectedEntityType >

Class that is capable of recording pevents as key value pairs, where a PairDefinition has been defined with the key values, and function pointers to where to get the data for the pairs.

Template Parameters
theType of PairDefinition that we want to capture a pevent from.

Example usage:

class MyUnit : sparta::Unit
{
public:
// ...
uint32_t getValue() const { ... };
// ...
private:
class MyEventPairs : public sparta::PairDefinition<MyUnit>
{
public:
using TypeCollected = Inst;
MyEventPairs() : sparta::PairDefinition<MyUnit>()
{
addPEventsPair("value", &MyUnit::getValue);
}
};
// Assumes this event is being constructed inside a sparta::Unit derived type
sparta::pevents::PeventCollector<MyEventPairs> my_pevent_{"MYEVENT", getContainer(), getClock()};
};
// Collection:
my_event_.collect(my_unit_);
The is the base class for user defined blocks in simulation.
Definition Unit.hpp:38
Class that is capable of recording pevents as key value pairs, where a PairDefinition has been define...
void collect(const typename CollectedEntityType::TypeCollected &obj, const Targs &... pos_args)
Actually collect the object, and write out a pevent. We ovverride the collect method to ensure the th...
Macros for handling exponential backoff.

Definition at line 60 of file PeventCollector.hpp.

Constructor & Destructor Documentation

◆ PeventCollector()

template<class CollectedEntityType >
sparta::pevents::PeventCollector< CollectedEntityType >::PeventCollector ( const std::string &  event_name,
sparta::TreeNode parent,
const Clock clk,
const bool  verbosity = false 
)
inline

Definition at line 71 of file PeventCollector.hpp.

◆ ~PeventCollector()

template<class CollectedEntityType >
virtual sparta::pevents::PeventCollector< CollectedEntityType >::~PeventCollector ( )
inlinevirtual

Definition at line 85 of file PeventCollector.hpp.

Member Function Documentation

◆ addTap()

template<class CollectedEntityType >
virtual bool sparta::pevents::PeventCollector< CollectedEntityType >::addTap ( const std::string &  type,
const std::string &  file,
const bool  verbose 
)
inlinefinaloverridevirtual

Mark this pevent with a tap to output the pevent's data to a file.

Parameters
typethe type of pevent being tapped. This is necessary since pevent's are tapped via a traversal of the tree, we would like to only create the tap if this pevent is of the same type.
filethe output file path we'd like the tap to write too
verboseare we trying to tap a verbose pevent or normal pevent.

Implements sparta::pevents::PeventCollectorTreeNode.

Definition at line 127 of file PeventCollector.hpp.

◆ adjustSkew()

template<class CollectedEntityType >
void sparta::pevents::PeventCollector< CollectedEntityType >::adjustSkew ( const int32_t &  skew_amount)
inline

Definition at line 110 of file PeventCollector.hpp.

◆ collect()

template<class CollectedEntityType >
template<typename... Targs>
void sparta::pevents::PeventCollector< CollectedEntityType >::collect ( const typename CollectedEntityType::TypeCollected &  obj,
const Targs &...  pos_args 
)
inline

Actually collect the object, and write out a pevent. We ovverride the collect method to ensure the the generateCollectionString is always called, even when there is not a change.

Definition at line 93 of file PeventCollector.hpp.

Here is the call graph for this function:

◆ eventName()

template<class CollectedEntityType >
virtual const std::string & sparta::pevents::PeventCollector< CollectedEntityType >::eventName ( )
inlineoverridevirtual

Return the ev name.

Implements sparta::pevents::PeventCollectorTreeNode.

Definition at line 105 of file PeventCollector.hpp.

◆ generateCollectionString_()

template<class CollectedEntityType >
virtual void sparta::pevents::PeventCollector< CollectedEntityType >::generateCollectionString_ ( )
inlineoverrideprotectedvirtual

Override the generateCollectionString_() of the bases PairCollector, In this method, we use the pair_cache owned by PairCache.

Definition at line 212 of file PeventCollector.hpp.

Here is the call graph for this function:

◆ go()

template<class CollectedEntityType >
virtual void sparta::pevents::PeventCollector< CollectedEntityType >::go ( )
inlinefinaloverridevirtual

This method should be called on all pevent collectors when the trigger either manually fires to start or the trigger is reached.

Implements sparta::pevents::PeventCollectorTreeNode.

Definition at line 192 of file PeventCollector.hpp.

◆ turnOff()

template<class CollectedEntityType >
virtual void sparta::pevents::PeventCollector< CollectedEntityType >::turnOff ( const std::string &  type)
inlinefinaloverridevirtual

Implements sparta::pevents::PeventCollectorTreeNode.

Definition at line 174 of file PeventCollector.hpp.

Member Data Documentation

◆ clk_

template<class CollectedEntityType >
const Clock* sparta::pevents::PeventCollector< CollectedEntityType >::clk_
protected

Definition at line 238 of file PeventCollector.hpp.

◆ event_name_

template<class CollectedEntityType >
const std::string sparta::pevents::PeventCollector< CollectedEntityType >::event_name_
protected

Definition at line 232 of file PeventCollector.hpp.

◆ f_skew_

template<class CollectedEntityType >
std::function<uint64_t(const uint64_t &, const uint32_t &)> sparta::pevents::PeventCollector< CollectedEntityType >::f_skew_
protected

Definition at line 239 of file PeventCollector.hpp.

◆ message_src_

template<class CollectedEntityType >
log::MessageSource sparta::pevents::PeventCollector< CollectedEntityType >::message_src_
protected

Definition at line 234 of file PeventCollector.hpp.

◆ running_

template<class CollectedEntityType >
bool sparta::pevents::PeventCollector< CollectedEntityType >::running_ = false
protected

Definition at line 242 of file PeventCollector.hpp.

◆ skew_

template<class CollectedEntityType >
uint32_t sparta::pevents::PeventCollector< CollectedEntityType >::skew_
protected

Definition at line 240 of file PeventCollector.hpp.

◆ taps_

template<class CollectedEntityType >
std::vector<std::unique_ptr<log::Tap > > sparta::pevents::PeventCollector< CollectedEntityType >::taps_
protected

Definition at line 236 of file PeventCollector.hpp.

◆ verbosity_

template<class CollectedEntityType >
bool sparta::pevents::PeventCollector< CollectedEntityType >::verbosity_
protected

Definition at line 241 of file PeventCollector.hpp.


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