gem5  v20.1.0.0
Classes | Public Member Functions | Private Attributes | List of all members
TraceGen Class Reference

The trace replay generator reads a trace file and plays back the transactions. More...

#include <trace_gen.hh>

Inheritance diagram for TraceGen:
BaseGen

Classes

class  InputStream
 The InputStream encapsulates a trace file and the internal buffers and populates TraceElements based on the input. More...
 
struct  TraceElement
 This struct stores a line in the trace file. More...
 

Public Member Functions

 TraceGen (SimObject &obj, RequestorID requestor_id, Tick _duration, const std::string &trace_file, Addr addr_offset)
 Create a trace generator. More...
 
void enter ()
 Enter this generator state. More...
 
PacketPtr getNextPacket ()
 Get the next generated packet. More...
 
void exit ()
 Exit this generator state. More...
 
Tick nextPacketTick (bool elastic, Tick delay) const
 Returns the tick when the next request should be generated. More...
 
- Public Member Functions inherited from BaseGen
 BaseGen (SimObject &obj, RequestorID requestor_id, Tick _duration)
 Create a base generator. More...
 
virtual ~BaseGen ()
 
std::string name () const
 Get the name, useful for DPRINTFs. More...
 

Private Attributes

InputStream trace
 Input stream used for reading the input trace file. More...
 
TraceElement currElement
 Store the current and next element in the trace. More...
 
TraceElement nextElement
 
Tick tickOffset
 Stores the time when the state was entered. More...
 
Addr addrOffset
 Offset for memory requests. More...
 
bool traceComplete
 Set to true when the trace replay for one instance of state is complete. More...
 

Additional Inherited Members

- Public Attributes inherited from BaseGen
const Tick duration
 Time to spend in this state. More...
 
- Protected Member Functions inherited from BaseGen
PacketPtr getPacket (Addr addr, unsigned size, const MemCmd &cmd, Request::FlagsType flags=0)
 Generate a new request and associated packet. More...
 
- Protected Attributes inherited from BaseGen
const std::string _name
 Name to use for status and debug printing. More...
 
const RequestorID requestorId
 The RequestorID used for generating requests. More...
 

Detailed Description

The trace replay generator reads a trace file and plays back the transactions.

The trace is offset with respect to the time when the state was entered.

Definition at line 58 of file trace_gen.hh.

Constructor & Destructor Documentation

◆ TraceGen()

TraceGen::TraceGen ( SimObject obj,
RequestorID  requestor_id,
Tick  _duration,
const std::string &  trace_file,
Addr  addr_offset 
)
inline

Create a trace generator.

Parameters
objSimObject owning this sequence generator
requestor_idRequestorID related to the memory requests
_durationduration of this state before transitioning
trace_fileFile to read the transactions from
addr_offsetPositive offset to add to trace address

Definition at line 156 of file trace_gen.hh.

Member Function Documentation

◆ enter()

void TraceGen::enter ( )
virtual

Enter this generator state.

Implements BaseGen.

Definition at line 114 of file trace_gen.cc.

References TraceGen::TraceElement::clear(), currElement, curTick(), nextElement, TraceGen::InputStream::read(), tickOffset, trace, and traceComplete.

◆ exit()

void TraceGen::exit ( )
virtual

Exit this generator state.

By default do nothing.

Reimplemented from BaseGen.

Definition at line 163 of file trace_gen.cc.

References BaseGen::name(), TraceGen::InputStream::reset(), trace, traceComplete, and warn.

◆ getNextPacket()

PacketPtr TraceGen::getNextPacket ( )
virtual

◆ nextPacketTick()

Tick TraceGen::nextPacketTick ( bool  elastic,
Tick  delay 
) const
virtual

Returns the tick when the next request should be generated.

If the end of the file has been reached, it returns MaxTick to indicate that there will be no more requests.

Implements BaseGen.

Definition at line 91 of file trace_gen.cc.

References curTick(), DPRINTF, TraceGen::TraceElement::isValid(), MaxTick, nextElement, TraceGen::TraceElement::tick, tickOffset, and traceComplete.

Member Data Documentation

◆ addrOffset

Addr TraceGen::addrOffset
private

Offset for memory requests.

Used to shift the trace away from the CPU address space.

Definition at line 199 of file trace_gen.hh.

Referenced by getNextPacket().

◆ currElement

TraceElement TraceGen::currElement
private

Store the current and next element in the trace.

Definition at line 185 of file trace_gen.hh.

Referenced by enter(), and getNextPacket().

◆ nextElement

TraceElement TraceGen::nextElement
private

Definition at line 186 of file trace_gen.hh.

Referenced by enter(), getNextPacket(), and nextPacketTick().

◆ tickOffset

Tick TraceGen::tickOffset
mutableprivate

Stores the time when the state was entered.

This is to add an offset to the times stored in the trace file. This is mutable to allow us to change it as part of nextPacketTick.

Definition at line 193 of file trace_gen.hh.

Referenced by enter(), getNextPacket(), and nextPacketTick().

◆ trace

InputStream TraceGen::trace
private

Input stream used for reading the input trace file.

Definition at line 182 of file trace_gen.hh.

Referenced by enter(), exit(), getNextPacket(), TraceGen::InputStream::init(), TraceGen::InputStream::read(), and TraceGen::InputStream::reset().

◆ traceComplete

bool TraceGen::traceComplete
private

Set to true when the trace replay for one instance of state is complete.

Definition at line 205 of file trace_gen.hh.

Referenced by enter(), exit(), getNextPacket(), and nextPacketTick().


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

Generated on Wed Sep 30 2020 14:02:33 for gem5 by doxygen 1.8.17