nanojpeg: record trace

git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@1777 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
This commit is contained in:
hsc
2012-10-19 17:52:27 +00:00
parent 26ff3552f2
commit e8c12b4580
3 changed files with 32 additions and 4 deletions

View File

@ -11,6 +11,7 @@ set(MY_PROTOS
)
set(MY_CAMPAIGN_SRCS
experimentInfo.hpp
instantiateExperiment.cc
experiment.hpp
experiment.cc

View File

@ -7,13 +7,14 @@
#include "util/Logger.hpp"
#include "experiment.hpp"
//#include "experimentInfo.hpp"
#include "experimentInfo.hpp"
//#include "campaign.hpp"
#include "sal/SALConfig.hpp"
#include "sal/SALInst.hpp"
#include "sal/Memory.hpp"
#include "sal/Listener.hpp"
#include "sal/Register.hpp"
// you need to have the tracing plugin enabled for this
#include "../plugins/tracing/TracingPlugin.hpp"
@ -37,14 +38,27 @@ bool NanoJPEGExperiment::run()
log << "startup" << endl;
#if 1
// STEP 1: run until main starts, save state
// TODO: record trace, store golden run output
// STEP 1: run until main starts, save state, record trace
// TODO: store golden run output
IOPortListener io(0x3f8, true);
simulator.addListenerAndResume(&io);
log << "main() reached, saving state" << endl;
simulator.save(statename);
// record trace
log << "restoring state" << endl;
simulator.restore(statename);
log << "EIP = " << hex << simulator.getRegisterManager().getInstructionPointer() << endl;
log << "enabling tracing" << endl;
TracingPlugin tp;
tp.setLogIPOnly(true);
ofstream of(NANOJPEG_TRACE);
tp.setTraceFile(&of);
// this must be done *after* configuring the plugin:
simulator.addFlow(&tp);
// count instructions
simulator.addListener(&io);
BPSingleListener step(ANY_ADDR);
long counter = 0;
@ -55,7 +69,9 @@ bool NanoJPEGExperiment::run()
}
counter++;
}
log << "golden run took " << counter << " instructions" << endl;
log << "golden run took " << dec << counter << " instructions" << endl;
simulator.removeFlow(&tp);
of.close();
#endif
// Explicitly terminate, or the simulator will continue to run.
simulator.terminate();

View File

@ -0,0 +1,11 @@
#ifndef __NANOJPEG_EXPERIMENT_INFO_HPP__
#define __NANOJPEG_EXPERIMENT_INFO_HPP__
#define NANOJPEG_TRACE "trace.tc"
#define NANOJPEG_ELF "system.elf"
#define NANOJPEG_BIN "system.bin"
#define NANOJPEG_BIN_OFFSET 0x100000
#define NANOJPEG_RESULTS "nanojpeg.csv"
#define NANOJPEG_INSTR_LIMIT 999999999 // currently "unlimited"
#endif