gem5 v24.0.0.0
|
The trace replay generator reads a trace file and plays back the transactions. More...
#include <trace_gen.hh>
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. | |
void | enter () |
Enter this generator state. | |
PacketPtr | getNextPacket () |
Get the next generated packet. | |
void | exit () |
Exit this generator state. | |
Tick | nextPacketTick (bool elastic, Tick delay) const |
Returns the tick when the next request should be generated. | |
Public Member Functions inherited from gem5::BaseGen | |
BaseGen (SimObject &obj, RequestorID requestor_id, Tick _duration) | |
Create a base generator. | |
virtual | ~BaseGen () |
std::string | name () const |
Get the name, useful for DPRINTFs. | |
Private Attributes | |
InputStream | trace |
Input stream used for reading the input trace file. | |
TraceElement | currElement |
Store the current and next element in the trace. | |
TraceElement | nextElement |
Tick | tickOffset |
Stores the time when the state was entered. | |
Addr | addrOffset |
Offset for memory requests. | |
bool | traceComplete |
Set to true when the trace replay for one instance of state is complete. | |
Additional Inherited Members | |
Public Attributes inherited from gem5::BaseGen | |
const Tick | duration |
Time to spend in this state. | |
Protected Member Functions inherited from gem5::BaseGen | |
PacketPtr | getPacket (Addr addr, unsigned size, const MemCmd &cmd, Request::FlagsType flags=0) |
Generate a new request and associated packet. | |
Protected Attributes inherited from gem5::BaseGen | |
const std::string | _name |
Name to use for status and debug printing. | |
const RequestorID | requestorId |
The RequestorID used for generating requests. | |
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 61 of file trace_gen.hh.
|
inline |
Create a trace generator.
obj | SimObject owning this sequence generator |
requestor_id | RequestorID related to the memory requests |
_duration | duration of this state before transitioning |
trace_file | File to read the transactions from |
addr_offset | Positive offset to add to trace address |
Definition at line 160 of file trace_gen.hh.
|
virtual |
Enter this generator state.
Implements gem5::BaseGen.
Definition at line 119 of file trace_gen.cc.
References gem5::TraceGen::TraceElement::clear(), currElement, gem5::curTick(), nextElement, gem5::TraceGen::InputStream::read(), tickOffset, trace, and traceComplete.
|
virtual |
Exit this generator state.
By default do nothing.
Reimplemented from gem5::BaseGen.
Definition at line 168 of file trace_gen.cc.
References gem5::BaseGen::name(), gem5::TraceGen::InputStream::reset(), trace, traceComplete, and warn.
|
virtual |
Get the next generated packet.
Implements gem5::BaseGen.
Definition at line 132 of file trace_gen.cc.
References gem5::TraceGen::TraceElement::addr, addrOffset, gem5::TraceGen::TraceElement::blocksize, gem5::TraceGen::TraceElement::clear(), gem5::TraceGen::TraceElement::cmd, currElement, DPRINTF, gem5::TraceGen::TraceElement::flags, gem5::BaseGen::getPacket(), gem5::MemCmd::isRead(), gem5::TraceGen::TraceElement::isValid(), nextElement, gem5::TraceGen::InputStream::read(), gem5::TraceGen::TraceElement::tick, tickOffset, trace, and traceComplete.
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 gem5::BaseGen.
Definition at line 96 of file trace_gen.cc.
References gem5::curTick(), DPRINTF, gem5::TraceGen::TraceElement::isValid(), gem5::MaxTick, nextElement, gem5::TraceGen::TraceElement::tick, tickOffset, and traceComplete.
|
private |
Offset for memory requests.
Used to shift the trace away from the CPU address space.
Definition at line 203 of file trace_gen.hh.
Referenced by getNextPacket().
|
private |
Store the current and next element in the trace.
Definition at line 189 of file trace_gen.hh.
Referenced by enter(), and getNextPacket().
|
private |
Definition at line 190 of file trace_gen.hh.
Referenced by enter(), getNextPacket(), and nextPacketTick().
|
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 197 of file trace_gen.hh.
Referenced by enter(), getNextPacket(), and nextPacketTick().
|
private |
Input stream used for reading the input trace file.
Definition at line 186 of file trace_gen.hh.
Referenced by enter(), exit(), getNextPacket(), gem5::TraceGen::InputStream::init(), gem5::TraceGen::InputStream::read(), and gem5::TraceGen::InputStream::reset().
|
private |
Set to true when the trace replay for one instance of state is complete.
Definition at line 209 of file trace_gen.hh.
Referenced by enter(), exit(), getNextPacket(), and nextPacketTick().