From 286a28e7ae7962294aea6d2cca3aa12f59ca46b7 Mon Sep 17 00:00:00 2001 From: Lars Rademacher Date: Tue, 31 Dec 2013 15:53:42 +0100 Subject: [PATCH] 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 --- src/core/util/smarthops/SmartHops.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/core/util/smarthops/SmartHops.cc b/src/core/util/smarthops/SmartHops.cc index 07e3d4c3..c251957c 100644 --- a/src/core/util/smarthops/SmartHops.cc +++ b/src/core/util/smarthops/SmartHops.cc @@ -24,6 +24,11 @@ void SmartHops::convertToIPM(std::vector &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, 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; }