gem5  v21.1.0.2
Public Member Functions | Private Attributes | List of all members
gem5::TraceGen::InputStream Class Reference

The InputStream encapsulates a trace file and the internal buffers and populates TraceElements based on the input. More...

Public Member Functions

 InputStream (const std::string &filename)
 Create a trace input stream for a given file name. More...
 
void reset ()
 Reset the stream such that it can be played once again. More...
 
void init ()
 Check the trace header to make sure that it is of the right format. More...
 
bool read (TraceElement &element)
 Attempt to read a trace element from the stream, and also notify the caller if the end of the file was reached. More...
 

Private Attributes

ProtoInputStream trace
 Input file stream for the protobuf trace. More...
 

Detailed Description

The InputStream encapsulates a trace file and the internal buffers and populates TraceElements based on the input.

Definition at line 109 of file trace_gen.hh.

Constructor & Destructor Documentation

◆ InputStream()

gem5::TraceGen::InputStream::InputStream ( const std::string &  filename)

Create a trace input stream for a given file name.

Parameters
filenamePath to the file to read from

Definition at line 52 of file trace_gen.cc.

References init().

Member Function Documentation

◆ init()

void gem5::TraceGen::InputStream::init ( )

Check the trace header to make sure that it is of the right format.

Definition at line 59 of file trace_gen.cc.

References gem5::sim_clock::Frequency, panic, read(), and gem5::TraceGen::trace.

Referenced by InputStream().

◆ read()

bool gem5::TraceGen::InputStream::read ( TraceElement element)

Attempt to read a trace element from the stream, and also notify the caller if the end of the file was reached.

Parameters
elementTrace element to populate
Returns
True if an element could be read successfully

Definition at line 79 of file trace_gen.cc.

References gem5::TraceGen::TraceElement::addr, gem5::TraceGen::TraceElement::blocksize, gem5::TraceGen::TraceElement::cmd, gem5::MemCmd::cmd, gem5::TraceGen::TraceElement::flags, read(), gem5::TraceGen::TraceElement::tick, and gem5::TraceGen::trace.

Referenced by gem5::TraceGen::enter(), gem5::TraceGen::getNextPacket(), init(), and read().

◆ reset()

void gem5::TraceGen::InputStream::reset ( )

Reset the stream such that it can be played once again.

Definition at line 72 of file trace_gen.cc.

References gem5::statistics::init, reset(), and gem5::TraceGen::trace.

Referenced by gem5::TraceGen::exit(), and reset().

Member Data Documentation

◆ trace

ProtoInputStream gem5::TraceGen::InputStream::trace
private

Input file stream for the protobuf trace.

Definition at line 115 of file trace_gen.hh.


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

Generated on Tue Sep 21 2021 12:28:19 for gem5 by doxygen 1.8.17