cosmetics

Change-Id: Ifae805ae1e2dac95324e054af09a7b70f5d5b60c
This commit is contained in:
Horst Schirmeier
2013-04-22 14:24:02 +02:00
parent 2d45a2c52c
commit 0f16f18d75
19 changed files with 101 additions and 103 deletions

View File

@ -39,7 +39,7 @@ fi
for h in $FAIL_DISTRIBUTE_HOSTS for h in $FAIL_DISTRIBUTE_HOSTS
do do
echo Distributing to $h ... echo Distributing to $h ...
rsync -az --partial --delete-before --delete-excluded --exclude=core --exclude=trace.tc . $h:"$FAIL_EXPERIMENT_TARGETDIR" & rsync -az --partial --delete-before --delete-excluded --exclude=core --exclude=*.tc . $h:"$FAIL_EXPERIMENT_TARGETDIR" &
done done
wait wait

View File

@ -14,7 +14,7 @@ SCRIPTDIR=$(readlink -f $(dirname $0))
# env variable defaults # env variable defaults
source $SCRIPTDIR/fail-env.sh source $SCRIPTDIR/fail-env.sh
CMD="killall -q client.sh" CMD="killall -q client.sh; killall -q fail-client"
CONNECTION_ATTEMPTS=2 CONNECTION_ATTEMPTS=2
SSH="ssh -o BatchMode=yes -o ConnectTimeout=60 -o ConnectionAttempts=$CONNECTION_ATTEMPTS" SSH="ssh -o BatchMode=yes -o ConnectTimeout=60 -o ConnectionAttempts=$CONNECTION_ATTEMPTS"
@ -31,3 +31,6 @@ do
$SSH $h "$CMD $NCLIENTS" & $SSH $h "$CMD $NCLIENTS" &
done done
wait
echo "Done."

View File

@ -20,7 +20,7 @@ bool DatabaseCampaign::run() {
CommandLine &cmd = CommandLine::Inst(); CommandLine &cmd = CommandLine::Inst();
cmd.addOption("", "", Arg::None, "USAGE: fail-server [options...]\n\n"); cmd.addOption("", "", Arg::None, "USAGE: fail-server [options...]\n\n");
CommandLine::option_handle HELP = cmd.addOption("h", "help", Arg::None, "-h,--help\t Print usage and exit"); CommandLine::option_handle HELP = cmd.addOption("h", "help", Arg::None, "-h,--help \tPrint usage and exit");
Database::cmdline_setup(); Database::cmdline_setup();
@ -29,11 +29,11 @@ bool DatabaseCampaign::run() {
if (!cb_commandline_init()) return false; if (!cb_commandline_init()) return false;
CommandLine::option_handle VARIANT = cmd.addOption("v", "variant", Arg::Required, CommandLine::option_handle VARIANT = cmd.addOption("v", "variant", Arg::Required,
"-v/--variant\t Variant label (default: \"none\")"); "-v/--variant \tVariant label (default: \"none\")");
CommandLine::option_handle BENCHMARK = cmd.addOption("b", "benchmark", Arg::Required, CommandLine::option_handle BENCHMARK = cmd.addOption("b", "benchmark", Arg::Required,
"-b/--benchmark\t Benchmark label (default: \"none\")\n"); "-b/--benchmark \tBenchmark label (default: \"none\")\n");
CommandLine::option_handle PRUNER = cmd.addOption("p", "prune-method", Arg::Required, CommandLine::option_handle PRUNER = cmd.addOption("p", "prune-method", Arg::Required,
"-p/--prune-method\t Which import method to use (default: basic)"); "-p/--prune-method \tWhich import method to use (default: basic)");
if(!cmd.parse()) { if(!cmd.parse()) {
log_send << "Error parsing arguments." << std::endl; log_send << "Error parsing arguments." << std::endl;

View File

@ -40,7 +40,6 @@ boost::mutex CommThread::m_CommMutex;
ExperimentData *JobServer::getDone() ExperimentData *JobServer::getDone()
{ {
#ifndef __puma #ifndef __puma
if (m_undoneJobs.Size() == 0 if (m_undoneJobs.Size() == 0
&& noMoreExperiments() && noMoreExperiments()
@ -151,7 +150,7 @@ void JobServer::run()
// TODO: Log-level? // TODO: Log-level?
return; return;
} }
cout << "JobServer listening...." << endl; cout << "JobServer listening ..." << endl;
// TODO: Log-level? // TODO: Log-level?
#ifndef __puma #ifndef __puma
boost::thread* th; boost::thread* th;
@ -248,43 +247,39 @@ void CommThread::sendPendingExperimentData(Minion& minion)
ctrlmsg.set_run_id(m_js.m_runid); ctrlmsg.set_run_id(m_js.m_runid);
ctrlmsg.set_command(FailControlMessage::WORK_FOLLOWS); ctrlmsg.set_command(FailControlMessage::WORK_FOLLOWS);
for (i = 0; i < m_job_size ; i++) { for (i = 0; i < m_job_size; i++) {
if (m_js.m_undoneJobs.Dequeue_nb(temp_exp) == true) { if (m_js.m_undoneJobs.Dequeue_nb(temp_exp) == true) {
// Got an element from queue, assign ID to workload and send to minion // Got an element from queue, assign ID to workload and send to minion
workloadID = m_js.m_counter.increment(); // increment workload counter workloadID = m_js.m_counter.increment(); // increment workload counter
temp_exp->setWorkloadID(workloadID); // store ID for identification when receiving result temp_exp->setWorkloadID(workloadID); // store ID for identification when receiving result
ctrlmsg.add_workloadid(workloadID); ctrlmsg.add_workloadid(workloadID);
exp.push_back(temp_exp); exp.push_back(temp_exp);
} else { } else {
break; break;
}
if (!m_js.m_runningJobs.insert(workloadID, temp_exp)) {
cout << "!![Server]could not insert workload id: [" << workloadID << "] double entry?" << endl;
}
} }
if (exp.size() != 0) {
ctrlmsg.set_job_size(exp.size());
cout << " >>["; if (!m_js.m_runningJobs.insert(workloadID, temp_exp)) {
for ( i = 0; i < exp.size() ; i++) { cout << "!![Server]could not insert workload id: [" << workloadID << "] double entry?" << endl;
cout << " "<< ctrlmsg.workloadid(i) <<" "; }
} }
cout << "] " << flush; if (exp.size() != 0) {
ctrlmsg.set_job_size(exp.size());
cout << " >>[" << ctrlmsg.workloadid(0) << "+"
<< exp.size() << "] \r" << flush;
if (SocketComm::sendMsg(minion.getSocketDescriptor(), ctrlmsg)) { if (SocketComm::sendMsg(minion.getSocketDescriptor(), ctrlmsg)) {
for (i = 0; i < ctrlmsg.job_size() ; i++) { for (i = 0; i < ctrlmsg.job_size(); i++) {
if (SocketComm::sendMsg(minion.getSocketDescriptor(), exp.front()->getMessage())) { if (SocketComm::sendMsg(minion.getSocketDescriptor(), exp.front()->getMessage())) {
exp.pop_front(); exp.pop_front();
} else { } else {
break; break;
}
} }
} }
return;
} }
return;
}
#ifndef __puma #ifndef __puma
// Prevent receiveExperimentResults from modifying (or indirectly, via // Prevent receiveExperimentResults from modifying (or indirectly, via
@ -310,7 +305,7 @@ void CommThread::sendPendingExperimentData(Minion& minion)
ctrlmsg.add_workloadid(workloadID); // set workload id ctrlmsg.add_workloadid(workloadID); // set workload id
ctrlmsg.set_job_size(1); // In 2nd priority the jobserver send only one job ctrlmsg.set_job_size(1); // In 2nd priority the jobserver send only one job
//cout << ">>[Server] Re-sending workload [" << workloadID << "]" << endl; //cout << ">>[Server] Re-sending workload [" << workloadID << "]" << endl;
cout << ">>R[" << workloadID << "] " << flush; cout << ">>R[" << workloadID << "] \r" << flush;
if (SocketComm::sendMsg(minion.getSocketDescriptor(), ctrlmsg)) { if (SocketComm::sendMsg(minion.getSocketDescriptor(), ctrlmsg)) {
SocketComm::sendMsg(minion.getSocketDescriptor(), temp_exp->getMessage()); SocketComm::sendMsg(minion.getSocketDescriptor(), temp_exp->getMessage());
} }
@ -332,11 +327,10 @@ void CommThread::receiveExperimentResults(Minion& minion, FailControlMessage& ct
{ {
int i; int i;
ExperimentData* exp = NULL; // Get exp* from running jobs ExperimentData* exp = NULL; // Get exp* from running jobs
cout << " <<[ "; if (ctrlmsg.workloadid_size() > 0) {
for (i = 0; i < ctrlmsg.workloadid_size(); i++) { cout << " <<[" << ctrlmsg.workloadid(0) << "+"
cout << ctrlmsg.workloadid(i) << " "; << ctrlmsg.workloadid_size() << "] \r" << flush;
} }
cout << "] " << flush;
#ifndef __puma #ifndef __puma
// Prevent re-sending jobs in sendPendingExperimentData: // Prevent re-sending jobs in sendPendingExperimentData:
// a) sendPendingExperimentData needs an intact job to serialize and send it. // a) sendPendingExperimentData needs an intact job to serialize and send it.
@ -346,8 +340,8 @@ void CommThread::receiveExperimentResults(Minion& minion, FailControlMessage& ct
// already may cause breakage in sendPendingExperimentData (a). // already may cause breakage in sendPendingExperimentData (a).
boost::unique_lock<boost::mutex> lock(m_CommMutex); boost::unique_lock<boost::mutex> lock(m_CommMutex);
#endif #endif
for (i = 0 ; i < ctrlmsg.workloadid_size() ; i++) { for (i = 0; i < ctrlmsg.workloadid_size(); i++) {
if (m_js.m_runningJobs.remove( ctrlmsg.workloadid(i), exp)) { // ExperimentData* found if (m_js.m_runningJobs.remove(ctrlmsg.workloadid(i), exp)) { // ExperimentData* found
// deserialize results, expect failures // deserialize results, expect failures
if (!SocketComm::rcvMsg(minion.getSocketDescriptor(), exp->getMessage())) { if (!SocketComm::rcvMsg(minion.getSocketDescriptor(), exp->getMessage())) {
m_js.m_runningJobs.insert(ctrlmsg.workloadid(i), exp); m_js.m_runningJobs.insert(ctrlmsg.workloadid(i), exp);

View File

@ -112,21 +112,21 @@ public:
*/ */
ExperimentData* getDone(); ExperimentData* getDone();
/** /**
* The Campaign controller must signalize, that there will be no * The Campaign controller must signal that there will be no more parameter
* more parameter sets. We need this, as we allow concurrent parameter * sets. We need this, as we allow concurrent parameter generation and
* generation and distribution. * distribution.
*/ */
void setNoMoreExperiments() { m_noMoreExps = true; } void setNoMoreExperiments() { m_noMoreExps = true; }
/** /**
* Checks whether there are no more experiment paremeter sets. * Checks whether there are no more experiment parameter sets.
* @return \c true if no more parameter sets available, \c false otherwise * @return \c true if no more parameter sets available, \c false otherwise
* @see setNoMoreExperiments * @see setNoMoreExperiments
*/ */
bool noMoreExperiments() const { return m_noMoreExps; } bool noMoreExperiments() const { return m_noMoreExps; }
/** /**
* The Campaign Controller can signalize, that the jobserver can * The Campaign Controller may signal that the jobserver can stop listening
* stop listening for client connections. * for client connections.
*/ */
void done() { m_finish = true; } void done() { m_finish = true; }
}; };

View File

@ -188,9 +188,7 @@ bool JobClient::sendResult(ExperimentData& result)
if (m_job_throughput > CLIENT_JOB_LIMIT) { if (m_job_throughput > CLIENT_JOB_LIMIT) {
m_job_throughput = CLIENT_JOB_LIMIT; m_job_throughput = CLIENT_JOB_LIMIT;
} } else if (m_job_throughput < 1) {
if (m_job_throughput < 1) {
m_job_throughput = 1; m_job_throughput = 1;
} }

View File

@ -115,6 +115,8 @@ public:
* Fire done: Callback from Simulator * Fire done: Callback from Simulator
*/ */
void fireInterruptDone(); void fireInterruptDone();
virtual simtime_t getTimerTicks() { return bx_pc_system.time_ticks(); }
virtual simtime_t getTimerTicksPerSecond() { return bx_pc_system.time_ticks() / bx_pc_system.time_usec(); /* imprecise hack */ }
/* ******************************************************************** /* ********************************************************************
* BochsController-specific (not implemented in SimulatorController!): * BochsController-specific (not implemented in SimulatorController!):
* ********************************************************************/ * ********************************************************************/
@ -150,8 +152,6 @@ public:
* @see The uses SimulatorController::getCPU(). * @see The uses SimulatorController::getCPU().
*/ */
ConcreteCPU& detectCPU(BX_CPU_C* pCPU) const; ConcreteCPU& detectCPU(BX_CPU_C* pCPU) const;
virtual simtime_t getTimerTicks() { return bx_pc_system.time_ticks(); }
virtual simtime_t getTimerTicksPerSecond() { return bx_pc_system.time_ticks() / bx_pc_system.time_usec(); /* imprecise hack */ }
}; };
} // end-of-namespace: fail } // end-of-namespace: fail

View File

@ -144,11 +144,11 @@ void Database::cmdline_setup() {
CommandLine &cmd = CommandLine::Inst(); CommandLine &cmd = CommandLine::Inst();
DATABASE = cmd.addOption("d", "database", Arg::Required, DATABASE = cmd.addOption("d", "database", Arg::Required,
"-d/--database\t MYSQL Database (default: taken from ~/.my.cnf)"); "-d/--database \tMYSQL Database (default: taken from ~/.my.cnf)");
HOSTNAME = cmd.addOption("H", "hostname", Arg::Required, HOSTNAME = cmd.addOption("H", "hostname", Arg::Required,
"-h/--hostname\t MYSQL Hostname (default: taken from ~/.my.cnf)"); "-h/--hostname \tMYSQL Hostname (default: taken from ~/.my.cnf)");
USERNAME = cmd.addOption("u", "username", Arg::Required, USERNAME = cmd.addOption("u", "username", Arg::Required,
"-u/--username\t MYSQL Username (default: taken from ~/.my.cnf, or your current user)"); "-u/--username \tMYSQL Username (default: taken from ~/.my.cnf, or your current user)");
} }
Database * Database::cmdline_connect() { Database * Database::cmdline_connect() {

View File

@ -251,7 +251,7 @@ int DatabaseProtobufAdapter::TypeBridge_message::gatherTypes(StringJoiner &inser
bool can_be_repeated = true; // default value bool can_be_repeated = true; // default value
// For repeated messages // For repeated messages
TypeBridge_message *top_level_msg; TypeBridge_message *top_level_msg = 0;
const FieldOptions& field_options = field->options(); const FieldOptions& field_options = field->options();
if (field_options.GetExtension(sql_ignore)) { if (field_options.GetExtension(sql_ignore)) {
@ -411,9 +411,7 @@ int DatabaseProtobufAdapter::field_size_at_pos(const Message *msg, std::vector<i
} }
bool DatabaseProtobufAdapter::insert_row(const google::protobuf::Message *msg) { bool DatabaseProtobufAdapter::insert_row(const google::protobuf::Message *msg) {
const Reflection *ref = msg->GetReflection(); assert (msg->GetDescriptor() != 0 && msg->GetReflection() != 0);
const Descriptor *d = msg->GetDescriptor();
assert (d != 0 && ref != 0);
MYSQL_BIND *bind = new MYSQL_BIND[top_level_msg.field_count]; MYSQL_BIND *bind = new MYSQL_BIND[top_level_msg.field_count];

View File

@ -28,7 +28,10 @@ private:
int nextpick; int nextpick;
// We need a window at least as wide as the number of clients we serve. // We need a window at least as wide as the number of clients we serve.
enum { pick_window_size = 2000 }; // FIXME better solution: when inbound queue is empty, *copy* in-flight map
// to a vector, iterate but don't delete; when at the end, copy in-flight
// map again and repeat
enum { pick_window_size = 50000 };
public: public:
SynchronizedMap() : nextpick(0) { } SynchronizedMap() : nextpick(0) { }

View File

@ -33,7 +33,7 @@ public:
#endif #endif
return m_queue.size(); return m_queue.size();
} }
// Add data to the queue and notify others // Add data to the queue and notify others
void Enqueue(const T& data) void Enqueue(const T& data)
{ {
// Acquire lock on the queue // Acquire lock on the queue
@ -47,13 +47,13 @@ public:
#endif #endif
} }
// Add the data to the queue // Add the data to the queue
m_queue.push(data); m_queue.push(data);
// Notify others that data is ready // Notify others that data is ready
#ifndef __puma #ifndef __puma
m_cond.notify_one(); m_cond.notify_one();
#endif #endif
} // Lock is automatically released here } // Lock is automatically released here
/** /**
* Get data from the queue. Wait for data if not available * Get data from the queue. Wait for data if not available
@ -64,15 +64,17 @@ public:
#ifndef __puma #ifndef __puma
boost::unique_lock<boost::mutex> lock(m_mutex); boost::unique_lock<boost::mutex> lock(m_mutex);
#endif #endif
// When there is no data, wait till someone fills it. // When there is no data, wait till someone fills it.
// Lock is automatically released in the wait and obtained // Lock is automatically released in the wait and obtained
// again after the wait // again after the wait
#ifndef __puma #ifndef __puma
while (m_queue.size() == 0) while (m_queue.size() == 0) {
m_cond.wait(lock); m_cond.wait(lock);
}
#endif #endif
// Retrieve the data from the queue // Retrieve the data from the queue
T result=m_queue.front(); m_queue.pop(); T result = m_queue.front();
m_queue.pop();
// Notify others that we have free slots // Notify others that we have free slots
#ifndef __puma #ifndef __puma
@ -101,7 +103,8 @@ public:
// again after the wait // again after the wait
if (m_queue.size() > 0) { if (m_queue.size() > 0) {
// Retrieve the data from the queue // Retrieve the data from the queue
d = m_queue.front(); m_queue.pop(); d = m_queue.front();
m_queue.pop();
// Notify others that we have free slots // Notify others that we have free slots
#ifndef __puma #ifndef __puma
if (m_queue.size() < capacity) { if (m_queue.size() < capacity) {

View File

@ -649,11 +649,11 @@ void EcosKernelTestExperiment::parseOptions()
CommandLine &cmd = CommandLine::Inst(); CommandLine &cmd = CommandLine::Inst();
cmd.addOption("", "", Arg::None, "USAGE: fail-client -Wf,[option] -Wf,[option] ... <BochsOptions...>"); cmd.addOption("", "", Arg::None, "USAGE: fail-client -Wf,[option] -Wf,[option] ... <BochsOptions...>");
CommandLine::option_handle HELP = CommandLine::option_handle HELP =
cmd.addOption("h", "help", Arg::None, "-h,--help\t Print usage and exit"); cmd.addOption("h", "help", Arg::None, "-h,--help \tPrint usage and exit");
CommandLine::option_handle VARIANT = CommandLine::option_handle VARIANT =
cmd.addOption("", "variant", Arg::Required, "--variant v\t experiment variant"); cmd.addOption("", "variant", Arg::Required, "--variant v \texperiment variant");
CommandLine::option_handle BENCHMARK = CommandLine::option_handle BENCHMARK =
cmd.addOption("", "benchmark", Arg::Required, "--benchmark b\t benchmark"); cmd.addOption("", "benchmark", Arg::Required, "--benchmark b \tbenchmark");
if (!cmd.parse()) { if (!cmd.parse()) {
cerr << "Error parsing arguments." << endl; cerr << "Error parsing arguments." << endl;

View File

@ -23,27 +23,27 @@ using namespace fail;
void GenericTracing::parseOptions() { void GenericTracing::parseOptions() {
CommandLine &cmd = CommandLine::Inst(); CommandLine &cmd = CommandLine::Inst();
CommandLine::option_handle IGNORE = cmd.addOption("", "", Arg::None, "USAGE: fail-client -Wf,[option] -Wf,[option] ... <BochsOptions...>\n\n"); CommandLine::option_handle IGNORE = cmd.addOption("", "", Arg::None, "USAGE: fail-client -Wf,[option] -Wf,[option] ... <BochsOptions...>\n\n");
CommandLine::option_handle HELP = cmd.addOption("h", "help", Arg::None, "-h,--help\t Print usage and exit"); CommandLine::option_handle HELP = cmd.addOption("h", "help", Arg::None, "-h,--help \tPrint usage and exit");
CommandLine::option_handle ELF_FILE = cmd.addOption("", "elf-file", Arg::Required, CommandLine::option_handle ELF_FILE = cmd.addOption("", "elf-file", Arg::Required,
"--elf-file\t ELF Binary File (default: $FAIL_ELF_PATH)"); "--elf-file \tELF Binary File (default: $FAIL_ELF_PATH)");
CommandLine::option_handle START_SYMBOL = cmd.addOption("s", "start-symbol", Arg::Required, CommandLine::option_handle START_SYMBOL = cmd.addOption("s", "start-symbol", Arg::Required,
"-s,--start-symbol\t ELF symbol to start tracing (default: main)"); "-s,--start-symbol \tELF symbol to start tracing (default: main)");
CommandLine::option_handle STOP_SYMBOL = cmd.addOption("e", "end-symbol", Arg::Required, CommandLine::option_handle STOP_SYMBOL = cmd.addOption("e", "end-symbol", Arg::Required,
"-e,--end-symbol\t ELF symbol to end tracing"); "-e,--end-symbol \tELF symbol to end tracing");
CommandLine::option_handle SAVE_SYMBOL = cmd.addOption("S", "save-symbol", Arg::Required, CommandLine::option_handle SAVE_SYMBOL = cmd.addOption("S", "save-symbol", Arg::Required,
"-S,--save-symbol\t ELF symbol to save the state of the machine (default: main)\n"); "-S,--save-symbol \tELF symbol to save the state of the machine (default: main)\n");
CommandLine::option_handle STATE_FILE = cmd.addOption("f", "state-file", Arg::Required, CommandLine::option_handle STATE_FILE = cmd.addOption("f", "state-file", Arg::Required,
"-f,--state-file\t File/dir to save the state to (default state)"); "-f,--state-file \tFile/dir to save the state to (default state)");
CommandLine::option_handle TRACE_FILE = cmd.addOption("t", "trace-file", Arg::Required, CommandLine::option_handle TRACE_FILE = cmd.addOption("t", "trace-file", Arg::Required,
"-t,--trace-file\t File to save the execution trace to\n"); "-t,--trace-file \tFile to save the execution trace to\n");
CommandLine::option_handle FULL_TRACE = cmd.addOption("", "full-trace", Arg::None, "--full-trace\t Do a full trace (more data, default: off)"); CommandLine::option_handle FULL_TRACE = cmd.addOption("", "full-trace", Arg::None, "--full-trace \tDo a full trace (more data, default: off)");
CommandLine::option_handle MEM_SYMBOL = cmd.addOption("m", "memory-symbol", Arg::Required, CommandLine::option_handle MEM_SYMBOL = cmd.addOption("m", "memory-symbol", Arg::Required,
"-m,--memory-symbol\t ELF symbol(s) to trace accesses (without specifiying all mem read/writes are traced)"); "-m,--memory-symbol \tELF symbol(s) to trace accesses (without specifiying all mem read/writes are traced)");
CommandLine::option_handle MEM_REGION = cmd.addOption("M", "memory-region", Arg::Required, CommandLine::option_handle MEM_REGION = cmd.addOption("M", "memory-region", Arg::Required,
"-M,--memory-region\t restrict memory region which is traced" "-M,--memory-region \trestrict memory region which is traced"
" Possible formats: 0x<address>, 0x<address>:0x<address>, 0x<address>:<length>"); " Possible formats: 0x<address>, 0x<address>:0x<address>, 0x<address>:<length>");
if(!cmd.parse()) { if(!cmd.parse()) {

View File

@ -1 +1 @@
TracePlugin_pb2.py{,c} TracePlugin_pb2.py

View File

@ -14,13 +14,13 @@ using std::cerr;
using std::hex; using std::hex;
using std::dec; using std::dec;
Logger log("dump-trace", true); Logger LOG("dump-trace", true);
std::istream& openStream(const char *input_file, std::istream& openStream(const char *input_file,
std::ifstream& normal_stream, igzstream& gz_stream) { std::ifstream& normal_stream, igzstream& gz_stream) {
normal_stream.open(input_file); normal_stream.open(input_file);
if (!normal_stream) { if (!normal_stream) {
log << "couldn't open " << input_file << endl; LOG << "couldn't open " << input_file << endl;
exit(-1); exit(-1);
} }
unsigned char b1, b2; unsigned char b1, b2;
@ -30,16 +30,16 @@ std::istream& openStream(const char *input_file,
normal_stream.close(); normal_stream.close();
gz_stream.open(input_file); gz_stream.open(input_file);
if (!gz_stream) { if (!gz_stream) {
log << "couldn't open " << input_file << endl; LOG << "couldn't open " << input_file << endl;
exit(-1); exit(-1);
} }
//log << "opened file " << input_file << " in GZip mode" << endl; //LOG << "opened file " << input_file << " in GZip mode" << endl;
return gz_stream; return gz_stream;
} }
normal_stream.seekg(0); normal_stream.seekg(0);
//log << "opened file " << input_file << " in normal mode" << endl; //LOG << "opened file " << input_file << " in normal mode" << endl;
return normal_stream; return normal_stream;
} }

View File

@ -4,7 +4,6 @@ set(SRCS
DCiAOKernelImporter.cc DCiAOKernelImporter.cc
) )
## This is the example's campaign server distributing experiment parameters add_executable(import-trace main.cc ${SRCS})
add_executable(import-trace main.cc ${SRCS} ${PROTO_SRCS} ${PROTO_HDRS})
target_link_libraries(import-trace ${PROTOBUF_LIBRARY} -lmysqlclient fail-util fail-sal fail-comm) target_link_libraries(import-trace ${PROTOBUF_LIBRARY} -lmysqlclient fail-util fail-sal fail-comm)
install(TARGETS import-trace RUNTIME DESTINATION bin) install(TARGETS import-trace RUNTIME DESTINATION bin)

View File

@ -14,7 +14,7 @@ class Importer {
protected: protected:
int m_variant_id; int m_variant_id;
fail::ElfReader *m_elf; fail::ElfReader *m_elf;
fail::Database *db; fail::Database *db;
public: public:
typedef unsigned instruction_count_t; typedef unsigned instruction_count_t;
@ -27,7 +27,7 @@ public:
virtual bool add_trace_event(instruction_count_t begin, instruction_count_t end, virtual bool add_trace_event(instruction_count_t begin, instruction_count_t end,
const Trace_Event &event, bool is_fake = false) = 0; const Trace_Event &event, bool is_fake = false) = 0;
void set_elf_file(fail::ElfReader *elf) {m_elf = elf;}; void set_elf_file(fail::ElfReader *elf) { m_elf = elf; }
protected: protected:
private: private:
typedef std::map<fail::address_t, instruction_count_t> AddrLastaccessMap; typedef std::map<fail::address_t, instruction_count_t> AddrLastaccessMap;

View File

@ -55,7 +55,7 @@ int main(int argc, char *argv[]) {
for (int i = 1; i < argc; ++i) for (int i = 1; i < argc; ++i)
cmd.add_args(argv[i]); cmd.add_args(argv[i]);
CommandLine::option_handle IGNORE = cmd.addOption("", "", Arg::None, "USAGE: import-trace [options]"); cmd.addOption("", "", Arg::None, "USAGE: import-trace [options]");
CommandLine::option_handle HELP = cmd.addOption("h", "help", Arg::None, "-h/--help\t Print usage and exit"); CommandLine::option_handle HELP = cmd.addOption("h", "help", Arg::None, "-h/--help\t Print usage and exit");
CommandLine::option_handle TRACE_FILE = cmd.addOption("t", "trace-file", Arg::Required, CommandLine::option_handle TRACE_FILE = cmd.addOption("t", "trace-file", Arg::Required,
"-t/--trace-file\t File to load the execution trace from\n"); "-t/--trace-file\t File to load the execution trace from\n");
@ -75,7 +75,7 @@ int main(int argc, char *argv[]) {
"-e/--elf-file\t ELF File (default: UNSET)"); "-e/--elf-file\t ELF File (default: UNSET)");
if(!cmd.parse()) { if (!cmd.parse()) {
std::cerr << "Error parsing arguments." << std::endl; std::cerr << "Error parsing arguments." << std::endl;
exit(-1); exit(-1);
} }

View File

@ -20,17 +20,17 @@ int main(int argc, char *argv[]) {
for (int i = 1; i < argc; ++i) for (int i = 1; i < argc; ++i)
cmd.add_args(argv[i]); cmd.add_args(argv[i]);
CommandLine::option_handle IGNORE = cmd.addOption("", "", Arg::None, "USAGE: import-trace [options]"); cmd.addOption("", "", Arg::None, "USAGE: import-trace [options]");
CommandLine::option_handle HELP = cmd.addOption("h", "help", Arg::None, "-h,--help\t Print usage and exit"); CommandLine::option_handle HELP = cmd.addOption("h", "help", Arg::None, "-h,--help \tPrint usage and exit");
Database::cmdline_setup(); Database::cmdline_setup();
CommandLine::option_handle VARIANT = cmd.addOption("v", "variant", Arg::Required, CommandLine::option_handle VARIANT = cmd.addOption("v", "variant", Arg::Required,
"-v/--variant\t Variant label (default: \"none\")"); "-v/--variant \tVariant label (default: \"none\")");
CommandLine::option_handle BENCHMARK = cmd.addOption("b", "benchmark", Arg::Required, CommandLine::option_handle BENCHMARK = cmd.addOption("b", "benchmark", Arg::Required,
"-b/--benchmark\t Benchmark label (default: \"none\")\n"); "-b/--benchmark \tBenchmark label (default: \"none\")\n");
CommandLine::option_handle PRUNER = cmd.addOption("p", "prune-method", Arg::Required, CommandLine::option_handle PRUNER = cmd.addOption("p", "prune-method", Arg::Required,
"-p/--prune-method\t Which import method to use (default: basic)"); "-p/--prune-method \tWhich import method to use (default: basic)");
if(!cmd.parse()) { if(!cmd.parse()) {
std::cerr << "Error parsing arguments." << std::endl; std::cerr << "Error parsing arguments." << std::endl;