gem5 v24.1.0.1
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
gem5::LooppointAnalysisManager Class Reference

#include <looppoint_analysis.hh>

Inheritance diagram for gem5::LooppointAnalysisManager:
gem5::SimObject gem5::EventManager gem5::Serializable gem5::Drainable gem5::statistics::Group gem5::Named

Public Member Functions

 LooppointAnalysisManager (const LooppointAnalysisManagerParams &params)
 
void countBackwardBranch (const Addr pc)
 This function is called by the LooppointAnalysis probe listener when it finds a valid backward branch that can be used as a marker.
 
void updateGlobalBBV (const Addr pc)
 This function is called by the LooppointAnalysis probe listener when it reaches the branch instruction for a valid basic block.
 
bool ifBackwardBranch (const Addr pc) const
 
bool ifValidNotControl (const Addr pc) const
 
bool ifValidControl (const Addr pc) const
 
bool ifEncountered (const Addr pc) const
 
void updateValidNotControl (const Addr pc)
 
void updateValidControl (const Addr pc)
 
void updateEncountered (const Addr pc)
 
void updateBBInstMap (Addr pc, uint64_t inst_ount)
 
std::unordered_map< Addr, uint64_t > getBBInstMap () const
 
std::unordered_map< Addr, uint64_t > getGlobalBBV () const
 
void clearGlobalBBV ()
 
uint64_t getGlobalInstCounter () const
 
void clearGlobalInstCounter ()
 
void incrementGlobalInstCounter ()
 
Addr getMostRecentBackwardBranchPC () const
 
std::unordered_map< Addr, uint64_t > getBackwardBranchCounter () const
 
uint64_t getMostRecentBackwardBranchCount () const
 
- Public Member Functions inherited from gem5::SimObject
const Paramsparams () const
 
 SimObject (const Params &p)
 
virtual ~SimObject ()
 
virtual void init ()
 init() is called after all C++ SimObjects have been created and all ports are connected.
 
virtual void loadState (CheckpointIn &cp)
 loadState() is called on each SimObject when restoring from a checkpoint.
 
virtual void initState ()
 initState() is called on each SimObject when not restoring from a checkpoint.
 
virtual void regProbePoints ()
 Register probe points for this object.
 
virtual void regProbeListeners ()
 Register probe listeners for this object.
 
ProbeManagergetProbeManager ()
 Get the probe manager for this object.
 
virtual PortgetPort (const std::string &if_name, PortID idx=InvalidPortID)
 Get a port with a given name and index.
 
virtual void startup ()
 startup() is the final initialization call before simulation.
 
DrainState drain () override
 Provide a default implementation of the drain interface for objects that don't need draining.
 
virtual void memWriteback ()
 Write back dirty buffers to memory using functional writes.
 
virtual void memInvalidate ()
 Invalidate the contents of memory buffers.
 
void serialize (CheckpointOut &cp) const override
 Serialize an object.
 
void unserialize (CheckpointIn &cp) override
 Unserialize an object.
 
- Public Member Functions inherited from gem5::EventManager
EventQueueeventQueue () const
 
void schedule (Event &event, Tick when)
 
void deschedule (Event &event)
 
void reschedule (Event &event, Tick when, bool always=false)
 
void schedule (Event *event, Tick when)
 
void deschedule (Event *event)
 
void reschedule (Event *event, Tick when, bool always=false)
 
void wakeupEventQueue (Tick when=(Tick) -1)
 This function is not needed by the usual gem5 event loop but may be necessary in derived EventQueues which host gem5 on other schedulers.
 
void setCurTick (Tick newVal)
 
 EventManager (EventManager &em)
 Event manger manages events in the event queue.
 
 EventManager (EventManager *em)
 
 EventManager (EventQueue *eq)
 
- Public Member Functions inherited from gem5::Serializable
 Serializable ()
 
virtual ~Serializable ()
 
void serializeSection (CheckpointOut &cp, const char *name) const
 Serialize an object into a new section.
 
void serializeSection (CheckpointOut &cp, const std::string &name) const
 
void unserializeSection (CheckpointIn &cp, const char *name)
 Unserialize an a child object.
 
void unserializeSection (CheckpointIn &cp, const std::string &name)
 
- Public Member Functions inherited from gem5::Drainable
DrainState drainState () const
 Return the current drain state of an object.
 
virtual void notifyFork ()
 Notify a child process of a fork.
 
- Public Member Functions inherited from gem5::statistics::Group
 Group (Group *parent, const char *name=nullptr)
 Construct a new statistics group.
 
virtual ~Group ()
 
virtual void regStats ()
 Callback to set stat parameters.
 
virtual void resetStats ()
 Callback to reset stats.
 
virtual void preDumpStats ()
 Callback before stats are dumped.
 
void addStat (statistics::Info *info)
 Register a stat with this group.
 
const std::map< std::string, Group * > & getStatGroups () const
 Get all child groups associated with this object.
 
const std::vector< Info * > & getStats () const
 Get all stats associated with this object.
 
void addStatGroup (const char *name, Group *block)
 Add a stat block as a child of this block.
 
const InforesolveStat (std::string name) const
 Resolve a stat by its name within this group.
 
void mergeStatGroup (Group *block)
 Merge the contents (stats & children) of a block to this block.
 
 Group (const Group &)=delete
 
Groupoperator= (const Group &)=delete
 
- Public Member Functions inherited from gem5::Named
 Named (const std::string &name_)
 
virtual ~Named ()=default
 
virtual std::string name () const
 

Private Attributes

std::unordered_map< Addr, uint64_t > backwardBranchCounter
 This counter is for the valid backward branches that we consider as candidates for marking the execution points.
 
std::unordered_map< Addr, uint64_t > globalBBV
 This is the global basic block vector that contains the count of each basic block that is executed.
 
std::unordered_map< Addr, uint64_t > bbInstMap
 This map stores the number of instructions in each basic block.
 
uint64_t regionLength
 This variable stores the number of instructions that we used to define a region.
 
uint64_t globalInstCounter
 This is a counter for the globally executed instructions.
 
Addr mostRecentBackwardBranchPC
 This variable stores the Program Counter address of the most recent valid backward branch that we consider as a marker.
 
std::unordered_set< AddrvalidNotControlPC
 This set stores the Program Counter addresses of the valid not control instructions.
 
std::unordered_set< AddrvalidControlPC
 This set stores the Program Counter addresses of the valid control instructions.
 
std::unordered_set< AddrencounteredPC
 This set stores the Program Counter addresses of the encountered instructions.
 

Additional Inherited Members

- Public Types inherited from gem5::SimObject
typedef SimObjectParams Params
 
- Static Public Member Functions inherited from gem5::SimObject
static void serializeAll (const std::string &cpt_dir)
 Create a checkpoint by serializing all SimObjects in the system.
 
static SimObjectfind (const char *name)
 Find the SimObject with the given name and return a pointer to it.
 
static void setSimObjectResolver (SimObjectResolver *resolver)
 There is a single object name resolver, and it is only set when simulation is restoring from checkpoints.
 
static SimObjectResolvergetSimObjectResolver ()
 There is a single object name resolver, and it is only set when simulation is restoring from checkpoints.
 
- Static Public Member Functions inherited from gem5::Serializable
static const std::string & currentSection ()
 Gets the fully-qualified name of the active section.
 
static void generateCheckpointOut (const std::string &cpt_dir, std::ofstream &outstream)
 Generate a checkpoint file so that the serialization can be routed to it.
 
- Protected Member Functions inherited from gem5::Drainable
 Drainable ()
 
virtual ~Drainable ()
 
virtual void drainResume ()
 Resume execution after a successful drain.
 
void signalDrainDone () const
 Signal that an object is drained.
 
- Protected Attributes inherited from gem5::SimObject
const SimObjectParams & _params
 Cached copy of the object parameters.
 
- Protected Attributes inherited from gem5::EventManager
EventQueueeventq
 A pointer to this object's event queue.
 

Detailed Description

Definition at line 148 of file looppoint_analysis.hh.

Constructor & Destructor Documentation

◆ LooppointAnalysisManager()

gem5::LooppointAnalysisManager::LooppointAnalysisManager ( const LooppointAnalysisManagerParams &  params)

Definition at line 210 of file looppoint_analysis.cc.

References DPRINTF, and regionLength.

Member Function Documentation

◆ clearGlobalBBV()

void gem5::LooppointAnalysisManager::clearGlobalBBV ( )
inline

Definition at line 294 of file looppoint_analysis.hh.

References DPRINTF, and globalBBV.

◆ clearGlobalInstCounter()

void gem5::LooppointAnalysisManager::clearGlobalInstCounter ( )
inline

Definition at line 307 of file looppoint_analysis.hh.

References DPRINTF, and globalInstCounter.

◆ countBackwardBranch()

void gem5::LooppointAnalysisManager::countBackwardBranch ( const Addr  pc)

This function is called by the LooppointAnalysis probe listener when it finds a valid backward branch that can be used as a marker.

Specifically, it increments the backwardBranchCounter for the input PC.

Definition at line 221 of file looppoint_analysis.cc.

References backwardBranchCounter, DPRINTF, gem5::exitSimLoopNow(), globalInstCounter, mostRecentBackwardBranchPC, gem5::MipsISA::pc, and regionLength.

Referenced by gem5::LooppointAnalysis::checkPc().

◆ getBackwardBranchCounter()

std::unordered_map< Addr, uint64_t > gem5::LooppointAnalysisManager::getBackwardBranchCounter ( ) const
inline

Definition at line 327 of file looppoint_analysis.hh.

References backwardBranchCounter.

◆ getBBInstMap()

std::unordered_map< Addr, uint64_t > gem5::LooppointAnalysisManager::getBBInstMap ( ) const
inline

Definition at line 282 of file looppoint_analysis.hh.

References bbInstMap.

◆ getGlobalBBV()

std::unordered_map< Addr, uint64_t > gem5::LooppointAnalysisManager::getGlobalBBV ( ) const
inline

Definition at line 288 of file looppoint_analysis.hh.

References globalBBV.

◆ getGlobalInstCounter()

uint64_t gem5::LooppointAnalysisManager::getGlobalInstCounter ( ) const
inline

Definition at line 301 of file looppoint_analysis.hh.

References globalInstCounter.

◆ getMostRecentBackwardBranchCount()

uint64_t gem5::LooppointAnalysisManager::getMostRecentBackwardBranchCount ( ) const
inline

Definition at line 333 of file looppoint_analysis.hh.

References backwardBranchCounter, and mostRecentBackwardBranchPC.

◆ getMostRecentBackwardBranchPC()

Addr gem5::LooppointAnalysisManager::getMostRecentBackwardBranchPC ( ) const
inline

Definition at line 321 of file looppoint_analysis.hh.

References mostRecentBackwardBranchPC.

◆ ifBackwardBranch()

bool gem5::LooppointAnalysisManager::ifBackwardBranch ( const Addr  pc) const
inline

Definition at line 232 of file looppoint_analysis.hh.

References backwardBranchCounter, and gem5::MipsISA::pc.

Referenced by gem5::LooppointAnalysis::checkPc().

◆ ifEncountered()

bool gem5::LooppointAnalysisManager::ifEncountered ( const Addr  pc) const
inline

Definition at line 250 of file looppoint_analysis.hh.

References encounteredPC, and gem5::MipsISA::pc.

Referenced by gem5::LooppointAnalysis::checkPc().

◆ ifValidControl()

bool gem5::LooppointAnalysisManager::ifValidControl ( const Addr  pc) const
inline

Definition at line 244 of file looppoint_analysis.hh.

References gem5::MipsISA::pc, and validControlPC.

Referenced by gem5::LooppointAnalysis::checkPc().

◆ ifValidNotControl()

bool gem5::LooppointAnalysisManager::ifValidNotControl ( const Addr  pc) const
inline

Definition at line 238 of file looppoint_analysis.hh.

References gem5::MipsISA::pc, and validNotControlPC.

Referenced by gem5::LooppointAnalysis::checkPc().

◆ incrementGlobalInstCounter()

void gem5::LooppointAnalysisManager::incrementGlobalInstCounter ( )
inline

Definition at line 315 of file looppoint_analysis.hh.

References globalInstCounter.

Referenced by gem5::LooppointAnalysis::checkPc().

◆ updateBBInstMap()

void gem5::LooppointAnalysisManager::updateBBInstMap ( Addr  pc,
uint64_t  inst_ount 
)
inline

Definition at line 274 of file looppoint_analysis.hh.

References bbInstMap, and gem5::MipsISA::pc.

Referenced by gem5::LooppointAnalysis::checkPc().

◆ updateEncountered()

void gem5::LooppointAnalysisManager::updateEncountered ( const Addr  pc)
inline

Definition at line 268 of file looppoint_analysis.hh.

References encounteredPC, and gem5::MipsISA::pc.

Referenced by gem5::LooppointAnalysis::checkPc().

◆ updateGlobalBBV()

void gem5::LooppointAnalysisManager::updateGlobalBBV ( const Addr  pc)

This function is called by the LooppointAnalysis probe listener when it reaches the branch instruction for a valid basic block.

Specifically, it increments the globalBBV for the input PC.

Definition at line 246 of file looppoint_analysis.cc.

References globalBBV, and gem5::MipsISA::pc.

Referenced by gem5::LooppointAnalysis::checkPc().

◆ updateValidControl()

void gem5::LooppointAnalysisManager::updateValidControl ( const Addr  pc)
inline

Definition at line 262 of file looppoint_analysis.hh.

References gem5::MipsISA::pc, and validControlPC.

Referenced by gem5::LooppointAnalysis::checkPc().

◆ updateValidNotControl()

void gem5::LooppointAnalysisManager::updateValidNotControl ( const Addr  pc)
inline

Definition at line 256 of file looppoint_analysis.hh.

References gem5::MipsISA::pc, and validNotControlPC.

Referenced by gem5::LooppointAnalysis::checkPc().

Member Data Documentation

◆ backwardBranchCounter

std::unordered_map<Addr, uint64_t> gem5::LooppointAnalysisManager::backwardBranchCounter
private

This counter is for the valid backward branches that we consider as candidates for marking the execution points.

The key is the Program Counter address of the backward branch, and the value is the number of times the backward branch is executed.

Definition at line 174 of file looppoint_analysis.hh.

Referenced by countBackwardBranch(), getBackwardBranchCounter(), getMostRecentBackwardBranchCount(), and ifBackwardBranch().

◆ bbInstMap

std::unordered_map<Addr, uint64_t> gem5::LooppointAnalysisManager::bbInstMap
private

This map stores the number of instructions in each basic block.

The key is the Program Counter address of the basic block's branch instruction, and the value is the number of instructions in the basic block.

Definition at line 191 of file looppoint_analysis.hh.

Referenced by getBBInstMap(), and updateBBInstMap().

◆ encounteredPC

std::unordered_set<Addr> gem5::LooppointAnalysisManager::encounteredPC
private

This set stores the Program Counter addresses of the encountered instructions.

Definition at line 228 of file looppoint_analysis.hh.

Referenced by ifEncountered(), and updateEncountered().

◆ globalBBV

std::unordered_map<Addr, uint64_t> gem5::LooppointAnalysisManager::globalBBV
private

This is the global basic block vector that contains the count of each basic block that is executed.

The key is the Program Counter address of the basic block's branch instruction, and the value is the number of times the basic block is executed.

Definition at line 183 of file looppoint_analysis.hh.

Referenced by clearGlobalBBV(), getGlobalBBV(), and updateGlobalBBV().

◆ globalInstCounter

uint64_t gem5::LooppointAnalysisManager::globalInstCounter
private

This is a counter for the globally executed instructions.

We use this to compare with the regionLength to determine if we reach the end of a region.

Definition at line 206 of file looppoint_analysis.hh.

Referenced by clearGlobalInstCounter(), countBackwardBranch(), getGlobalInstCounter(), and incrementGlobalInstCounter().

◆ mostRecentBackwardBranchPC

Addr gem5::LooppointAnalysisManager::mostRecentBackwardBranchPC
private

This variable stores the Program Counter address of the most recent valid backward branch that we consider as a marker.

Definition at line 212 of file looppoint_analysis.hh.

Referenced by countBackwardBranch(), getMostRecentBackwardBranchCount(), and getMostRecentBackwardBranchPC().

◆ regionLength

uint64_t gem5::LooppointAnalysisManager::regionLength
private

This variable stores the number of instructions that we used to define a region.

For example, if the regionLength is 100, then every time when there are 100 valid instructions executed globally through all the cores, we will consider that as a region.

Definition at line 199 of file looppoint_analysis.hh.

Referenced by countBackwardBranch(), and LooppointAnalysisManager().

◆ validControlPC

std::unordered_set<Addr> gem5::LooppointAnalysisManager::validControlPC
private

This set stores the Program Counter addresses of the valid control instructions.

Definition at line 223 of file looppoint_analysis.hh.

Referenced by ifValidControl(), and updateValidControl().

◆ validNotControlPC

std::unordered_set<Addr> gem5::LooppointAnalysisManager::validNotControlPC
private

This set stores the Program Counter addresses of the valid not control instructions.

Definition at line 218 of file looppoint_analysis.hh.

Referenced by ifValidNotControl(), and updateValidNotControl().


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

Generated on Mon Jan 13 2025 04:28:54 for gem5 by doxygen 1.9.8