experiments/dciao-kernelstructs: new database driven experiment for DCiAO
The dciao-kernelstructs experiment does a trace imported by the DCiAOKernelImporter: bin/import-trace -t trace.pb -i DCiAOKernelImporter --elf-file app.elf Pruned by the basic method: bin/prune-trace and does CiAO fault injection experiments, where the results are stored in the database. Change-Id: I485dc2e5097b3ebaf354241f474ee3d317213707
This commit is contained in:
@ -7,8 +7,8 @@ static fail::Logger LOG ("BasicPruner");
|
||||
bool BasicPruner::prune_all() {
|
||||
std::stringstream ss;
|
||||
|
||||
ss << "INSERT INTO fsppilot (known_outcome, variant_id, instr2, data_address, fspmethod_id) "
|
||||
"SELECT 0, variant_id, instr2, data_address, " << m_method_id << " "
|
||||
ss << "INSERT INTO fsppilot (known_outcome, variant_id, instr1, instr2, data_address, fspmethod_id) "
|
||||
"SELECT 0, variant_id, instr1, instr2, data_address, " << m_method_id << " "
|
||||
"FROM trace "
|
||||
"WHERE variant_id = " << m_variant_id << " AND accesstype = 'R'";
|
||||
if (!db->query(ss.str().c_str())) return false;
|
||||
@ -16,8 +16,8 @@ bool BasicPruner::prune_all() {
|
||||
|
||||
int rows = db->affected_rows();
|
||||
// single entry for known outcome (write access)
|
||||
ss << "INSERT INTO fsppilot (known_outcome, variant_id, instr2, data_address, fspmethod_id) "
|
||||
"SELECT 1, variant_id, instr2, data_address, " << m_method_id << " "
|
||||
ss << "INSERT INTO fsppilot (known_outcome, variant_id, instr1, instr2, data_address, fspmethod_id) "
|
||||
"SELECT 1, variant_id, instr1, instr2, data_address, " << m_method_id << " "
|
||||
"FROM trace "
|
||||
"WHERE variant_id = " << m_variant_id << " AND accesstype = 'W' "
|
||||
"LIMIT 1";
|
||||
@ -27,19 +27,30 @@ bool BasicPruner::prune_all() {
|
||||
|
||||
LOG << "created " << rows << " fsppilot entries" << std::endl;
|
||||
|
||||
ss << "INSERT INTO fspgroup (variant_id, instr2, data_address, fspmethod_id, pilot_id) "
|
||||
"SELECT variant_id, instr2, data_address, fspmethod_id, id "
|
||||
"FROM fsppilot "
|
||||
"WHERE known_outcome = 0 AND fspmethod_id = " << m_method_id << " AND variant_id = " << m_variant_id;
|
||||
/* When we are in basic-left mode we use the left boundary of the
|
||||
equivalence interval. Sine the current database scheme has no
|
||||
instr2_absolute, we set this to NULL in the basic-left mode. */
|
||||
std::string injection_instr = this->use_instr1 ? "t.instr1" : "t.instr2";
|
||||
std::string injection_instr_absolute = this->use_instr1 ? "NULL" : "t.instr2_absolute";
|
||||
|
||||
ss << "INSERT INTO fspgroup (variant_id, injection_instr, injection_instr_absolute, "
|
||||
<< " data_address, fspmethod_id, pilot_id) "
|
||||
<< "SELECT p.variant_id, " << injection_instr << ", " << injection_instr_absolute << ", p.data_address, p.fspmethod_id, p.id "
|
||||
<< "FROM fsppilot p "
|
||||
<< " JOIN trace t ON t.variant_id = p.variant_id AND t.instr2 = p.instr2"
|
||||
<< " AND t.data_address = p.data_address "
|
||||
<< "WHERE known_outcome = 0 AND p.fspmethod_id = " << m_method_id << " AND p.variant_id = " << m_variant_id;
|
||||
|
||||
if (!db->query(ss.str().c_str())) return false;
|
||||
ss.str("");
|
||||
|
||||
rows = db->affected_rows();
|
||||
ss << "INSERT INTO fspgroup (variant_id, instr2, data_address, fspmethod_id, pilot_id) "
|
||||
"SELECT t.variant_id, t.instr2, t.data_address, p.fspmethod_id, p.id "
|
||||
"FROM trace t "
|
||||
"JOIN fsppilot p "
|
||||
"ON t.variant_id = p.variant_id AND p.fspmethod_id = " << m_method_id << " AND p.known_outcome = 1 "
|
||||
"WHERE t.variant_id = " << m_variant_id << " AND t.accesstype = 'W'";
|
||||
ss << "INSERT INTO fspgroup (variant_id, injection_instr, injection_instr_absolute, data_address, fspmethod_id, pilot_id) "
|
||||
"SELECT t.variant_id, "<< injection_instr << ", " << injection_instr_absolute <<", t.data_address, p.fspmethod_id, p.id "
|
||||
"FROM trace t "
|
||||
"JOIN fsppilot p "
|
||||
"ON t.variant_id = p.variant_id AND p.fspmethod_id = " << m_method_id << " AND p.known_outcome = 1 "
|
||||
"WHERE t.variant_id = " << m_variant_id << " AND t.accesstype = 'W'";
|
||||
if (!db->query(ss.str().c_str())) return false;
|
||||
ss.str("");
|
||||
rows += db->affected_rows();
|
||||
|
||||
@ -4,7 +4,10 @@
|
||||
#include "Pruner.hpp"
|
||||
|
||||
class BasicPruner : public Pruner {
|
||||
virtual std::string method_name() { return "basic"; }
|
||||
bool use_instr1;
|
||||
public:
|
||||
BasicPruner(bool use_instr1 = false) : Pruner(), use_instr1(use_instr1) {}
|
||||
virtual std::string method_name() { return std::string("basic") + (use_instr1 ? "-left" : ""); }
|
||||
virtual bool prune_all();
|
||||
};
|
||||
|
||||
|
||||
@ -28,22 +28,24 @@ bool Pruner::create_database() {
|
||||
" id int(11) NOT NULL AUTO_INCREMENT,"
|
||||
" known_outcome tinyint(4) NOT NULL,"
|
||||
" variant_id int(11) NOT NULL,"
|
||||
" instr1 int(10) unsigned NOT NULL,"
|
||||
" instr2 int(10) unsigned NOT NULL,"
|
||||
" data_address int(10) unsigned NOT NULL,"
|
||||
" fspmethod_id int(11) NOT NULL,"
|
||||
" PRIMARY KEY (id),"
|
||||
" KEY fspmethod_id (fspmethod_id,variant_id,instr2,data_address)"
|
||||
" KEY fspmethod_id (fspmethod_id,variant_id,instr1,instr2,data_address)"
|
||||
") engine=MyISAM ";
|
||||
bool success = (bool) db->query(create_statement.c_str());
|
||||
if (!success) return false;
|
||||
|
||||
create_statement = "CREATE TABLE IF NOT EXISTS fspgroup ("
|
||||
" variant_id int(11) NOT NULL,"
|
||||
" instr2 int(10) unsigned NOT NULL,"
|
||||
" data_address int(10) unsigned NOT NULL,"
|
||||
" fspmethod_id int(11) NOT NULL,"
|
||||
" pilot_id int(11) NOT NULL,"
|
||||
" PRIMARY KEY (variant_id, instr2, data_address, fspmethod_id, pilot_id),"
|
||||
" variant_id int(11) NOT NULL,"
|
||||
" injection_instr int(10) unsigned NOT NULL,"
|
||||
" injection_instr_absolute int(10) unsigned,"
|
||||
" data_address int(10) unsigned NOT NULL,"
|
||||
" fspmethod_id int(11) NOT NULL,"
|
||||
" pilot_id int(11) NOT NULL,"
|
||||
" PRIMARY KEY (variant_id, injection_instr, data_address, fspmethod_id, pilot_id),"
|
||||
" KEY joinresults (pilot_id,fspmethod_id))";
|
||||
|
||||
return db->query(create_statement.c_str());
|
||||
|
||||
@ -43,6 +43,10 @@ int main(int argc, char *argv[]) {
|
||||
if (imp == "basic") {
|
||||
LOG << "Using BasicPruner" << endl;
|
||||
pruner = new BasicPruner();
|
||||
} else if (imp == "basic-left") {
|
||||
LOG << "Using BasicPruner (use left border, instr1)" << endl;
|
||||
pruner = new BasicPruner(true);
|
||||
|
||||
} else {
|
||||
LOG << "Unkown import method: " << imp << endl;
|
||||
exit(-1);
|
||||
|
||||
Reference in New Issue
Block a user