tools: added compute-hops and dump-hops tools

As these tools work closely together with fail components, its
easiest, to build them in this context. As these tools don't
really matter for fail use, they might never be pushed to the
master branch.

Change-Id: I8c8bd80376d0475f08a531a995d829e85032371b
This commit is contained in:
Lars Rademacher
2013-11-30 22:26:17 +01:00
parent 16ce7a4fee
commit 8b5098abdd
17 changed files with 1180 additions and 8 deletions

View File

@ -5,7 +5,12 @@ message InjectionPointMessage {
// If checkpoint must be used for this hop chain, id is set properly
optional uint32 checkpoint_id = 1;
// If we need to knwo the target dynamic instruction offset,
// here it is
optional uint32 target_trace_position = 4;
// Repeated groups can't be defined as notempty, so a manual
// non-empty check is required at usage
@ -20,4 +25,4 @@ message InjectionPointMessage {
}
required AccessType accesstype = 2;
}
}
}

View File

@ -16,7 +16,7 @@ add_library(fail-cpn ${SRCS})
# if hop-chains need to be calculated by the server, we
# the smarthopping module
if(CONFIG_INJECTIONPOINT_HOPS)
add_dependencies(fail-cpn fail-smarthopping)
add_dependencies(fail-cpn fail-smarthops)
endif(CONFIG_INJECTIONPOINT_HOPS)
add_dependencies(fail-cpn fail-comm)

View File

@ -41,16 +41,25 @@ std::istream& openStream(const char *input_file,
return normal_stream;
}
void TraceReader::openTraceFile(const char *filename)
bool TraceReader::openTraceFile(const char *filename, unsigned int num_inst)
{
normal_stream = new std::ifstream();
gz_stream = new igzstream();
ps = new fail::ProtoIStream(&openStream(filename, *normal_stream, *gz_stream, m_log));
m_max_num_inst = num_inst;
return true;
}
bool TraceReader::getNextTraceEvents(trace_pos_t& trace_pos,
std::vector<trace_event_tuple_t >& trace_events)
{
// Stop after fixed number of instructions, if given as command line argument
if ((m_max_num_inst > 0) && (m_current_position > m_max_num_inst)) {
return false;
}
trace_pos = m_current_position;
// Delivered trace_events vector does not have to be

View File

@ -28,8 +28,13 @@ typedef std::pair<address_t, mem_access_type_e> trace_event_tuple_t;
class TraceReader {
public:
TraceReader() : m_current_position(1), ps(0), normal_stream(0),
gz_stream(0), ev_avail(false), m_log("TraceReader", false) {}
TraceReader() : m_current_position(1),
ps(0),
normal_stream(0),
gz_stream(0),
m_max_num_inst(0),
ev_avail(false),
m_log("TraceReader", false) {}
~TraceReader();
@ -37,12 +42,13 @@ class TraceReader {
bool getNextTraceEvents(trace_pos_t& trace_pos,
std::vector<trace_event_tuple_t >& trace_events);
void openTraceFile(const char *filename);
bool openTraceFile(const char *filename, unsigned int num_inst = 0);
private:
unsigned int m_current_position;
ProtoIStream* ps;
std::ifstream *normal_stream;
igzstream *gz_stream;
unsigned int m_max_num_inst;
Trace_Event ev;
bool ev_avail;

View File

@ -32,5 +32,5 @@ target_link_libraries(fail-${EXPERIMENT_NAME} ${PROTOBUF_LIBRARY})
## This is the example's campaign server distributing experiment parameters
add_executable(${EXPERIMENT_NAME}-server main.cc)
target_link_libraries(${EXPERIMENT_NAME}-server -Wl,--start-group fail-${EXPERIMENT_NAME} fail-sal fail-util fail-cpn fail-smarthopping fail-comm ${PROTOBUF_LIBRARY} ${Boost_THREAD_LIBRARY} -lmysqlclient -Wl,--end-group)
target_link_libraries(${EXPERIMENT_NAME}-server -Wl,--start-group fail-${EXPERIMENT_NAME} fail-sal fail-util fail-cpn fail-smarthops fail-comm ${PROTOBUF_LIBRARY} ${Boost_THREAD_LIBRARY} -lmysqlclient -Wl,--end-group)
install(TARGETS ${EXPERIMENT_NAME}-server RUNTIME DESTINATION bin)