gem5  v20.0.0.2
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | Private Attributes | List of all members
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 105 of file trace_gen.hh.

Constructor & Destructor Documentation

◆ InputStream()

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 47 of file trace_gen.cc.

References init().

Member Function Documentation

◆ init()

void TraceGen::InputStream::init ( )

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

Definition at line 54 of file trace_gen.cc.

References SimClock::Frequency, panic, ProtoInputStream::read(), and trace.

Referenced by InputStream(), and reset().

◆ read()

bool 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 74 of file trace_gen.cc.

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

◆ reset()

void TraceGen::InputStream::reset ( )

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

Definition at line 67 of file trace_gen.cc.

References init(), ProtoInputStream::reset(), and trace.

Member Data Documentation

◆ trace

ProtoInputStream TraceGen::InputStream::trace
private

Input file stream for the protobuf trace.

Definition at line 111 of file trace_gen.hh.

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


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

Generated on Mon Jun 8 2020 15:45:30 for gem5 by doxygen 1.8.13