changeset 8a28646c4bc2 in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=8a28646c4bc2
description:
Tracing: Make tracing aware of macro and micro ops.
diffstat:
7 files changed, 9 insertions(+), 10 deletions(-)
src/cpu/SConscript | 2 ++
src/cpu/exetrace.hh | 5 +++--
src/cpu/inteltrace.hh | 3 +--
src/cpu/legiontrace.hh | 3 +--
src/cpu/nativetrace.hh | 3 +--
src/cpu/simple/base.cc | 2 --
src/sim/insttracer.hh | 1 +
diffs (truncated from 327 to 300 lines):
diff -r 43139af08499 -r 8a28646c4bc2 src/cpu/SConscript
--- a/src/cpu/SConscript Tue Jan 06 10:36:57 2009 -0500
+++ b/src/cpu/SConscript Tue Jan 06 22:34:18 2009 -0800
@@ -170,10 +170,12 @@
TraceFlag('ExecSymbol')
TraceFlag('ExecThread')
TraceFlag('ExecTicks')
+TraceFlag('ExecMicro')
+TraceFlag('ExecMacro')
TraceFlag('Fetch')
TraceFlag('IntrControl')
TraceFlag('PCEvent')
TraceFlag('Quiesce')
CompoundFlag('Exec', [ 'ExecEnable', 'ExecTicks', 'ExecOpClass', 'ExecThread',
- 'ExecEffAddr', 'ExecResult', 'ExecSymbol' ])
+ 'ExecEffAddr', 'ExecResult', 'ExecSymbol', 'ExecMicro' ])
diff -r 43139af08499 -r 8a28646c4bc2 src/cpu/exetrace.cc
--- a/src/cpu/exetrace.cc Tue Jan 06 10:36:57 2009 -0500
+++ b/src/cpu/exetrace.cc Tue Jan 06 22:34:18 2009 -0800
@@ -46,7 +46,7 @@
namespace Trace {
void
-Trace::ExeTracerRecord::dump()
+Trace::ExeTracerRecord::traceInst(StaticInstPtr inst, bool ran)
{
ostream &outs = Trace::output();
@@ -61,7 +61,6 @@
if (IsOn(ExecThread))
outs << "T" << thread->threadId() << " : ";
-
std::string sym_str;
Addr sym_addr;
if (debugSymbolTable
@@ -69,41 +68,75 @@
&& debugSymbolTable->findNearestSymbol(PC, sym_str, sym_addr)) {
if (PC != sym_addr)
sym_str += csprintf("+%d", PC - sym_addr);
- outs << "@" << sym_str << " : ";
+ outs << "@" << sym_str;
}
else {
- outs << "0x" << hex << PC << " : ";
+ outs << "0x" << hex << PC;
}
+
+ if (inst->isMicroop()) {
+ outs << "." << setw(2) << dec << upc;
+ } else {
+ outs << " ";
+ }
+
+ outs << " : ";
//
// Print decoded instruction
//
outs << setw(26) << left;
- outs << staticInst->disassemble(PC, debugSymbolTable);
- outs << " : ";
+ outs << inst->disassemble(PC, debugSymbolTable);
- if (IsOn(ExecOpClass)) {
- outs << Enums::OpClassStrings[staticInst->opClass()] << " : ";
+ if (ran) {
+ outs << " : ";
+
+ if (IsOn(ExecOpClass)) {
+ outs << Enums::OpClassStrings[inst->opClass()] << " : ";
+ }
+
+ if (IsOn(ExecResult) && data_status != DataInvalid) {
+ ccprintf(outs, " D=%#018x", data.as_int);
+ }
+
+ if (IsOn(ExecEffAddr) && addr_valid)
+ outs << " A=0x" << hex << addr;
+
+ if (IsOn(ExecFetchSeq) && fetch_seq_valid)
+ outs << " FetchSeq=" << dec << fetch_seq;
+
+ if (IsOn(ExecCPSeq) && cp_seq_valid)
+ outs << " CPSeq=" << dec << cp_seq;
}
-
- if (IsOn(ExecResult) && data_status != DataInvalid) {
- ccprintf(outs, " D=%#018x", data.as_int);
- }
-
- if (IsOn(ExecEffAddr) && addr_valid)
- outs << " A=0x" << hex << addr;
-
- if (IsOn(ExecFetchSeq) && fetch_seq_valid)
- outs << " FetchSeq=" << dec << fetch_seq;
-
- if (IsOn(ExecCPSeq) && cp_seq_valid)
- outs << " CPSeq=" << dec << cp_seq;
//
// End of line...
//
outs << endl;
+}
+
+void
+Trace::ExeTracerRecord::dump()
+{
+ /*
+ * The behavior this check tries to achieve is that if ExecMacro is on,
+ * the macroop will be printed. If it's on and microops are also on, it's
+ * printed before the microops start printing to give context. If the
+ * microops aren't printed, then it's printed only when the final microop
+ * finishes. Macroops then behave like regular instructions and don't
+ * complete/print when they fault.
+ */
+ if (IsOn(ExecMacro) && staticInst->isMicroop() &&
+ (IsOn(ExecMicro) &&
+ macroStaticInst && staticInst->isFirstMicroop()) ||
+ (!IsOn(ExecMicro) &&
+ macroStaticInst && staticInst->isLastMicroop())) {
+ traceInst(macroStaticInst, false);
+ }
+ if (IsOn(ExecMicro) || !staticInst->isMicroop()) {
+ traceInst(staticInst, true);
+ }
}
/* namespace Trace */ }
diff -r 43139af08499 -r 8a28646c4bc2 src/cpu/exetrace.hh
--- a/src/cpu/exetrace.hh Tue Jan 06 10:36:57 2009 -0500
+++ b/src/cpu/exetrace.hh Tue Jan 06 22:34:18 2009 -0800
@@ -47,10 +47,14 @@
{
public:
ExeTracerRecord(Tick _when, ThreadContext *_thread,
- const StaticInstPtr &_staticInst, Addr _pc, bool spec)
- : InstRecord(_when, _thread, _staticInst, _pc, spec)
+ const StaticInstPtr _staticInst, Addr _pc, bool spec,
+ const StaticInstPtr _macroStaticInst = NULL, MicroPC _upc = 0)
+ : InstRecord(_when, _thread, _staticInst, _pc, spec,
+ _macroStaticInst, _upc)
{
}
+
+ void traceInst(StaticInstPtr inst, bool ran);
void dump();
};
@@ -64,7 +68,8 @@
InstRecord *
getInstRecord(Tick when, ThreadContext *tc,
- const StaticInstPtr staticInst, Addr pc)
+ const StaticInstPtr staticInst, Addr pc,
+ const StaticInstPtr macroStaticInst = NULL, MicroPC upc = 0)
{
if (!IsOn(ExecEnable))
return NULL;
@@ -76,7 +81,7 @@
return NULL;
return new ExeTracerRecord(when, tc,
- staticInst, pc, tc->misspeculating());
+ staticInst, pc, tc->misspeculating(), macroStaticInst, upc);
}
};
diff -r 43139af08499 -r 8a28646c4bc2 src/cpu/inteltrace.hh
--- a/src/cpu/inteltrace.hh Tue Jan 06 10:36:57 2009 -0500
+++ b/src/cpu/inteltrace.hh Tue Jan 06 22:34:18 2009 -0800
@@ -47,8 +47,10 @@
{
public:
IntelTraceRecord(Tick _when, ThreadContext *_thread,
- const StaticInstPtr &_staticInst, Addr _pc, bool spec)
- : InstRecord(_when, _thread, _staticInst, _pc, spec)
+ const StaticInstPtr _staticInst, Addr _pc, bool spec,
+ const StaticInstPtr _macroStaticInst = NULL, MicroPC _upc = 0)
+ : InstRecord(_when, _thread, _staticInst, _pc, spec,
+ _macroStaticInst, _upc)
{
}
@@ -64,7 +66,8 @@
IntelTraceRecord *
getInstRecord(Tick when, ThreadContext *tc,
- const StaticInstPtr staticInst, Addr pc)
+ const StaticInstPtr staticInst, Addr pc,
+ const StaticInstPtr macroStaticInst = NULL, MicroPC upc = 0)
{
if (!IsOn(ExecEnable))
return NULL;
@@ -76,7 +79,7 @@
return NULL;
return new IntelTraceRecord(when, tc,
- staticInst, pc, tc->misspeculating());
+ staticInst, pc, tc->misspeculating(), macroStaticInst, upc);
}
};
diff -r 43139af08499 -r 8a28646c4bc2 src/cpu/legiontrace.hh
--- a/src/cpu/legiontrace.hh Tue Jan 06 10:36:57 2009 -0500
+++ b/src/cpu/legiontrace.hh Tue Jan 06 22:34:18 2009 -0800
@@ -46,8 +46,10 @@
{
public:
LegionTraceRecord(Tick _when, ThreadContext *_thread,
- const StaticInstPtr &_staticInst, Addr _pc, bool spec)
- : InstRecord(_when, _thread, _staticInst, _pc, spec)
+ const StaticInstPtr _staticInst, Addr _pc, bool spec,
+ const StaticInstPtr _macroStaticInst = NULL, MicroPC _upc = 0)
+ : InstRecord(_when, _thread, _staticInst, _pc, spec,
+ _macroStaticInst, _upc)
{
}
@@ -63,13 +65,14 @@
LegionTraceRecord *
getInstRecord(Tick when, ThreadContext *tc,
- const StaticInstPtr staticInst, Addr pc)
+ const StaticInstPtr staticInst, Addr pc,
+ const StaticInstPtr macroStaticInst = NULL, MicroPC upc = 0)
{
if (tc->misspeculating())
return NULL;
return new LegionTraceRecord(when, tc,
- staticInst, pc, tc->misspeculating());
+ staticInst, pc, tc->misspeculating(), macroStaticInst, upc);
}
};
diff -r 43139af08499 -r 8a28646c4bc2 src/cpu/nativetrace.hh
--- a/src/cpu/nativetrace.hh Tue Jan 06 10:36:57 2009 -0500
+++ b/src/cpu/nativetrace.hh Tue Jan 06 22:34:18 2009 -0800
@@ -54,8 +54,11 @@
public:
NativeTraceRecord(NativeTrace * _parent,
Tick _when, ThreadContext *_thread,
- const StaticInstPtr &_staticInst, Addr _pc, bool spec)
- : InstRecord(_when, _thread, _staticInst, _pc, spec), parent(_parent)
+ const StaticInstPtr _staticInst, Addr _pc, bool spec,
+ const StaticInstPtr _macroStaticInst = NULL, MicroPC _upc = 0)
+ : InstRecord(_when, _thread, _staticInst, _pc, spec,
+ _macroStaticInst, _upc),
+ parent(_parent)
{
}
@@ -192,13 +195,14 @@
NativeTraceRecord *
getInstRecord(Tick when, ThreadContext *tc,
- const StaticInstPtr staticInst, Addr pc)
+ const StaticInstPtr staticInst, Addr pc,
+ const StaticInstPtr macroStaticInst = NULL, MicroPC upc = 0)
{
if (tc->misspeculating())
return NULL;
return new NativeTraceRecord(this, when, tc,
- staticInst, pc, tc->misspeculating());
+ staticInst, pc, tc->misspeculating(), macroStaticInst, upc);
}
void
diff -r 43139af08499 -r 8a28646c4bc2 src/cpu/simple/base.cc
--- a/src/cpu/simple/base.cc Tue Jan 06 10:36:57 2009 -0500
+++ b/src/cpu/simple/base.cc Tue Jan 06 22:34:18 2009 -0800
@@ -418,8 +418,9 @@
if(curStaticInst)
{
#if TRACING_ON
- traceData = tracer->getInstRecord(curTick, tc, curStaticInst,
- thread->readPC());
+ traceData = tracer->getInstRecord(curTick, tc,
+ curStaticInst, thread->readPC(),
+ curMacroStaticInst, thread->readMicroPC());
DPRINTF(Decode,"Decode: Decoded %s instruction: 0x%x\n",
curStaticInst->getName(), curStaticInst->machInst);
diff -r 43139af08499 -r 8a28646c4bc2 src/sim/insttracer.hh
--- a/src/sim/insttracer.hh Tue Jan 06 10:36:57 2009 -0500
+++ b/src/sim/insttracer.hh Tue Jan 06 22:34:18 2009 -0800
@@ -55,6 +55,8 @@
// dump the record
StaticInstPtr staticInst;
Addr PC;
+ StaticInstPtr macroStaticInst;
+ MicroPC upc;
bool misspeculating;
// The remaining fields are only valid for particular instruction
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev