Enhance campain to use parameters. Now we need to add the parameter

--tpye to chosse between memory and register injection.
This commit is contained in:
Tobias Stumpf
2014-06-17 12:44:58 +02:00
parent 43b8c2351c
commit 15c7a863e9
3 changed files with 41 additions and 4 deletions

View File

@ -6,7 +6,15 @@ void L4SysCampaign::cb_send_pilot(DatabaseCampaignMessage p)
{
L4SysExperimentData *d = new L4SysExperimentData;
d->msg.mutable_fsppilot()->CopyFrom(p);
//d->msg.set_exp_type(d->msg.GPRFLIP);
d->msg.set_exp_type(d->msg.MEM);
if(!type.compare("mem")) {
d->msg.set_exp_type(d->msg.MEM);
} else if(!type.compare("reg")) {
d->msg.set_exp_type(d->msg.GPRFLIP);
} else {
log << "Specified FI-type not supported" << std::endl;
exit(-1);
}
fail::campaignmanager.addParam(d);
}

View File

@ -1,11 +1,16 @@
#ifndef __L4SYS_CAMPAIGN_HPP__
#define __L4SYS_CAMPAIGN_HPP__
#include "cpn/DatabaseCampaign.hpp"
#include "comm/ExperimentData.hpp"
#include "l4sys.pb.h"
#include <google/protobuf/descriptor.h>
#include "util/Logger.hpp"
#include <string>
class L4SysExperimentData : public fail::ExperimentData {
public:
L4SysProtoMsg msg;
@ -17,6 +22,11 @@ class L4SysCampaign : public fail::DatabaseCampaign {
{ return google::protobuf::DescriptorPool::generated_pool()->FindMessageTypeByName("L4SysProtoMsg"); }
virtual void cb_send_pilot(DatabaseCampaignMessage pilot);
fail::Logger log; //<! the logger
public:
std::string type;
};
#endif // __L4SYS_CAMPAIGN_HPP__

View File

@ -7,13 +7,32 @@
int main(int argc, char **argv)
{
L4SysCampaign c;
fail::CommandLine &cmd = fail::CommandLine::Inst();
for (int i = 1; i < argc; ++i) {
cmd.add_args(argv[i]);
if(strncmp(argv[i], "--type=", 7) == 0)
c.type = std::string(std::string(argv[i]), 7);
else
cmd.add_args(argv[i]);
}
if (c.type.empty()) {
std::cerr << "You have to specify FI type" << std::endl;
exit(-1);
}
if(!c.type.compare("mem")) {
std::cout << "We will do memory FI" << std::endl;
} else if(!c.type.compare("reg")) {
std::cout << "We will do register FI" << std::endl;
} else {
std::cout << "Specified FI-type not supported" << std::endl;
exit(-1);
}
L4SysCampaign c;
if (fail::campaignmanager.runCampaign(&c)) {
return 0;
} else {