smarthops: calculate target instruction & allow zero input

As we might need information of target instruction (in case of
checkpoint, etc.) this information is now added to the output
protobuf message.

Trace-Events are generated also for position zero, so this case is
also regarded.

Change-Id: I69ff4818e7f8d6771923802f65bf0aa1b81883c5
This commit is contained in:
Lars Rademacher
2013-12-31 15:53:42 +01:00
parent ba765c16c2
commit 286a28e7ae

View File

@ -24,6 +24,11 @@ void SmartHops::convertToIPM(std::vector<result_tuple > &result, unsigned costs,
it_hop++;
}
if (result.size() > 0 && result.back().first.second != ACCESS_CHECKPOINT) {
ipm.set_target_trace_position(result.back().second);
} else {
ipm.set_target_trace_position(0);
}
ipm.set_costs(costs);
for(;it_hop != result.end();
@ -57,7 +62,15 @@ void SmartHops::convertToIPM(std::vector<result_tuple > &result, unsigned costs,
bool SmartHops::calculateFollowingHop(InjectionPointMessage &ip, unsigned instruction_offset) {
if (instruction_offset == 0) {
m_result.clear();
m_costs = 0;
convertToIPM(m_result, m_costs, ip);
return true;
}
while (m_trace_pos < instruction_offset) {
//m_log << "Calculating " << instruction_offset << std::endl;
if (!m_trace_reader.getNextTraceEvents(m_trace_pos, m_trace_events)) {
return false;
}