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:
@ -6,7 +6,15 @@ void L4SysCampaign::cb_send_pilot(DatabaseCampaignMessage p)
|
|||||||
{
|
{
|
||||||
L4SysExperimentData *d = new L4SysExperimentData;
|
L4SysExperimentData *d = new L4SysExperimentData;
|
||||||
d->msg.mutable_fsppilot()->CopyFrom(p);
|
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);
|
fail::campaignmanager.addParam(d);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,16 @@
|
|||||||
#ifndef __L4SYS_CAMPAIGN_HPP__
|
#ifndef __L4SYS_CAMPAIGN_HPP__
|
||||||
#define __L4SYS_CAMPAIGN_HPP__
|
#define __L4SYS_CAMPAIGN_HPP__
|
||||||
|
|
||||||
|
|
||||||
#include "cpn/DatabaseCampaign.hpp"
|
#include "cpn/DatabaseCampaign.hpp"
|
||||||
#include "comm/ExperimentData.hpp"
|
#include "comm/ExperimentData.hpp"
|
||||||
#include "l4sys.pb.h"
|
#include "l4sys.pb.h"
|
||||||
#include <google/protobuf/descriptor.h>
|
#include <google/protobuf/descriptor.h>
|
||||||
|
|
||||||
|
#include "util/Logger.hpp"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
class L4SysExperimentData : public fail::ExperimentData {
|
class L4SysExperimentData : public fail::ExperimentData {
|
||||||
public:
|
public:
|
||||||
L4SysProtoMsg msg;
|
L4SysProtoMsg msg;
|
||||||
@ -17,6 +22,11 @@ class L4SysCampaign : public fail::DatabaseCampaign {
|
|||||||
{ return google::protobuf::DescriptorPool::generated_pool()->FindMessageTypeByName("L4SysProtoMsg"); }
|
{ return google::protobuf::DescriptorPool::generated_pool()->FindMessageTypeByName("L4SysProtoMsg"); }
|
||||||
|
|
||||||
virtual void cb_send_pilot(DatabaseCampaignMessage pilot);
|
virtual void cb_send_pilot(DatabaseCampaignMessage pilot);
|
||||||
|
|
||||||
|
fail::Logger log; //<! the logger
|
||||||
|
|
||||||
|
public:
|
||||||
|
std::string type;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __L4SYS_CAMPAIGN_HPP__
|
#endif // __L4SYS_CAMPAIGN_HPP__
|
||||||
|
|||||||
@ -7,13 +7,32 @@
|
|||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
L4SysCampaign c;
|
||||||
|
|
||||||
fail::CommandLine &cmd = fail::CommandLine::Inst();
|
fail::CommandLine &cmd = fail::CommandLine::Inst();
|
||||||
|
|
||||||
for (int i = 1; i < argc; ++i) {
|
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)) {
|
if (fail::campaignmanager.runCampaign(&c)) {
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user