another directory rename: failstar -> fail
"failstar" sounds like a name for a cruise liner from the 80s. As "*" isn't a desirable part of directory names, just name the whole thing "fail/", the core parts being stored in "fail/core/". Additionally fixing two build system dependency issues: - missing jobserver -> protomessages dependency - broken bochs -> fail dependency (add_custom_target DEPENDS only allows plain file dependencies ... cmake for the win) git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@956 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
This commit is contained in:
31
core/experiments/MHTestCampaign/CMakeLists.txt
Normal file
31
core/experiments/MHTestCampaign/CMakeLists.txt
Normal file
@ -0,0 +1,31 @@
|
||||
set(EXPERIMENT_NAME MHTestCampaign)
|
||||
set(EXPERIMENT_TYPE MHTestExperiment)
|
||||
configure_file(../instantiate-experiment.ah.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/instantiate-${EXPERIMENT_NAME}.ah @ONLY
|
||||
)
|
||||
|
||||
## Setup desired protobuf descriptions HERE ##
|
||||
set(MY_PROTOS
|
||||
MHTest.proto
|
||||
)
|
||||
|
||||
set(MY_CAMPAIGN_SRCS
|
||||
MHTestCampaign.hpp
|
||||
MHTestCampaign.cc
|
||||
experiment.hpp
|
||||
experiment.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(${EXPERIMENT_NAME} ${PROTO_SRCS} ${PROTO_HDRS} ${MY_CAMPAIGN_SRCS})
|
||||
|
||||
## This is the example's campaign server distributing experiment parameters
|
||||
add_executable(${EXPERIMENT_NAME}-server mhcampaign.cc)
|
||||
target_link_libraries(${EXPERIMENT_NAME}-server fail ${PROTOBUF_LIBRARY} ${Boost_THREAD_LIBRARY})
|
||||
5
core/experiments/MHTestCampaign/MHTest.proto
Normal file
5
core/experiments/MHTestCampaign/MHTest.proto
Normal file
@ -0,0 +1,5 @@
|
||||
message MHTestData {
|
||||
optional string foo = 1;
|
||||
optional int32 input = 2;
|
||||
optional int32 output = 3;
|
||||
}
|
||||
42
core/experiments/MHTestCampaign/MHTestCampaign.cc
Normal file
42
core/experiments/MHTestCampaign/MHTestCampaign.cc
Normal file
@ -0,0 +1,42 @@
|
||||
#include "MHTestCampaign.hpp"
|
||||
#include <controller/CampaignManager.hpp>
|
||||
#include <iostream>
|
||||
|
||||
using namespace fi;
|
||||
|
||||
|
||||
bool MHTestCampaign::run()
|
||||
{
|
||||
|
||||
MHExperimentData* datas[m_parameter_count];
|
||||
cout << "[MHTestCampaign] Adding " << m_parameter_count << " values." << endl;
|
||||
for(int i = 1; i <= m_parameter_count; i++){
|
||||
datas[i] = new MHExperimentData;
|
||||
datas[i]->msg.set_input(i);
|
||||
|
||||
campaignmanager.addParam(datas[i]);
|
||||
usleep(100 * 1000); // 100 ms
|
||||
}
|
||||
campaignmanager.noMoreParameters();
|
||||
// test results.
|
||||
int f;
|
||||
int res = 0;
|
||||
int res2 = 0;
|
||||
MHExperimentData * exp;
|
||||
for(int i = 1; i <= m_parameter_count; i++){
|
||||
exp = static_cast<MHExperimentData*>( campaignmanager.getDone() );
|
||||
f = exp->msg.output();
|
||||
// cout << ">>>>>>>>>>>>>>> Output: " << i << "^2 = " << f << endl;
|
||||
res += f;
|
||||
res2 += (i*i);
|
||||
delete exp;
|
||||
}
|
||||
if (res == res2) {
|
||||
cout << "TEST SUCCESSFUL FINISHED! " << "[" << res << "==" << res2 << "]" << endl;
|
||||
}else{
|
||||
cout << "TEST FAILED!" << " [" << res << "!=" << res2 << "]" << endl;
|
||||
}
|
||||
cout << "thats all... " << endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
27
core/experiments/MHTestCampaign/MHTestCampaign.hpp
Normal file
27
core/experiments/MHTestCampaign/MHTestCampaign.hpp
Normal file
@ -0,0 +1,27 @@
|
||||
#ifndef __TESTCAMPAIGN_HPP__
|
||||
#define __TESTCAMPAIGN_HPP__
|
||||
|
||||
|
||||
#include <controller/Campaign.hpp>
|
||||
#include "controller/ExperimentData.hpp"
|
||||
#include <experiments/MHTestCampaign/MHTest.pb.h>
|
||||
|
||||
using namespace fi;
|
||||
|
||||
class MHExperimentData : public ExperimentData {
|
||||
public:
|
||||
MHTestData msg;
|
||||
public:
|
||||
MHExperimentData() : ExperimentData(&msg){ };
|
||||
};
|
||||
|
||||
|
||||
class MHTestCampaign : public Campaign {
|
||||
int m_parameter_count;
|
||||
public:
|
||||
MHTestCampaign(int parametercount) : m_parameter_count(parametercount){};
|
||||
virtual bool run();
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
42
core/experiments/MHTestCampaign/experiment.cc
Normal file
42
core/experiments/MHTestCampaign/experiment.cc
Normal file
@ -0,0 +1,42 @@
|
||||
#include "experiment.hpp"
|
||||
#include "MHTestCampaign.hpp"
|
||||
#include "SAL/SALInst.hpp"
|
||||
#include "SAL/Register.hpp"
|
||||
#include "controller/Event.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
bool MHTestExperiment::run()
|
||||
{
|
||||
|
||||
cout << "[MHTestExperiment] Let's go" << endl;
|
||||
#if 0
|
||||
fi::BPEvent mainbp(0x00003c34);
|
||||
sal::simulator.addEventAndWait(&mainbp);
|
||||
cout << "[MHTestExperiment] breakpoint reached, saving" << endl;
|
||||
sal::simulator.save("hello.main");
|
||||
#else
|
||||
MHExperimentData par;
|
||||
if(m_jc.getParam(par)){
|
||||
|
||||
int num = par.msg.input();
|
||||
cout << "[MHExperiment] stepping " << num << " instructions" << endl;
|
||||
if (num > 0) {
|
||||
fi::BPEvent nextbp(fi::ANY_ADDR);
|
||||
nextbp.setCounter(num);
|
||||
sal::simulator.addEventAndWait(&nextbp);
|
||||
}
|
||||
sal::address_t instr = sal::simulator.getRegisterManager().getInstructionPointer();
|
||||
cout << "[MHTestExperiment] Reached instruction: "
|
||||
<< hex << instr
|
||||
<< endl;
|
||||
par.msg.set_output(instr);
|
||||
m_jc.sendResult(par);
|
||||
} else {
|
||||
cout << "No data for me? :(" << endl;
|
||||
}
|
||||
#endif
|
||||
sal::simulator.terminate();
|
||||
return true;
|
||||
}
|
||||
|
||||
17
core/experiments/MHTestCampaign/experiment.hpp
Normal file
17
core/experiments/MHTestCampaign/experiment.hpp
Normal file
@ -0,0 +1,17 @@
|
||||
#ifndef __TESTEXPERIMENT_HPP__
|
||||
#define __TESTEXPERIMENT_HPP__
|
||||
|
||||
#include "controller/ExperimentFlow.hpp"
|
||||
#include "jobserver/JobClient.hpp"
|
||||
|
||||
class MHTestExperiment : public fi::ExperimentFlow {
|
||||
fi::JobClient m_jc;
|
||||
public:
|
||||
MHTestExperiment(){};
|
||||
~MHTestExperiment(){};
|
||||
bool run();
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
25
core/experiments/MHTestCampaign/mhcampaign.cc
Normal file
25
core/experiments/MHTestCampaign/mhcampaign.cc
Normal file
@ -0,0 +1,25 @@
|
||||
#include "controller/CampaignManager.hpp"
|
||||
#include "experiments/MHTestCampaign/MHTestCampaign.hpp"
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main(int argc, char**argv){
|
||||
|
||||
int paramcount = 0;
|
||||
if(argc == 2){
|
||||
paramcount = atoi(argv[1]);
|
||||
}else{
|
||||
paramcount = 10;
|
||||
}
|
||||
cout << "Running MHTestCampaign [" << paramcount << " parameter sets]" << endl;
|
||||
|
||||
MHTestCampaign mhc(paramcount);
|
||||
campaignmanager.runCampaign(&mhc);
|
||||
|
||||
cout << "Campaign complete." << endl;
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user