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:
@ -11,6 +11,7 @@ set(MY_PROTOS
|
||||
)
|
||||
|
||||
set(MY_CAMPAIGN_SRCS
|
||||
experimentInfo.hpp
|
||||
instantiateExperiment.cc
|
||||
experiment.hpp
|
||||
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();
|
||||
|
||||
11
src/experiments/nanojpeg/experimentInfo.hpp
Normal file
11
src/experiments/nanojpeg/experimentInfo.hpp
Normal 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
|
||||
Reference in New Issue
Block a user