From e8c12b458076c3d58b227280083fe21250326da3 Mon Sep 17 00:00:00 2001 From: hsc Date: Fri, 19 Oct 2012 17:52:27 +0000 Subject: [PATCH] nanojpeg: record trace git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@1777 8c4709b5-6ec9-48aa-a5cd-a96041d1645a --- src/experiments/nanojpeg/CMakeLists.txt | 1 + src/experiments/nanojpeg/experiment.cc | 24 +++++++++++++++++---- src/experiments/nanojpeg/experimentInfo.hpp | 11 ++++++++++ 3 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 src/experiments/nanojpeg/experimentInfo.hpp diff --git a/src/experiments/nanojpeg/CMakeLists.txt b/src/experiments/nanojpeg/CMakeLists.txt index 103d16e3..64a44f98 100644 --- a/src/experiments/nanojpeg/CMakeLists.txt +++ b/src/experiments/nanojpeg/CMakeLists.txt @@ -11,6 +11,7 @@ set(MY_PROTOS ) set(MY_CAMPAIGN_SRCS + experimentInfo.hpp instantiateExperiment.cc experiment.hpp experiment.cc diff --git a/src/experiments/nanojpeg/experiment.cc b/src/experiments/nanojpeg/experiment.cc index 62edaddc..bc17df75 100644 --- a/src/experiments/nanojpeg/experiment.cc +++ b/src/experiments/nanojpeg/experiment.cc @@ -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(); diff --git a/src/experiments/nanojpeg/experimentInfo.hpp b/src/experiments/nanojpeg/experimentInfo.hpp new file mode 100644 index 00000000..11e344cd --- /dev/null +++ b/src/experiments/nanojpeg/experimentInfo.hpp @@ -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