The Sparta Modeling Framework
Loading...
Searching...
No Matches
sparta::tracker::StatePool< T > Class Template Reference

StatePool class template is templatized on the enum type we are tracking. More...

#include <StateTracker.hpp>

Inheritance diagram for sparta::tracker::StatePool< T >:
Collaboration diagram for sparta::tracker::StatePool< T >:

Public Member Functions

 StatePool ()=delete
 The Default Ctor is deleted because StatePool cannot be created.
 
 StatePool (const std::string &tracking_filename)
 A file name is a must when constructing StatePool.
 
state_tracker_ptr< T > getNewStateTrackerUnit (Scheduler *scheduler) noexcept
 Method which gets invoked whenever a demand for a new.
 
void releaseToPool (StateTrackerUnit< T > *&raw_ptr)
 Method which is invoked when individual State Tracker Units.
 
void transferQueueData (std::deque< state_tracker_ptr< T > > *raw_queue)
 This is the main method, the custom deleter of the Tracker Queues.
 

Static Public Member Functions

static size_t id () noexcept
 Method which associates this StatePool template instantiation.
 

Additional Inherited Members

- Static Protected Member Functions inherited from sparta::tracker::StatePoolBase
static size_t next () noexcept
 

Detailed Description

template<typename T>
class sparta::tracker::StatePool< T >

StatePool class template is templatized on the enum type we are tracking.

Definition at line 176 of file StateTracker.hpp.

Constructor & Destructor Documentation

◆ StatePool()

template<typename T >
sparta::tracker::StatePool< T >::StatePool ( const std::string &  tracking_filename)
inlineexplicit

A file name is a must when constructing StatePool.

Definition at line 184 of file StateTracker.hpp.

Member Function Documentation

◆ getNewStateTrackerUnit()

template<typename T >
state_tracker_ptr< T > sparta::tracker::StatePool< T >::getNewStateTrackerUnit ( Scheduler scheduler)
inlinenoexcept

Method which gets invoked whenever a demand for a new.

Increment the instance count as number of tracker units

If the Queue of tracker units is empty, we create a new

If the Queue has available Tracker Units to go, we just pop

Definition at line 211 of file StateTracker.hpp.

◆ id()

template<typename T >
static size_t sparta::tracker::StatePool< T >::id ( )
inlinestaticnoexcept

Method which associates this StatePool template instantiation.

Definition at line 204 of file StateTracker.hpp.

◆ releaseToPool()

template<typename T >
void sparta::tracker::StatePool< T >::releaseToPool ( StateTrackerUnit< T > *&  raw_ptr)
inline

Method which is invoked when individual State Tracker Units.

Wrap this raw pointer into a unique pointer.

This tracker unit cannot be a nullptr.

If this tracker unit has some un-processed data in it

Finally, push the Tracker Unit at the back of the queue.

Definition at line 237 of file StateTracker.hpp.

◆ transferQueueData()

template<typename T >
void sparta::tracker::StatePool< T >::transferQueueData ( std::deque< state_tracker_ptr< T > > *  raw_queue)
inline

This is the main method, the custom deleter of the Tracker Queues.

Wrap the raw pointer into a unique_ptr, a good practise.

If we have reached this point, instance count cannot be 0.

Open the state tracking file.

We need to reset this self-reference pointer so that the

Create a vector to hold the results.

We process each and every State Tracker Unit in the queue.

Grab the Calculation Engine from the tracker unit being processed.

Calculate average stats from the aggregate stats by using

Store the enum class names by using gcc PRETTY_FUNCTION.

Finally, we label the Histogram and write this data into file.

Store the individual enum constant names.

This loop iterates one less than the size of this vector times.

This loop iterates one less than the size of this vector times.

Definition at line 259 of file StateTracker.hpp.


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