cpn: pruning-aware injection points

As we gain some degrees of freedom in choice of the specific
injection instruction offset, this can be used to minimize
navigational costs. This is a first approach towards pruning-aware
injection points.

To do so, we need to modify the sql query, which gets the pilots,
so we additionally join with the trace table to get begin and
end information for equivalence classes, which are feeded into
the creation of InjectionPoints.

Change-Id: I343b712dfcbed1299121f02eee9ce1b136a7ff15
This commit is contained in:
Lars Rademacher
2013-12-03 01:40:40 +01:00
parent d7a9a2811d
commit ba765c16c2
4 changed files with 97 additions and 36 deletions

View File

@ -112,16 +112,17 @@ void DatabaseCampaign::collect_result_thread() {
bool DatabaseCampaign::run_variant(Database::Variant variant) {
/* Gather all unfinished jobs */
int experiment_count;
std::string sql_select = "SELECT pilot_id, g.fspmethod_id, g.variant_id, p.injection_instr, p.injection_instr_absolute, g.data_address, p.data_width ";
std::string sql_select = "SELECT p.id, p.fspmethod_id, p.variant_id, p.injection_instr, p.injection_instr_absolute, p.data_address, p.data_width, t.instr1, t.instr2 ";
std::stringstream ss;
ss << " FROM fspgroup g"
<< " INNER JOIN fsppilot p ON p.id = g.pilot_id "
<< " WHERE p.known_outcome = 0 "
<< " AND g.fspmethod_id = " << fspmethod_id
<< " AND g.variant_id = " << variant.id
<< " AND (SELECT COUNT(*) FROM " + db_connect.result_table() + " as r WHERE r.pilot_id = g.pilot_id)"
ss << " FROM trace t, fsppilot p"
<< " WHERE p.fspmethod_id = " << fspmethod_id
<< " AND p.variant_id = " << variant.id
<< " AND (SELECT COUNT(*) FROM " + db_connect.result_table() + " as r WHERE r.pilot_id = p.id)"
<< " < " << expected_number_of_results(variant.variant, variant.benchmark)
<< " ORDER BY p.injection_instr";
<< " AND p.variant_id = t.variant_id"
<< " AND p.instr2 = t.instr2"
<< " AND p.data_address = t.data_address"
<< " ORDER BY t.instr1";
std::string sql_body = ss.str();
/* Get the number of unfinished experiments */
@ -146,6 +147,8 @@ bool DatabaseCampaign::run_variant(Database::Variant variant) {
unsigned injection_instr = atoi(row[3]);
unsigned data_address = strtoul(row[5], NULL, 10);
unsigned data_width = atoi(row[6]);
unsigned instr1 = strtoul(row[7], NULL, 10);
unsigned instr2 = strtoul(row[8], NULL, 10);
DatabaseCampaignMessage pilot;
@ -157,7 +160,7 @@ bool DatabaseCampaign::run_variant(Database::Variant variant) {
pilot.set_variant(variant.variant);
pilot.set_benchmark(variant.benchmark);
ip.parseFromInjectionInstr(injection_instr);
ip.parseFromInjectionInstr(instr1, instr2);
ip.addToCampaignMessage(pilot);
if (row[4]) {