Go to the documentation of this file.
42 #include "config/the_isa.hh"
45 #include "debug/ExecEnable.hh"
46 #include "params/InstPBTrace.hh"
47 #include "proto/inst.pb.h"
74 :
InstTracer(
p), buf(nullptr), bufSize(0), curMsg(nullptr)
90 ProtoMessage::InstHeader header_msg;
91 header_msg.set_obj_id(
"gem5 generated instruction trace");
92 header_msg.set_ver(0);
94 header_msg.set_has_mem(
true);
127 if (!debug::ExecEnable)
153 curMsg =
new ProtoMessage::Inst;
155 if (instSize ==
sizeof(uint32_t)) {
156 curMsg->set_inst(
letoh(*
reinterpret_cast<uint32_t *
>(
buf.get())));
157 }
else if (instSize) {
159 std::string(
reinterpret_cast<const char *
>(
buf.get()),
bufSize));
163 curMsg->set_type(
static_cast<ProtoMessage::Inst_InstType
>(
si->opClass()));
172 curMsg->set_type(
static_cast<ProtoMessage::Inst_InstType
>(
si->opClass()));
174 ProtoMessage::Inst::MemAccess *mem_msg =
curMsg->add_mem_access();
175 mem_msg->set_addr(
a);
176 mem_msg->set_size(
s);
177 mem_msg->set_mem_flags(
f);
Tick curTick()
The universal simulation clock.
void write(const google::protobuf::Message &msg)
Write a message to the stream, preprending it with the message size.
This in an instruction tracer that records the flow of instructions through multiple cpus and systems...
void dump() override
called by the cpu when the instruction commits.
Tick Frequency
The simulated frequency of curTick(). (In ticks per second)
bool isFirstMicroop() const
std::unique_ptr< uint8_t[]> buf
virtual int cpuId() const =0
static ProtoOutputStream * traceStream
One output stream for the entire simulation.
InstPBTraceRecord * getInstRecord(Tick when, ThreadContext *tc, const StaticInstPtr si, const PCStateBase &pc, const StaticInstPtr mi=NULL) override
ThreadContext is the external interface to all thread state for anything outside of the CPU.
void createTraceFile(std::string filename)
Create the output file and write the header into it.
ProtoMessage::Inst * curMsg
This is the message were working on writing.
void traceInst(ThreadContext *tc, StaticInstPtr si, const PCStateBase &pc)
Write an instruction to the trace file.
void traceMem(StaticInstPtr si, Addr a, Addr s, unsigned f)
Write a memory request to the trace file as part of the cur instruction.
uint64_t Tick
Tick count type.
std::string resolve(const std::string &name) const
Returns relative file names prepended with name of this directory.
friend class InstPBTraceRecord
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
InstPBTrace(const InstPBTraceParams &p)
std::unique_ptr< PCStateBase > pc
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
void closeStreams()
If there is a pending message still write it out and then close the file.
void registerExitCallback(const std::function< void()> &callback)
Register an exit callback.
StaticInstPtr macroStaticInst
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
A ProtoOutputStream wraps a coded stream, potentially with compression, based on looking at the file ...
unsigned getFlags() const
Generated on Tue Feb 8 2022 11:47:02 for gem5 by doxygen 1.8.17