nanojpeg experiment: counting instructions

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

View File

@ -0,0 +1,37 @@
set(EXPERIMENT_NAME nanojpeg)
set(EXPERIMENT_TYPE NanoJPEGExperiment)
configure_file(../instantiate-experiment-indirect.ah.in
${CMAKE_CURRENT_BINARY_DIR}/instantiate-${EXPERIMENT_NAME}.ah @ONLY
)
#add_aspect_headers(${CMAKE_CURRENT_BINARY_DIR}/instantiate-${EXPERIMENT_NAME}.ah)
## Setup desired protobuf descriptions HERE ##
set(MY_PROTOS
nanojpeg.proto
)
set(MY_CAMPAIGN_SRCS
instantiateExperiment.cc
experiment.hpp
experiment.cc
)
# experimentInfo.hpp
# campaign.hpp
# campaign.cc
#### PROTOBUFS ####
#find_package(Protobuf REQUIRED)
#include_directories(${PROTOBUF_INCLUDE_DIRS})
#include_directories(${CMAKE_CURRENT_BINARY_DIR})
#PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS ${MY_PROTOS})
## Build library
add_library(fail-${EXPERIMENT_NAME} ${PROTO_SRCS} ${PROTO_HDRS} ${MY_CAMPAIGN_SRCS})
add_dependencies(fail-${EXPERIMENT_NAME} fail-tracing)
target_link_libraries(fail-${EXPERIMENT_NAME} ${PROTOBUF_LIBRARY})
## This is the example's campaign server distributing experiment parameters
#add_executable(${EXPERIMENT_NAME}-server main.cc)
#target_link_libraries(${EXPERIMENT_NAME}-server fail-${EXPERIMENT_NAME} fail ${PROTOBUF_LIBRARY} ${Boost_THREAD_LIBRARY})
#install(TARGETS ${EXPERIMENT_NAME}-server RUNTIME DESTINATION bin)

View File

@ -0,0 +1,62 @@
#include <iostream>
// getpid
#include <sys/types.h>
#include <unistd.h>
#include "util/Logger.hpp"
#include "experiment.hpp"
//#include "experimentInfo.hpp"
//#include "campaign.hpp"
#include "sal/SALConfig.hpp"
#include "sal/SALInst.hpp"
#include "sal/Memory.hpp"
#include "sal/Listener.hpp"
// you need to have the tracing plugin enabled for this
#include "../plugins/tracing/TracingPlugin.hpp"
#define LOCAL 1
using namespace std;
using namespace fail;
// Check if configuration dependencies are satisfied:
//#if !defined(CONFIG_EVENT_BREAKPOINTS) || !defined(CONFIG_SR_RESTORE) || \
// !defined(CONFIG_SR_SAVE) || !defined(CONFIG_EVENT_TRAP)
// #error This experiment needs: breakpoints, traps, save, and restore. Enable these in the configuration.
//#endif
bool NanoJPEGExperiment::run()
{
char const *statename = "bochs.state"; // WEATHER_SUFFIX;
Logger log("nJPEG", true);
log << "startup" << endl;
#if 1
// STEP 1: run until main starts, save state
// TODO: record trace, store golden run output
IOPortListener io(0x3f8, true);
simulator.addListenerAndResume(&io);
log << "main() reached, saving state" << endl;
simulator.save(statename);
simulator.addListener(&io);
BPSingleListener step(ANY_ADDR);
long counter = 0;
while (true) {
BaseListener *l = simulator.addListenerAndResume(&step);
if (l == &io) {
break;
}
counter++;
}
log << "golden run took " << counter << " instructions" << endl;
#endif
// Explicitly terminate, or the simulator will continue to run.
simulator.terminate();
}

View File

@ -0,0 +1,13 @@
#ifndef __NANOJPEG_EXPERIMENT_HPP__
#define __NANOJPEG_EXPERIMENT_HPP__
#include "efw/ExperimentFlow.hpp"
#include "efw/JobClient.hpp"
class NanoJPEGExperiment : public fail::ExperimentFlow {
fail::JobClient m_jc;
public:
bool run();
};
#endif // __NANOJPEG_EXPERIMENT_HPP__

View File

@ -0,0 +1,8 @@
#include "experiment.hpp"
#include "sal/SALInst.hpp"
static NanoJPEGExperiment experiment;
void instantiateNanoJPEGExperiment()
{
fail::simulator.addFlow(&experiment);
}