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"
70 :
InstTracer(
p), buf(nullptr), bufSize(0), curMsg(nullptr)
86 ProtoMessage::InstHeader header_msg;
87 header_msg.set_obj_id(
"gem5 generated instruction trace");
88 header_msg.set_ver(0);
90 header_msg.set_has_mem(
true);
123 if (!Debug::ExecEnable)
148 curMsg =
new ProtoMessage::Inst;
150 if (instSize ==
sizeof(uint32_t)) {
151 curMsg->set_inst(
letoh(*
reinterpret_cast<uint32_t *
>(
buf.get())));
152 }
else if (instSize) {
154 std::string(
reinterpret_cast<const char *
>(
buf.get()),
bufSize));
158 curMsg->set_type(
static_cast<ProtoMessage::Inst_InstType
>(
si->opClass()));
167 curMsg->set_type(
static_cast<ProtoMessage::Inst_InstType
>(
si->opClass()));
169 ProtoMessage::Inst::MemAccess *mem_msg =
curMsg->add_mem_access();
170 mem_msg->set_addr(
a);
171 mem_msg->set_size(
s);
172 mem_msg->set_mem_flags(
f);
180 InstPBTraceParams::create()
void write(const google::protobuf::Message &msg)
Write a message to the stream, preprending it with the message size.
void createTraceFile(std::string filename)
Create the output file and write the header into it.
void traceMem(StaticInstPtr si, Addr a, Addr s, unsigned f)
Write a memory request to the trace file as part of the cur instruction.
InstPBTraceRecord * getInstRecord(Tick when, ThreadContext *tc, const StaticInstPtr si, TheISA::PCState pc, const StaticInstPtr mi=NULL) override
static ProtoOutputStream * traceStream
One output stream for the entire simulation.
uint64_t Tick
Tick count type.
StaticInstPtr macroStaticInst
std::string resolve(const std::string &name) const
Returns relative file names prepended with name of this directory.
unsigned getFlags() const
Tick Frequency
The simulated frequency of curTick(). (In ticks per second)
void closeStreams()
If there is a pending message still write it out and then close the file.
bool isFirstMicroop() const
void registerExitCallback(const std::function< void()> &callback)
Register an exit callback.
ThreadContext is the external interface to all thread state for anything outside of the CPU.
ProtoMessage::Inst * curMsg
This is the message were working on writing.
InstPBTrace(const InstPBTraceParams *p)
virtual int cpuId() const =0
friend class InstPBTraceRecord
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
void dump() override
called by the cpu when the instruction commits.
void traceInst(ThreadContext *tc, StaticInstPtr si, TheISA::PCState pc)
Write an instruction to the trace file.
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
This in an instruction tracer that records the flow of instructions through multiple cpus and systems...
GenericISA::DelaySlotPCState< MachInst > PCState
A ProtoOutputStream wraps a coded stream, potentially with compression, based on looking at the file ...
std::unique_ptr< uint8_t[]> buf
Tick curTick()
The current simulated tick.
Generated on Wed Sep 30 2020 14:02:08 for gem5 by doxygen 1.8.17