OpenASIP  2.0
Classes | Public Types | Public Member Functions | Private Attributes | List of all members
CallPathTracker Class Reference

#include <CallPathTracker.hh>

Inheritance diagram for CallPathTracker:
Inheritance graph
Collaboration diagram for CallPathTracker:
Collaboration graph

Classes

struct  ProcedureTransfer
 

Public Types

typedef std::deque< ProcedureTransferProcedureTransferQueue
 

Public Member Functions

 CallPathTracker (SimulatorFrontend &subject, unsigned, int historyLength)
 
virtual ~CallPathTracker ()
 
virtual void addProcedureTransfer (ClockCycleCount cycle, InstructionAddress address, InstructionAddress sourceAddress, bool isEntry)
 
const ProcedureTransferQueuetransfers () const
 
const ProcedureTransferQueue backTrace () const
 
- Public Member Functions inherited from ProcedureTransferTracker
 ProcedureTransferTracker (SimulatorFrontend &subject, ExecutionTrace &traceDB)
 
 ProcedureTransferTracker (SimulatorFrontend &subject)
 
virtual ~ProcedureTransferTracker ()
 
virtual void handleEvent ()
 
- Public Member Functions inherited from Listener
 Listener ()
 
virtual ~Listener ()
 
virtual void handleEvent (int event)
 

Private Attributes

std::size_t historyLength_
 max number of last calls/returns to store More...
 
ProcedureTransferQueue transfers_
 the transfers are stored in a queue of which size is kept under historyLength_ More...
 

Detailed Description

Tracks procedure transfers in the simulated program and stores them in memory for quick viewing during simulation/debugging.

There should be one instance of this tracker for each tracked core.

Definition at line 51 of file CallPathTracker.hh.

Member Typedef Documentation

◆ ProcedureTransferQueue

Definition at line 60 of file CallPathTracker.hh.

Constructor & Destructor Documentation

◆ CallPathTracker()

CallPathTracker::CallPathTracker ( SimulatorFrontend subject,
unsigned  ,
int  historyLength 
)
inline

Definition at line 62 of file CallPathTracker.hh.

65  :
66  ProcedureTransferTracker(subject),
67  historyLength_(historyLength) {}

◆ ~CallPathTracker()

virtual CallPathTracker::~CallPathTracker ( )
inlinevirtual

Definition at line 68 of file CallPathTracker.hh.

68 {}

Member Function Documentation

◆ addProcedureTransfer()

void CallPathTracker::addProcedureTransfer ( ClockCycleCount  cycle,
InstructionAddress  address,
InstructionAddress  sourceAddress,
bool  isEntry 
)
virtual

This function is called to record a procedure transfer (call or return).

The default implementation stores the transfer to a TraceDB.

Reimplemented from ProcedureTransferTracker.

Definition at line 33 of file CallPathTracker.cc.

37  {
38 
39  if (transfers_.size() > historyLength_)
40  transfers_.pop_front();
41  ProcedureTransfer transfer;
42  transfer.cycle = cycle;
43  transfer.address = address;
44  transfer.sourceAddress = sourceAddress;
45  transfer.isEntry = isEntry;
46  transfers_.push_back(transfer);
47 }

References CallPathTracker::ProcedureTransfer::address, CallPathTracker::ProcedureTransfer::cycle, historyLength_, CallPathTracker::ProcedureTransfer::isEntry, CallPathTracker::ProcedureTransfer::sourceAddress, and transfers_.

◆ backTrace()

const CallPathTracker::ProcedureTransferQueue CallPathTracker::backTrace ( ) const

Returns the history in a "back trace form" with calls and returns not contributing to the current call path stripped out.

Definition at line 54 of file CallPathTracker.cc.

54  {
55  ProcedureTransferQueue allTransfers = transfers();
57  int callsToSkip = 0;
58  CallPathTracker::ProcedureTransferQueue::const_reverse_iterator i =
59  allTransfers.rbegin();
60  // Define end iterator as an explilcit variable to avoid compiling
61  // bug under Mac OS X.
62  CallPathTracker::ProcedureTransferQueue::const_reverse_iterator e =
63  allTransfers.rend();
64  for (; i != e; ++i) {
66  if (!tr.isEntry) {
67  ++callsToSkip;
68  continue;
69  }
70  if (callsToSkip == 0) {
71  bt.push_back(tr);
72  } else {
73  callsToSkip--;
74  }
75  }
76  return bt;
77 }

References CallPathTracker::ProcedureTransfer::isEntry, and transfers().

Referenced by BackTraceCommand::execute().

Here is the call graph for this function:

◆ transfers()

const ProcedureTransferQueue& CallPathTracker::transfers ( ) const
inline

Definition at line 76 of file CallPathTracker.hh.

76 { return transfers_; }

References transfers_.

Referenced by backTrace(), and BackTraceCommand::execute().

Member Data Documentation

◆ historyLength_

std::size_t CallPathTracker::historyLength_
private

max number of last calls/returns to store

Definition at line 82 of file CallPathTracker.hh.

Referenced by addProcedureTransfer().

◆ transfers_

ProcedureTransferQueue CallPathTracker::transfers_
private

the transfers are stored in a queue of which size is kept under historyLength_

Definition at line 85 of file CallPathTracker.hh.

Referenced by addProcedureTransfer(), and transfers().


The documentation for this class was generated from the following files:
CallPathTracker::transfers_
ProcedureTransferQueue transfers_
the transfers are stored in a queue of which size is kept under historyLength_
Definition: CallPathTracker.hh:85
CallPathTracker::transfers
const ProcedureTransferQueue & transfers() const
Definition: CallPathTracker.hh:76
CallPathTracker::ProcedureTransferQueue
std::deque< ProcedureTransfer > ProcedureTransferQueue
Definition: CallPathTracker.hh:60
CallPathTracker::historyLength_
std::size_t historyLength_
max number of last calls/returns to store
Definition: CallPathTracker.hh:82
CallPathTracker::ProcedureTransfer
Definition: CallPathTracker.hh:53
ProcedureTransferTracker::ProcedureTransferTracker
ProcedureTransferTracker(SimulatorFrontend &subject, ExecutionTrace &traceDB)
Definition: ProcedureTransferTracker.cc:59
CallPathTracker::ProcedureTransfer::isEntry
bool isEntry
Definition: CallPathTracker.hh:57